Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function Dropin(options) {
this._client = options.client;
this._componentID = uuid();
this._dropinWrapper = document.createElement('div');
this._dropinWrapper.id = 'braintree--dropin__' + this._componentID;
this._dropinWrapper.setAttribute('data-braintree-id', 'wrapper');
this._dropinWrapper.style.display = 'none';
this._dropinWrapper.className = 'braintree-loading';
this._merchantConfiguration = options.merchantConfiguration;
EventEmitter.call(this);
}
debug: isDebug,
assetsUrl: assetsUrl,
name: 'Hosted Fields'
});
hostedFieldsUrl = composeUrl(assetsUrl, componentId, isDebug);
if (!options.fields || Object.keys(options.fields).length === 0) {
throw new BraintreeError({
type: sharedErrors.INSTANTIATION_OPTION_REQUIRED.type,
code: sharedErrors.INSTANTIATION_OPTION_REQUIRED.code,
message: 'options.fields is required when instantiating Hosted Fields.'
});
}
EventEmitter.call(this);
this._injectedNodes = [];
this._destructor = new Destructor();
this._fields = fields;
this._state = {
fields: {},
cards: getCardTypes('')
};
this._bus = new Bus({
channel: componentId,
merchantUrl: location.href
});
this._destructor.registerFunctionForTeardown(function () {
self._bus.teardown();
function PaymentRequestComponent(options) {
var enabledPaymentMethods = options.enabledPaymentMethods || {};
EventEmitter.call(this);
this._componentId = uuid();
this._client = options.client;
this._enabledPaymentMethods = {
basicCard: enabledPaymentMethods.basicCard !== false,
googlePay: enabledPaymentMethods.googlePay !== false
};
this._googlePayVersion = options.googlePayVersion === 2 ? 2 : 1;
this._googleMerchantId = BRAINTREE_GOOGLE_PAY_MERCHANT_ID;
this._supportedPaymentMethods = this._constructDefaultSupportedPaymentMethods();
this._defaultSupportedPaymentMethods = Object.keys(this._supportedPaymentMethods).map(function (key) {
return this._supportedPaymentMethods[key];
}.bind(this));
this._bus = new Bus({channel: this._componentId});
}
function DropinModel(options) {
this.componentID = options.componentID;
this.merchantConfiguration = options.merchantConfiguration;
this.isGuestCheckout = isGuestCheckout(options.client);
this.dependenciesInitializing = 0;
this.dependencySuccessCount = 0;
this.failedDependencies = {};
this._options = options;
this._setupComplete = false;
EventEmitter.call(this);
}
function EventedModel() {
EventEmitter.call(this);
this._attributes = this.resetAttributes();
}
function ThreeDSecure(options) {
var self = this;
var Framework = FRAMEWORKS[options.framework];
EventEmitter.call(this);
this._framework = new Framework(options);
this._framework.setUpEventListeners(function () {
self._emit.apply(self, arguments);
});
}