From 188ac5051a5902efd3aef8c1b881d4fdfe200cb1 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 11 Sep 2018 21:40:56 +0000 Subject: [PATCH] Removed requirement to load JavaScript from js.braintreegateway.com (#259) * Removed requirement to load JavaScript from js.braintreegateway.com * Moved braintree-web-drop-in from a devDependencies to dependencies per code review. --- package-lock.json | 93 +++++++++++++++++++++++++++ package.json | 1 + src/app/settings/payment.component.ts | 2 +- webpack.config.js | 1 + 4 files changed, 96 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index cbc38e5e74..4043ce66b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -479,6 +479,26 @@ "msgpack5": "^4.0.2" } }, + "@braintree/browser-detection": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@braintree/browser-detection/-/browser-detection-1.7.0.tgz", + "integrity": "sha1-iVumS3AMPzbKtcVFkcr3GkEXHdg=" + }, + "@braintree/iframer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@braintree/iframer/-/iframer-1.0.3.tgz", + "integrity": "sha1-Id0f1M69QVSuqx76TVsNX0OENk4=" + }, + "@braintree/sanitize-url": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@braintree/sanitize-url/-/sanitize-url-2.1.0.tgz", + "integrity": "sha1-VJqdH5I8m8eVOlhdPpqpQpvo/ig=" + }, + "@braintree/wrap-promise": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@braintree/wrap-promise/-/wrap-promise-1.1.1.tgz", + "integrity": "sha1-0ix2hV5tS0ASYQBgQh+uGjfskLA=" + }, "@ngtools/webpack": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-6.2.1.tgz", @@ -1611,6 +1631,48 @@ "repeat-element": "^1.1.2" } }, + "braintree-web": { + "version": "3.37.0", + "resolved": "https://registry.npmjs.org/braintree-web/-/braintree-web-3.37.0.tgz", + "integrity": "sha512-mSfpqUtJ8Lk52hHXg17JUS2iA8t0wdtOplvBqfrRUGP0JEWmNo9FIODmu3j/Q7Rk6ONGUdWHd2HzlXJcq9KNhQ==", + "requires": { + "@braintree/browser-detection": "1.7.0", + "@braintree/iframer": "1.0.3", + "@braintree/sanitize-url": "2.1.0", + "@braintree/wrap-promise": "1.1.1", + "card-validator": "5.0.0", + "credit-card-type": "7.1.0", + "framebus": "3.0.1", + "inject-stylesheet": "1.0.0", + "promise-polyfill": "8.0.0", + "restricted-input": "1.2.7" + }, + "dependencies": { + "promise-polyfill": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-8.0.0.tgz", + "integrity": "sha512-QGmPnw2hDEaRS6freHynJ7nfS1nDg0/P0c/CGglA43utoJjYQMiY9ojEpK0HaJ4wbUztdmwqQRlEfGWdsEQ5uQ==" + } + } + }, + "braintree-web-drop-in": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/braintree-web-drop-in/-/braintree-web-drop-in-1.13.0.tgz", + "integrity": "sha512-UPNwJcFS62FyF6Y2yz7JqM5HsmoqiPGiPPd1Qz3MubVcFy+5y5PkLokWqfkBdieGPcaG0/l16us8Iwuyf0zoLA==", + "requires": { + "@braintree/browser-detection": "1.7.0", + "@braintree/wrap-promise": "1.1.1", + "braintree-web": "3.37.0", + "promise-polyfill": "8.0.0" + }, + "dependencies": { + "promise-polyfill": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-8.0.0.tgz", + "integrity": "sha512-QGmPnw2hDEaRS6freHynJ7nfS1nDg0/P0c/CGglA43utoJjYQMiY9ojEpK0HaJ4wbUztdmwqQRlEfGWdsEQ5uQ==" + } + } + }, "brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", @@ -1817,6 +1879,14 @@ "integrity": "sha512-mYQLZnx5Qt1JgB1WEiMCf2647plpGeQ2NMR/5L0HNZzGQo4fuSPnK+wjfPnKZV0aiJDgzmWqqkV/g7JD+DW0qw==", "dev": true }, + "card-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/card-validator/-/card-validator-5.0.0.tgz", + "integrity": "sha1-PLr27md7Vyf/5SNvgm3BOQ4Uhn0=", + "requires": { + "credit-card-type": "^7.0.0" + } + }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -2371,6 +2441,11 @@ "sha.js": "^2.4.8" } }, + "credit-card-type": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/credit-card-type/-/credit-card-type-7.1.0.tgz", + "integrity": "sha512-ialkYKVSbPLvOSL0ev5SM5ApWJy9lyG8wYLdPbqm5ASSmCQ3Hxr1BWZysIPEWlTQl6fGU0jB8MY58UMtLzI6TA==" + }, "cross-env": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-5.2.0.tgz", @@ -3765,6 +3840,11 @@ "map-cache": "^0.2.2" } }, + "framebus": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/framebus/-/framebus-3.0.1.tgz", + "integrity": "sha1-26vDsI45vzPSSOmvdUvY/7Bc/M4=" + }, "fresh": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", @@ -5372,6 +5452,11 @@ "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true }, + "inject-stylesheet": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/inject-stylesheet/-/inject-stylesheet-1.0.0.tgz", + "integrity": "sha1-9nMEdFjuWPEJ/uTPtmsJ82LMwmE=" + }, "inquirer": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.0.6.tgz", @@ -8337,6 +8422,14 @@ "signal-exit": "^3.0.2" } }, + "restricted-input": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/restricted-input/-/restricted-input-1.2.7.tgz", + "integrity": "sha1-4SmPX9jEMMwtjmuxF1UkAjIFyzQ=", + "requires": { + "@braintree/browser-detection": "^1.5.0" + } + }, "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", diff --git a/package.json b/package.json index 5737691643..2a45d2ec71 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "angular2-toaster": "6.1.0", "angulartics2": "6.3.0", "bootstrap": "4.1.3", + "braintree-web-drop-in": "1.13.0", "core-js": "2.5.7", "duo_web_sdk": "git+https://github.com/duosecurity/duo_web_sdk.git", "font-awesome": "4.7.0", diff --git a/src/app/settings/payment.component.ts b/src/app/settings/payment.component.ts index 06b0da2be7..1268d6cf14 100644 --- a/src/app/settings/payment.component.ts +++ b/src/app/settings/payment.component.ts @@ -55,7 +55,7 @@ export class PaymentComponent implements OnInit { this.platformUtilsService.isDev() ? Keys.stripeTest : Keys.stripeLive); }; this.btScript = window.document.createElement('script'); - this.btScript.src = 'https://js.braintreegateway.com/web/dropin/1.12.0/js/dropin.min.js'; + this.btScript.src = 'scripts/dropin.js'; this.btScript.async = true; this.cardExpMonthOptions = [ diff --git a/webpack.config.js b/webpack.config.js index ed0c695064..52c8521bf0 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -99,6 +99,7 @@ const plugins = [ { from: './src/locales', to: 'locales' }, { from: './src/scripts', to: 'scripts' }, { from: './node_modules/qrious/dist/qrious.min.js', to: 'scripts' }, + { from: './node_modules/braintree-web-drop-in/dist/browser/dropin.js', to: 'scripts' }, ]), extractCss, new webpack.DefinePlugin({