braintree-web-drop-in
Advanced tools
Comparing version 1.25.0 to 1.26.0
CHANGELOG | ||
========= | ||
1.26.0 | ||
------ | ||
- Update braintree-web to v3.71.0 | ||
- Update promise-polyfill to v8.2.0 | ||
- Fix issue where payment method text may be clipped | ||
- Add ability to let the Braintree API decide which payment method to show first (typically, the last payment method added to the customer) instead of showing the payment method designated as the customer's default in the Braintree control panel | ||
```js | ||
braintree.dropin.create({ | ||
// other config options | ||
showDefaultPaymentMethodFirst: false | ||
}); | ||
``` | ||
- Apple Pay | ||
- Fix issue where Apple Pay view was using `canMakePaymentsWithActiveCard` incorrectly | ||
- PayPal | ||
- Fix issue where PayPal buttons would not render correctly when multiple Drop-in instances were loaded (closes #590) | ||
1.25.0 | ||
@@ -5,0 +22,0 @@ ------ |
@@ -304,3 +304,3 @@ 'use strict'; | ||
return self._vaultManager.fetchPaymentMethods({ | ||
defaultFirst: true | ||
defaultFirst: this.merchantConfiguration.showDefaultPaymentMethodFirst !== false | ||
}).then(function (paymentMethods) { | ||
@@ -307,0 +307,0 @@ return self._getSupportedPaymentMethods(paymentMethods).map(function (paymentMethod) { |
34
index.js
@@ -40,3 +40,3 @@ 'use strict'; | ||
* <form id="payment-form" action="/" method="post"> | ||
* <script src="https://js.braintreegateway.com/web/dropin/1.25.0/js/dropin.min.js" | ||
* <script src="https://js.braintreegateway.com/web/dropin/1.26.0/js/dropin.min.js" | ||
* data-braintree-dropin-authorization="CLIENT_AUTHORIZATION" | ||
@@ -59,3 +59,3 @@ * ></script> | ||
* <form id="payment-form" action="/" method="post"> | ||
* <script src="https://js.braintreegateway.com/web/dropin/1.25.0/js/dropin.min.js" | ||
* <script src="https://js.braintreegateway.com/web/dropin/1.26.0/js/dropin.min.js" | ||
* data-braintree-dropin-authorization="CLIENT_AUTHORIZATION" | ||
@@ -75,3 +75,3 @@ * data-paypal.flow="checkout" | ||
* <form id="payment-form" action="/" method="post"> | ||
* <script src="https://js.braintreegateway.com/web/dropin/1.25.0/js/dropin.min.js" | ||
* <script src="https://js.braintreegateway.com/web/dropin/1.26.0/js/dropin.min.js" | ||
* data-braintree-dropin-authorization="CLIENT_AUTHORIZATION" | ||
@@ -91,3 +91,3 @@ * data-locale="de_DE" | ||
* <form id="payment-form" action="/" method="post"> | ||
* <script src="https://js.braintreegateway.com/web/dropin/1.25.0/js/dropin.min.js" | ||
* <script src="https://js.braintreegateway.com/web/dropin/1.26.0/js/dropin.min.js" | ||
* data-braintree-dropin-authorization="CLIENT_AUTHORIZATION" | ||
@@ -102,3 +102,3 @@ * data-card.cardholder-name.required="false" | ||
* <form id="payment-form" action="/" method="post"> | ||
* <script src="https://js.braintreegateway.com/web/dropin/1.25.0/js/dropin.min.js" | ||
* <script src="https://js.braintreegateway.com/web/dropin/1.26.0/js/dropin.min.js" | ||
* data-braintree-dropin-authorization="CLIENT_AUTHORIZATION" | ||
@@ -120,11 +120,11 @@ * data-card.cardholder-name.required="true" | ||
var VERSION = '1.25.0'; | ||
var VERSION = '1.26.0'; | ||
/** | ||
* @typedef {object} cardCreateOptions The configuration options for cards. Internally, Drop-in uses [Hosted Fields](http://braintree.github.io/braintree-web/3.68.0/module-braintree-web_hosted-fields.html) to render the card form. The `overrides.fields` and `overrides.styles` allow the Hosted Fields to be customized. | ||
* @typedef {object} cardCreateOptions The configuration options for cards. Internally, Drop-in uses [Hosted Fields](http://braintree.github.io/braintree-web/3.71.0/module-braintree-web_hosted-fields.html) to render the card form. The `overrides.fields` and `overrides.styles` allow the Hosted Fields to be customized. | ||
* | ||
* @param {(boolean|object)} [cardholderName] Will enable a cardholder name field above the card number field. If set to an object, you can specify whether or not the field is required. If set to a `true`, it will default the field to being present, but not required. | ||
* @param {boolean} [cardholderName.required=false] When true, the cardholder name field will be required to request the payment method nonce. | ||
* @param {object} [overrides.fields] The Hosted Fields [`fields` options](http://braintree.github.io/braintree-web/3.68.0/module-braintree-web_hosted-fields.html#~fieldOptions). Only `number`, `cvv`, `expirationDate` and `postalCode` can be configured. Each is a [Hosted Fields `field` object](http://braintree.github.io/braintree-web/3.68.0/module-braintree-web_hosted-fields.html#~field). `selector` cannot be modified. | ||
* @param {object} [overrides.styles] The Hosted Fields [`styles` options](http://braintree.github.io/braintree-web/3.68.0/module-braintree-web_hosted-fields.html#~styleOptions). These can be used to add custom styles to the Hosted Fields iframes. To style the rest of Drop-in, [review the documentation for customizing Drop-in](https://developers.braintreepayments.com/guides/drop-in/customization/javascript/v3#customize-your-ui). | ||
* @param {object} [overrides.fields] The Hosted Fields [`fields` options](http://braintree.github.io/braintree-web/3.71.0/module-braintree-web_hosted-fields.html#~fieldOptions). Only `number`, `cvv`, `expirationDate` and `postalCode` can be configured. Each is a [Hosted Fields `field` object](http://braintree.github.io/braintree-web/3.71.0/module-braintree-web_hosted-fields.html#~field). `selector` cannot be modified. | ||
* @param {object} [overrides.styles] The Hosted Fields [`styles` options](http://braintree.github.io/braintree-web/3.71.0/module-braintree-web_hosted-fields.html#~styleOptions). These can be used to add custom styles to the Hosted Fields iframes. To style the rest of Drop-in, [review the documentation for customizing Drop-in](https://developers.braintreepayments.com/guides/drop-in/customization/javascript/v3#customize-your-ui). | ||
* @param {boolean} [clearFieldsAfterTokenization=true] When false, the card form will not clear the card data when the customer returns to the card view after a successful tokenization. | ||
@@ -148,3 +148,3 @@ * @param {object} [vault] Configuration for vaulting credit cards. Only applies when using a [client token with a customer id](https://developers.braintreepayments.com/reference/request/client-token/generate/#customer_id). | ||
/** @typedef {object} paypalCreateOptions The configuration options for PayPal and PayPalCredit. For a full list of options see the [PayPal Checkout client reference options](http://braintree.github.io/braintree-web/3.68.0/PayPalCheckout.html#createPayment). | ||
/** @typedef {object} paypalCreateOptions The configuration options for PayPal and PayPalCredit. For a full list of options see the [PayPal Checkout client reference options](http://braintree.github.io/braintree-web/3.71.0/PayPalCheckout.html#createPayment). | ||
* | ||
@@ -247,3 +247,3 @@ * @param {string} flow Either `checkout` for a one-time [Checkout with PayPal](https://developers.braintreepayments.com/guides/paypal/checkout-with-paypal/javascript/v3) flow or `vault` for a [Vault flow](https://developers.braintreepayments.com/guides/paypal/vault/javascript/v3). Required when using PayPal or PayPal Credit. | ||
* | ||
* Some of the PayPal configuration options are listed [here](#~paypalCreateOptions), but for a full list see the [PayPal Checkout client reference options](http://braintree.github.io/braintree-web/3.68.0/PayPalCheckout.html#createPayment). | ||
* Some of the PayPal configuration options are listed [here](#~paypalCreateOptions), but for a full list see the [PayPal Checkout client reference options](http://braintree.github.io/braintree-web/3.71.0/PayPalCheckout.html#createPayment). | ||
* | ||
@@ -254,3 +254,3 @@ * PayPal is not [supported in Internet Explorer versions lower than 11](https://developer.paypal.com/docs/checkout/reference/faq/#which-browsers-does-paypal-checkout-support). | ||
* | ||
* Some of the PayPal Credit configuration options are listed [here](#~paypalCreateOptions), but for a full list see the [PayPal Checkout client reference options](http://braintree.github.io/braintree-web/3.68.0/PayPalCheckout.html#createPayment). For more information on PayPal Credit, see the [Braintree Developer Docs](https://developers.braintreepayments.com/guides/paypal/paypal-credit/javascript/v3). | ||
* Some of the PayPal Credit configuration options are listed [here](#~paypalCreateOptions), but for a full list see the [PayPal Checkout client reference options](http://braintree.github.io/braintree-web/3.71.0/PayPalCheckout.html#createPayment). For more information on PayPal Credit, see the [Braintree Developer Docs](https://developers.braintreepayments.com/guides/paypal/paypal-credit/javascript/v3). | ||
* | ||
@@ -279,2 +279,4 @@ * PayPal Credit is not [supported in Internet Explorer versions lower than 11](https://developer.paypal.com/docs/checkout/reference/faq/#which-browsers-does-paypal-checkout-support). | ||
* | ||
* @param {boolean} [options.showDefaultPaymentMethodFirst=true] When `true` or left out, the customer's default payment method will be displayed first in the list of vaulted payment methods. When `false`, the Braintree API will determine which payment method to display first, typically the latest payment method added to the customer. Only applicable when using a [client token with a customer id](https://developers.braintreepayments.com/reference/request/client-token/generate/#customer_id) and a customer with saved payment methods. | ||
* | ||
* @param {function} [callback] The second argument, `data`, is the {@link Dropin} instance. Returns a promise if no callback is provided. | ||
@@ -294,3 +296,3 @@ * @returns {(void|Promise)} Returns a promise if no callback is provided. | ||
* | ||
* <script src="https://js.braintreegateway.com/web/dropin/1.25.0/js/dropin.min.js"></script> | ||
* <script src="https://js.braintreegateway.com/web/dropin/1.26.0/js/dropin.min.js"></script> | ||
* | ||
@@ -334,3 +336,3 @@ * <script> | ||
* | ||
* <script src="https://js.braintreegateway.com/web/dropin/1.25.0/js/dropin.min.js"></script> | ||
* <script src="https://js.braintreegateway.com/web/dropin/1.26.0/js/dropin.min.js"></script> | ||
* | ||
@@ -413,3 +415,3 @@ * <script> | ||
* | ||
* <script src="https://js.braintreegateway.com/web/dropin/1.25.0/js/dropin.min.js"></script> | ||
* <script src="https://js.braintreegateway.com/web/dropin/1.26.0/js/dropin.min.js"></script> | ||
* | ||
@@ -632,3 +634,3 @@ * <script> | ||
/** | ||
* @description The current version of Drop-in, i.e. `1.25.0`. | ||
* @description The current version of Drop-in, i.e. `1.26.0`. | ||
* @type {string} | ||
@@ -635,0 +637,0 @@ */ |
{ | ||
"name": "braintree-web-drop-in", | ||
"version": "1.25.0", | ||
"version": "1.26.0", | ||
"main": "index.js", | ||
@@ -28,8 +28,8 @@ "scripts": { | ||
"devDependencies": { | ||
"@wdio/browserstack-service": "^6.6.3", | ||
"@wdio/cli": "^6.6.4", | ||
"@wdio/local-runner": "^6.6.4", | ||
"@wdio/mocha-framework": "^6.6.3", | ||
"@wdio/spec-reporter": "^6.6.3", | ||
"@wdio/sync": "^6.6.4", | ||
"@wdio/browserstack-service": "^6.12.0", | ||
"@wdio/cli": "^6.12.0", | ||
"@wdio/local-runner": "^6.12.0", | ||
"@wdio/mocha-framework": "^6.11.0", | ||
"@wdio/spec-reporter": "^6.11.0", | ||
"@wdio/sync": "^6.11.0", | ||
"ansi-colors": "^4.1.0", | ||
@@ -43,4 +43,4 @@ "brfs": "^2.0.2", | ||
"dotenv": "^8.2.0", | ||
"es6-shim": "^0.35.5", | ||
"eslint": "^7.11.0", | ||
"es6-shim": "^0.35.6", | ||
"eslint": "^7.17.0", | ||
"eslint-config-braintree": "^4.0.0", | ||
@@ -57,7 +57,7 @@ "fancy-log": "^1.3.3", | ||
"hint": "^5.3.3", | ||
"jest": "^26.5.3", | ||
"jest": "^26.6.3", | ||
"jsdoc": "^3.6.6", | ||
"jsdoc-template": "braintree/jsdoc-template#3.2.0", | ||
"mkdirp": "^1.0.4", | ||
"mocha": "^8.1.3", | ||
"mocha": "^8.2.1", | ||
"npm-run-all": "^4.1.5", | ||
@@ -73,3 +73,3 @@ "serve-static": "^1.14.1", | ||
"@braintree/asset-loader": "0.4.4", | ||
"@braintree/browser-detection": "1.10.0", | ||
"@braintree/browser-detection": "1.11.0", | ||
"@braintree/class-list": "0.2.0", | ||
@@ -79,4 +79,4 @@ "@braintree/event-emitter": "0.4.1", | ||
"@braintree/wrap-promise": "2.1.0", | ||
"braintree-web": "3.68.0", | ||
"promise-polyfill": "8.1.3" | ||
"braintree-web": "3.71.0", | ||
"promise-polyfill": "8.2.0" | ||
}, | ||
@@ -83,0 +83,0 @@ "browserslist": [ |
# Braintree Web Drop-in | ||
[![BrowserStack Status](https://automate.browserstack.com/badge.svg?badge_key=MHNCQnJqZ042SFFUek9uZTFyV2dQZEppenhsdUVBQU9SMzBLRGxPUXZyaz0tLVNpUjlqUnlPUVVPOWswN1B1WWdySXc9PQ==--7517ca3a283b3a7e80dcf5de3f4270bc47eab891)](https://automate.browserstack.com/public-build/MHNCQnJqZ042SFFUek9uZTFyV2dQZEppenhsdUVBQU9SMzBLRGxPUXZyaz0tLVNpUjlqUnlPUVVPOWswN1B1WWdySXc9PQ==--7517ca3a283b3a7e80dcf5de3f4270bc47eab891) | ||
[![Build Status](https://github.com/braintree/braintree-web-drop-in/workflows/Unit%20Tests/badge.svg)](https://github.com/braintree/braintree-web-drop-in/actions?query=workflow%3A%22Unit+Tests%22) [![Build Status](https://github.com/braintree/braintree-web-drop-in/workflows/Integration%20Tests%20-%20Internet%20Explorer/badge.svg)](https://github.com/braintree/braintree-web-drop-in/actions?query=workflow%3A%22Integration+Tests+-+Internet+Explorer%22) [![Build Status](https://github.com/braintree/braintree-web-drop-in/workflows/Integration%20Tests%20-%20Chrome,%20Firefox%20&%20Safari/badge.svg)](https://github.com/braintree/braintree-web-drop-in/actions?query=workflow%3A%22Integration+Tests+-+Chrome%2C+Firefox+%26+Safari%22) [![Build Status](https://github.com/braintree/braintree-web-drop-in/workflows/Publishing%20Tests/badge.svg)](https://github.com/braintree/braintree-web-drop-in/actions?query=workflow%3A%22Publishing+Tests%22) | ||
[![npm version](https://badge.fury.io/js/braintree-web-drop-in.svg)](https://badge.fury.io/js/braintree-web-drop-in) | ||
A pre-made payments UI for accepting cards and alternative payments in the browser built using version 3 of the [Braintree JS client SDK](https://github.com/braintree/braintree-web). | ||
@@ -35,3 +38,3 @@ | ||
<script src="https://js.braintreegateway.com/web/dropin/1.25.0/js/dropin.min.js"></script> | ||
<script src="https://js.braintreegateway.com/web/dropin/1.26.0/js/dropin.min.js"></script> | ||
@@ -38,0 +41,0 @@ <script> |
@@ -23,3 +23,2 @@ 'use strict'; | ||
var self = this; | ||
var isProduction = self.client.getConfiguration().gatewayConfiguration.environment === 'production'; | ||
@@ -38,19 +37,2 @@ self.applePayConfiguration = assign({}, self.model.merchantConfiguration.applePay); | ||
self.model.on('changeActivePaymentView', function (paymentViewID) { | ||
if (paymentViewID !== self.ID) { | ||
return; | ||
} | ||
global.ApplePaySession.canMakePaymentsWithActiveCard(self.applePayInstance.merchantIdentifier).then(function (canMakePayments) { | ||
if (!canMakePayments) { | ||
if (isProduction) { | ||
self.model.reportError('applePayActiveCardError'); | ||
} else { | ||
console.error('Could not find an active card. This may be because you\'re using a production iCloud account in a sandbox Apple Pay Session. Log in to a Sandbox iCloud account to test this flow, and add a card to your wallet. For additional assistance, visit https://help.braintreepayments.com'); // eslint-disable-line no-console | ||
self.model.reportError('developerError'); | ||
} | ||
} | ||
}); | ||
}); | ||
buttonDiv.onclick = self._showPaymentSheet.bind(self); | ||
@@ -57,0 +39,0 @@ buttonDiv.style['-apple-pay-button-style'] = self.model.merchantConfiguration.applePay.buttonStyle || 'black'; |
@@ -33,2 +33,3 @@ 'use strict'; | ||
var paypalConfiguration = this.model.merchantConfiguration[paypalType]; | ||
var dropinWrapperId = '#braintree--dropin__' + this.model.componentID; | ||
@@ -94,2 +95,4 @@ this.paypalConfiguration = assign({}, paypalConfiguration); | ||
buttonSelector = dropinWrapperId + ' ' + buttonSelector; | ||
return global.paypal.Button.render(checkoutJSConfiguration, buttonSelector).then(function () { | ||
@@ -96,0 +99,0 @@ self.model.asyncDependencyReady(); |
@@ -73,3 +73,3 @@ 'use strict'; | ||
// initiated that action | ||
return error.code === 'VENMO_APP_CANCELED'; | ||
return error.code === 'VENMO_APP_CANCELED' || error.code === 'VENMO_DESKTOP_CANCELED'; | ||
}; | ||
@@ -76,0 +76,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
1369977
27280
84
+ Added@braintree/browser-detection@1.11.0(transitive)
+ Added@braintree/extended-promise@0.4.1(transitive)
+ Addedbraintree-web@3.71.0(transitive)
+ Addedcredit-card-type@9.1.0(transitive)
+ Addedframebus@5.0.0(transitive)
+ Addedpromise-polyfill@8.2.0(transitive)
- Removed@braintree/browser-detection@1.10.0(transitive)
- Removed@braintree/extended-promise@0.4.0(transitive)
- Removedbraintree-web@3.68.0(transitive)
- Removedcredit-card-type@9.0.1(transitive)
- Removedframebus@4.0.4(transitive)
- Removedpromise-polyfill@8.1.3(transitive)
Updatedbraintree-web@3.71.0
Updatedpromise-polyfill@8.2.0