Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const Braintree = props => {
const [{ braintreeToken }, dispatch] = useCheckoutState();
const [{ cart }, cartDispatch] = useCartState();
const [dropinInstance, setDropinInstance] = useState(); // This state is gone after you leave the payment form
const [paymentMethodRequestable, setPaymentMethodRequestable] = useState(false);
const paymentNonceField = useFieldApi('payment_nonce');
const [createBraintreeClientToken, { data: braintreeTokenData, error: braintreeTokenError }] = useMutation(
CREATE_BRAINTREE_CLIENT_TOKEN
);
async function createDropinInstance() {
try {
// Tear down instance if it already exists, e.g. when switching between the PayPal and credit card form.
if (dropinInstance) {
await dropinInstance.teardown();
setDropinInstance(false);
}
let paypal = false;
if (props.accept === 'paypal') {
const amount = {
const SeedWordInput = ({ index, onPaste, placeholder, setFormApiFieldValue }) => {
const inputKey = `word${index}`
const fieldApi = useFieldApi(inputKey)
const [measuredRef, maxHeight] = useMaxScreenHeight(300)
const height = Math.max(maxHeight, 100)
/**
* mask - Masks the value with a trimmed version.
*
* @param {string} value Value to check
* @returns {string} Trimmed string
*/
const mask = value => (value ? value.trim() : value)
/**
* validate - Check if a word is included in the bip39 word list.
*
* @param {string} value Value to check
* @returns {string|undefined} undefined if word is in bip39 word list. The string 'incorrect' otherwise