Skip to content

Commit

Permalink
fix: fixes the drop in error in a more robust way
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddie Ferrer committed Dec 1, 2021
1 parent b01e746 commit b5ee94c
Show file tree
Hide file tree
Showing 9 changed files with 798 additions and 789 deletions.
20 changes: 9 additions & 11 deletions src/components/AutoDeposit/AutoDepositDropInPaymentWrapper.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
<template>
<div class="row">
<div class="dropin-payment-holder small-12 columns">
<keep-alive>
<braintree-drop-in-interface
v-if="isClientReady"
ref="braintreeDropInInterface"
:amount="amount | numeral('0.00')"
flow="vault"
:payment-types="['paypal', 'card']"
:preselect-vaulted-payment-method="action === 'Registration'"
@transactions-enabled="enableConfirmButton = $event"
/>
</keep-alive>
<braintree-drop-in-interface
v-if="isClientReady"
ref="braintreeDropInInterface"
:amount="amount | numeral('0.00')"
flow="vault"
:payment-types="['paypal', 'card']"
:preselect-vaulted-payment-method="action === 'Registration'"
@transactions-enabled="enableConfirmButton = $event"
/>
<div id="dropin-button">
<kv-button
value="submit"
Expand Down
20 changes: 9 additions & 11 deletions src/components/Causes/CausesDropInPaymentWrapper.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
<template>
<div class="dropin-payment-holder tw-px-0 tw-max-w-md">
<keep-alive>
<braintree-drop-in-interface
v-if="isClientReady"
ref="braintreeDropInInterface"
:amount="amount | numeral('0.00')"
flow="vault"
:payment-types="['paypal', 'card']"
:preselect-vaulted-payment-method="action === 'Registration'"
@transactions-enabled="enableConfirmButton = $event"
/>
</keep-alive>
<braintree-drop-in-interface
v-if="isClientReady"
ref="braintreeDropInInterface"
:amount="amount | numeral('0.00')"
flow="vault"
:payment-types="['paypal', 'card']"
:preselect-vaulted-payment-method="action === 'Registration'"
@transactions-enabled="enableConfirmButton = $event"
/>
<div id="dropin-submit" class="tw-w-full">
<kv-button
:state="buttonState"
Expand Down
22 changes: 10 additions & 12 deletions src/components/Checkout/CheckoutDropInPaymentWrapper.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<template>
<div class="row align-right">
<div class="dropin-payment-holder small-12 columns">
<keep-alive>
<braintree-drop-in-interface
v-if="isClientReady"
ref="braintreeDropInInterface"
:amount="amount"
flow="checkout"
:payment-types="paymentTypes"
:preselect-vaulted-payment-method="!isGuestCheckout"
:auth="isGuestCheckout ? 'token-key' : 'client-token'"
@transactions-enabled="enableCheckoutButton = $event"
/>
</keep-alive>
<braintree-drop-in-interface
v-if="isClientReady"
ref="braintreeDropInInterface"
:amount="amount"
flow="checkout"
:payment-types="paymentTypes"
:preselect-vaulted-payment-method="!isGuestCheckout"
:auth="isGuestCheckout ? 'token-key' : 'client-token'"
@transactions-enabled="enableCheckoutButton = $event"
/>
<div v-if="isGuestCheckout" id="guest-checkout">
<label class="input-label" for="email">
Where should we email your receipt?
Expand Down
20 changes: 9 additions & 11 deletions src/components/MonthlyGood/MonthlyGoodDropInPaymentWrapper.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
<template>
<div class="row align-center">
<div class="dropin-payment-holder small-12 columns">
<keep-alive>
<braintree-drop-in-interface
v-if="isClientReady"
ref="braintreeDropInInterface"
:amount="amount | numeral('0.00')"
flow="vault"
:payment-types="['paypal', 'card']"
:preselect-vaulted-payment-method="action === 'Registration'"
@transactions-enabled="enableConfirmButton = $event"
/>
</keep-alive>
<braintree-drop-in-interface
v-if="isClientReady"
ref="braintreeDropInInterface"
:amount="amount | numeral('0.00')"
flow="vault"
:payment-types="['paypal', 'card']"
:preselect-vaulted-payment-method="action === 'Registration'"
@transactions-enabled="enableConfirmButton = $event"
/>
<div id="dropin-button">
<kv-button
value="submit"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Payment/BraintreeDropInInterface.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export default {
},
mounted() {
// Prevents BT error in the case this component gets initialized multiple times
const isElementEmpty = document.getElementById('dropin-container').innerHTML === '';
const isElementEmpty = document?.getElementById('dropin-container')?.innerHTML === '';
if (isElementEmpty) {
this.getDropInAuthToken();
}
Expand Down
Loading

0 comments on commit b5ee94c

Please sign in to comment.