UNPKG

@widergy/web-utils

Version:
32 lines (31 loc) 1.43 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.disableReactDevTools = exports.loadRecaptchaScript = void 0; const loadRecaptchaScript = () => { if (!document.getElementById('recaptchaScript')) { const head = document.getElementsByTagName('head')[0]; const script = document.createElement('script'); script.src = 'https://www.google.com/recaptcha/api.js?&hl=es-419'; script.id = 'recaptchaScript'; script.nonce = 'cmVjYXB0Y2hhU2NyaXB0Tm9uY2U='; script.defer = true; script.async = true; head.appendChild(script); } }; exports.loadRecaptchaScript = loadRecaptchaScript; const disableReactDevTools = () => { if (typeof window.__REACT_DEVTOOLS_GLOBAL_HOOK__ === 'object' && process.env.NODE_ENV !== 'development') { const devToolsKeys = Object.keys(window.__REACT_DEVTOOLS_GLOBAL_HOOK__); for (let index = 0; index <= devToolsKeys.length; index += 1) { const newValue = typeof window.__REACT_DEVTOOLS_GLOBAL_HOOK__[devToolsKeys[index]] === 'function' ? () => { } : null; window.__REACT_DEVTOOLS_GLOBAL_HOOK__[devToolsKeys[index]] = newValue; } } }; exports.disableReactDevTools = disableReactDevTools; const CONFIG_UTILS = { loadRecaptchaScript: exports.loadRecaptchaScript, disableReactDevTools: exports.disableReactDevTools }; exports.default = CONFIG_UTILS;