@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 +62 -127
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +6 -19
- package/dist/index.esm.js +62 -127
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/icons/CustomerSearchIcon.js +5 -2
- package/src/components/atoms/icons/PaymentSearchIcon.js +7 -3
- package/src/components/molecules/turnstile-widget/TurnstileWidget.js +25 -116
- package/src/hooks/use-turnstile-script/index.js +6 -19
package/dist/index.d.ts
CHANGED
|
@@ -513,45 +513,32 @@ declare function useConditionallyAddValidator(
|
|
|
513
513
|
* @param {string} verifyURL - The URL of the Turnstile verification script.
|
|
514
514
|
*/
|
|
515
515
|
declare const useTurnstileScript = verifyURL => {
|
|
516
|
-
const [
|
|
517
|
-
const [scriptError, setScriptError] = useState(false);
|
|
518
|
-
|
|
519
|
-
const handleScriptError = () => {
|
|
520
|
-
setScriptError(true);
|
|
521
|
-
setScriptLoaded(false);
|
|
522
|
-
};
|
|
516
|
+
const [isLoaded, setIsLoaded] = useState(false);
|
|
523
517
|
|
|
524
518
|
useEffect(() => {
|
|
525
519
|
if (typeof window === "undefined") {
|
|
526
|
-
|
|
520
|
+
setIsLoaded(false);
|
|
527
521
|
return;
|
|
528
522
|
}
|
|
529
523
|
if (window.turnstile && window.turnstile.render) {
|
|
530
|
-
|
|
524
|
+
setIsLoaded(true);
|
|
531
525
|
return;
|
|
532
526
|
}
|
|
533
527
|
|
|
534
528
|
const script = document.createElement("script");
|
|
535
529
|
script.src = `${verifyURL}?render=explicit`;
|
|
536
530
|
script.onload = () => {
|
|
537
|
-
|
|
538
|
-
};
|
|
539
|
-
script.onerror = () => {
|
|
540
|
-
handleScriptError();
|
|
541
|
-
};
|
|
542
|
-
script.onabort = () => {
|
|
543
|
-
handleScriptError();
|
|
531
|
+
setIsLoaded(true);
|
|
544
532
|
};
|
|
545
533
|
script.defer = true;
|
|
546
534
|
document.getElementsByTagName("head")[0].appendChild(script);
|
|
547
535
|
|
|
548
536
|
return () => {
|
|
549
|
-
|
|
550
|
-
setScriptError(false);
|
|
537
|
+
setIsLoaded(false);
|
|
551
538
|
};
|
|
552
539
|
}, [verifyURL]);
|
|
553
540
|
|
|
554
|
-
return
|
|
541
|
+
return isLoaded;
|
|
555
542
|
};
|
|
556
543
|
|
|
557
544
|
|
package/dist/index.esm.js
CHANGED
|
@@ -15934,7 +15934,9 @@ var TrashIcon = function TrashIcon(_ref) {
|
|
|
15934
15934
|
};
|
|
15935
15935
|
var TrashIcon$1 = themeComponent(TrashIcon, "Icons", fallbackValues$2, "primary");
|
|
15936
15936
|
|
|
15937
|
-
var CustomerSearchIcon = function CustomerSearchIcon() {
|
|
15937
|
+
var CustomerSearchIcon = function CustomerSearchIcon(_ref) {
|
|
15938
|
+
var _ref$fillPrimary = _ref.fillPrimary,
|
|
15939
|
+
fillPrimary = _ref$fillPrimary === void 0 ? MATISSE_BLUE : _ref$fillPrimary;
|
|
15938
15940
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
15939
15941
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15940
15942
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
@@ -16000,13 +16002,17 @@ var CustomerSearchIcon = function CustomerSearchIcon() {
|
|
|
16000
16002
|
fill: "#E4F4FD",
|
|
16001
16003
|
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"
|
|
16002
16004
|
}), /*#__PURE__*/React__default.createElement("path", {
|
|
16003
|
-
fill:
|
|
16005
|
+
fill: fillPrimary,
|
|
16004
16006
|
fillRule: "nonzero",
|
|
16005
16007
|
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"
|
|
16006
16008
|
}))))));
|
|
16007
16009
|
};
|
|
16008
16010
|
|
|
16009
|
-
var PaymentSearchIcon = function PaymentSearchIcon() {
|
|
16011
|
+
var PaymentSearchIcon = function PaymentSearchIcon(_ref) {
|
|
16012
|
+
var _ref$fillPrimary = _ref.fillPrimary,
|
|
16013
|
+
fillPrimary = _ref$fillPrimary === void 0 ? SEA_GREEN : _ref$fillPrimary,
|
|
16014
|
+
_ref$fillSecondary = _ref.fillSecondary,
|
|
16015
|
+
fillSecondary = _ref$fillSecondary === void 0 ? HINT_GREEN : _ref$fillSecondary;
|
|
16010
16016
|
return /*#__PURE__*/React__default.createElement("svg", {
|
|
16011
16017
|
xmlns: "http://www.w3.org/2000/svg",
|
|
16012
16018
|
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
@@ -16072,10 +16078,10 @@ var PaymentSearchIcon = function PaymentSearchIcon() {
|
|
|
16072
16078
|
filter: "url(#payment-search-filter-2)",
|
|
16073
16079
|
xlinkHref: "#payment-search-path-1"
|
|
16074
16080
|
}), /*#__PURE__*/React__default.createElement("path", {
|
|
16075
|
-
fill:
|
|
16081
|
+
fill: fillSecondary,
|
|
16076
16082
|
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"
|
|
16077
16083
|
}), /*#__PURE__*/React__default.createElement("path", {
|
|
16078
|
-
fill:
|
|
16084
|
+
fill: fillPrimary,
|
|
16079
16085
|
fillRule: "nonzero",
|
|
16080
16086
|
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"
|
|
16081
16087
|
}))))));
|
|
@@ -24404,47 +24410,29 @@ function useConditionallyAddValidator(condition, validatorFn, addValidator, remo
|
|
|
24404
24410
|
var useTurnstileScript = function useTurnstileScript(verifyURL) {
|
|
24405
24411
|
var _useState = useState(false),
|
|
24406
24412
|
_useState2 = _slicedToArray(_useState, 2),
|
|
24407
|
-
|
|
24408
|
-
|
|
24409
|
-
var _useState3 = useState(false),
|
|
24410
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
24411
|
-
scriptError = _useState4[0],
|
|
24412
|
-
setScriptError = _useState4[1];
|
|
24413
|
-
var handleScriptError = function handleScriptError() {
|
|
24414
|
-
setScriptError(true);
|
|
24415
|
-
setScriptLoaded(false);
|
|
24416
|
-
};
|
|
24413
|
+
isLoaded = _useState2[0],
|
|
24414
|
+
setIsLoaded = _useState2[1];
|
|
24417
24415
|
useEffect$1(function () {
|
|
24418
24416
|
if (typeof window === "undefined") {
|
|
24419
|
-
|
|
24417
|
+
setIsLoaded(false);
|
|
24420
24418
|
return;
|
|
24421
24419
|
}
|
|
24422
24420
|
if (window.turnstile && window.turnstile.render) {
|
|
24423
|
-
|
|
24421
|
+
setIsLoaded(true);
|
|
24424
24422
|
return;
|
|
24425
24423
|
}
|
|
24426
24424
|
var script = document.createElement("script");
|
|
24427
24425
|
script.src = "".concat(verifyURL, "?render=explicit");
|
|
24428
24426
|
script.onload = function () {
|
|
24429
|
-
|
|
24430
|
-
};
|
|
24431
|
-
script.onerror = function () {
|
|
24432
|
-
handleScriptError();
|
|
24433
|
-
};
|
|
24434
|
-
script.onabort = function () {
|
|
24435
|
-
handleScriptError();
|
|
24427
|
+
setIsLoaded(true);
|
|
24436
24428
|
};
|
|
24437
24429
|
script.defer = true;
|
|
24438
24430
|
document.getElementsByTagName("head")[0].appendChild(script);
|
|
24439
24431
|
return function () {
|
|
24440
|
-
|
|
24441
|
-
setScriptError(false);
|
|
24432
|
+
setIsLoaded(false);
|
|
24442
24433
|
};
|
|
24443
24434
|
}, [verifyURL]);
|
|
24444
|
-
return
|
|
24445
|
-
scriptLoaded: scriptLoaded,
|
|
24446
|
-
scriptError: scriptError
|
|
24447
|
-
};
|
|
24435
|
+
return isLoaded;
|
|
24448
24436
|
};
|
|
24449
24437
|
|
|
24450
24438
|
|
|
@@ -49998,142 +49986,89 @@ var HeroImage$1 = withWindowSize(themeComponent(HeroImage, "HeroImage", fallback
|
|
|
49998
49986
|
var TurnstileWidgetContainer = styled(Box).withConfig({
|
|
49999
49987
|
displayName: "TurnstileWidget__TurnstileWidgetContainer",
|
|
50000
49988
|
componentId: "sc-btaugr-0"
|
|
50001
|
-
})(["display:flex;
|
|
49989
|
+
})(["display:flex;padding:", ";justify-content:", ";width:100%;"], function (_ref) {
|
|
50002
49990
|
var padding = _ref.padding;
|
|
50003
49991
|
return padding;
|
|
50004
49992
|
}, function (_ref2) {
|
|
50005
49993
|
var justify = _ref2.justify;
|
|
50006
49994
|
return justify;
|
|
50007
|
-
}, function (_ref3) {
|
|
50008
|
-
var align = _ref3.align;
|
|
50009
|
-
return align;
|
|
50010
49995
|
});
|
|
50011
|
-
var
|
|
50012
|
-
|
|
50013
|
-
|
|
50014
|
-
|
|
50015
|
-
|
|
50016
|
-
|
|
50017
|
-
|
|
50018
|
-
|
|
50019
|
-
|
|
50020
|
-
|
|
50021
|
-
|
|
50022
|
-
|
|
50023
|
-
|
|
50024
|
-
|
|
50025
|
-
|
|
50026
|
-
|
|
50027
|
-
|
|
50028
|
-
|
|
50029
|
-
|
|
50030
|
-
|
|
50031
|
-
|
|
50032
|
-
|
|
50033
|
-
|
|
50034
|
-
size = _ref4$size === void 0 ? "normal" : _ref4$size,
|
|
50035
|
-
_ref4$tabindex = _ref4.tabindex,
|
|
50036
|
-
tabindex = _ref4$tabindex === void 0 ? 0 : _ref4$tabindex,
|
|
50037
|
-
_ref4$retry = _ref4.retry,
|
|
50038
|
-
retry = _ref4$retry === void 0 ? "never" : _ref4$retry,
|
|
50039
|
-
_ref4$theme = _ref4.theme,
|
|
50040
|
-
theme = _ref4$theme === void 0 ? "light" : _ref4$theme,
|
|
50041
|
-
_ref4$extraStyles = _ref4.extraStyles,
|
|
50042
|
-
extraStyles = _ref4$extraStyles === void 0 ? "" : _ref4$extraStyles;
|
|
49996
|
+
var TurnstileWidget = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
49997
|
+
var verifyURL = _ref3.verifyURL,
|
|
49998
|
+
siteKey = _ref3.siteKey,
|
|
49999
|
+
_ref3$onSuccess = _ref3.onSuccess,
|
|
50000
|
+
onSuccess = _ref3$onSuccess === void 0 ? noop$1 : _ref3$onSuccess,
|
|
50001
|
+
_ref3$onError = _ref3.onError,
|
|
50002
|
+
onError = _ref3$onError === void 0 ? noop$1 : _ref3$onError,
|
|
50003
|
+
_ref3$onExpired = _ref3.onExpired,
|
|
50004
|
+
onExpired = _ref3$onExpired === void 0 ? noop$1 : _ref3$onExpired,
|
|
50005
|
+
_ref3$padding = _ref3.padding,
|
|
50006
|
+
padding = _ref3$padding === void 0 ? "1rem" : _ref3$padding,
|
|
50007
|
+
_ref3$justify = _ref3.justify,
|
|
50008
|
+
justify = _ref3$justify === void 0 ? "flex-end" : _ref3$justify,
|
|
50009
|
+
_ref3$size = _ref3.size,
|
|
50010
|
+
size = _ref3$size === void 0 ? "normal" : _ref3$size,
|
|
50011
|
+
_ref3$tabindex = _ref3.tabindex,
|
|
50012
|
+
tabindex = _ref3$tabindex === void 0 ? 0 : _ref3$tabindex,
|
|
50013
|
+
_ref3$retry = _ref3.retry,
|
|
50014
|
+
retry = _ref3$retry === void 0 ? "auto" : _ref3$retry,
|
|
50015
|
+
_ref3$theme = _ref3.theme,
|
|
50016
|
+
theme = _ref3$theme === void 0 ? "auto" : _ref3$theme,
|
|
50017
|
+
_ref3$extraStyles = _ref3.extraStyles,
|
|
50018
|
+
extraStyles = _ref3$extraStyles === void 0 ? "" : _ref3$extraStyles;
|
|
50043
50019
|
if (!verifyURL || !siteKey) return null;
|
|
50044
50020
|
var widgetRef = useRef(null);
|
|
50045
|
-
var widgetIdRef = useRef(null);
|
|
50046
50021
|
var _useState = useState(null),
|
|
50047
50022
|
_useState2 = _slicedToArray(_useState, 2),
|
|
50048
|
-
|
|
50049
|
-
|
|
50050
|
-
var
|
|
50051
|
-
scriptLoaded = _useTurnstileScript.scriptLoaded,
|
|
50052
|
-
scriptError = _useTurnstileScript.scriptError;
|
|
50053
|
-
|
|
50054
|
-
// Clear the error state
|
|
50055
|
-
var clearError = function clearError() {
|
|
50056
|
-
setError(null);
|
|
50057
|
-
};
|
|
50058
|
-
|
|
50059
|
-
// Handle errors based on the retry strategy
|
|
50060
|
-
var handleError = function handleError(errorCode) {
|
|
50061
|
-
if (!errorCode) return;
|
|
50062
|
-
var isFatalError = FATAL_ERROR_CODES.some(function (pattern) {
|
|
50063
|
-
return pattern.test(errorCode);
|
|
50064
|
-
});
|
|
50065
|
-
var errorMessage = getErrorMessage(isFatalError);
|
|
50066
|
-
setError(errorMessage);
|
|
50067
|
-
};
|
|
50068
|
-
var getErrorMessage = function getErrorMessage(isFatalError) {
|
|
50069
|
-
if (isFatalError) {
|
|
50070
|
-
return "Browser or system error. Please refresh the page or try a different browser.";
|
|
50071
|
-
}
|
|
50072
|
-
return "Something went wrong. Please refresh and try again.";
|
|
50073
|
-
};
|
|
50023
|
+
widgetId = _useState2[0],
|
|
50024
|
+
setWidgetId = _useState2[1];
|
|
50025
|
+
var isTurnstileLoaded = useTurnstileScript(verifyURL);
|
|
50074
50026
|
|
|
50075
50027
|
// Allow the parent component to reset the Turnstile widget
|
|
50076
50028
|
useImperativeHandle(ref, function () {
|
|
50077
50029
|
return {
|
|
50078
50030
|
reset: function reset() {
|
|
50079
|
-
if (
|
|
50080
|
-
window.turnstile.reset(
|
|
50081
|
-
clearError();
|
|
50031
|
+
if (widgetId && window.turnstile) {
|
|
50032
|
+
window.turnstile.reset(widgetId);
|
|
50082
50033
|
}
|
|
50083
50034
|
}
|
|
50084
50035
|
};
|
|
50085
|
-
}, []);
|
|
50036
|
+
}, [widgetId]);
|
|
50086
50037
|
useEffect$1(function () {
|
|
50087
|
-
if (
|
|
50088
|
-
|
|
50089
|
-
|
|
50090
|
-
return;
|
|
50091
|
-
}
|
|
50092
|
-
if (widgetIdRef.current || !window.turnstile || !scriptLoaded) return;
|
|
50093
|
-
try {
|
|
50094
|
-
widgetIdRef.current = window.turnstile.render(widgetRef.current, {
|
|
50038
|
+
if (!widgetRef.current || !window.turnstile) return;
|
|
50039
|
+
if (!widgetId) {
|
|
50040
|
+
var newWidgetId = window.turnstile.render(widgetRef.current, {
|
|
50095
50041
|
sitekey: siteKey,
|
|
50096
50042
|
size: size,
|
|
50097
50043
|
retry: retry,
|
|
50098
50044
|
tabindex: tabindex,
|
|
50099
50045
|
theme: theme,
|
|
50100
50046
|
callback: function callback(token) {
|
|
50101
|
-
|
|
50102
|
-
onSuccess === null || onSuccess === void 0 || onSuccess(token);
|
|
50047
|
+
return onSuccess(token);
|
|
50103
50048
|
},
|
|
50104
|
-
"error-callback": function errorCallback(
|
|
50105
|
-
|
|
50106
|
-
onError === null || onError === void 0 || onError(errorCode);
|
|
50049
|
+
"error-callback": function errorCallback() {
|
|
50050
|
+
return onError();
|
|
50107
50051
|
},
|
|
50108
50052
|
"expired-callback": function expiredCallback() {
|
|
50109
|
-
|
|
50110
|
-
onExpired === null || onExpired === void 0 || onExpired();
|
|
50053
|
+
return onExpired();
|
|
50111
50054
|
}
|
|
50112
50055
|
});
|
|
50113
|
-
|
|
50114
|
-
setError("Unable to load security verification. Please refresh the page.");
|
|
50115
|
-
onError === null || onError === void 0 || onError("render_failed");
|
|
50056
|
+
setWidgetId(newWidgetId);
|
|
50116
50057
|
}
|
|
50117
50058
|
return function () {
|
|
50118
|
-
if (
|
|
50119
|
-
window.turnstile.remove(
|
|
50120
|
-
|
|
50121
|
-
clearError();
|
|
50059
|
+
if (widgetId && window.turnstile) {
|
|
50060
|
+
window.turnstile.remove(widgetId);
|
|
50061
|
+
setWidgetId(null);
|
|
50122
50062
|
}
|
|
50123
50063
|
};
|
|
50124
|
-
}, [
|
|
50125
|
-
return /*#__PURE__*/React__default.createElement(
|
|
50064
|
+
}, [isTurnstileLoaded, siteKey, widgetId]);
|
|
50065
|
+
return /*#__PURE__*/React__default.createElement(TurnstileWidgetContainer, {
|
|
50126
50066
|
padding: padding,
|
|
50127
50067
|
justify: justify,
|
|
50128
|
-
align: align,
|
|
50129
50068
|
extraStyles: extraStyles
|
|
50130
50069
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
50131
50070
|
ref: widgetRef
|
|
50132
|
-
})
|
|
50133
|
-
color: ERROR_COLOR,
|
|
50134
|
-
variant: "pXS",
|
|
50135
|
-
extraStyles: "\n word-break: break-word;\n text-align: end;\n padding-top: 0.5rem;\n "
|
|
50136
|
-
}, error)));
|
|
50071
|
+
}));
|
|
50137
50072
|
});
|
|
50138
50073
|
|
|
50139
50074
|
var pageBackground = "#FBFCFD";
|