Skip to content

Commit

Permalink
v1.1.0: Add TypeScript typings
Browse files Browse the repository at this point in the history
  • Loading branch information
Cretezy committed Oct 8, 2019
1 parent edc5851 commit 3f74dd9
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v1.1.0 (2019-10-07)

- Add TypeScript typings (thanks @paulinfrancis!)
- Fix `preselectVaultedPaymentMethod` not being used

## v1.0.11 (2019-10-07)

- Upgrade dependencies
Expand Down
12 changes: 12 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from 'react';
import { Options as BraintreeOptions, Dropin } from 'braintree-web-drop-in';

export type Options = Omit<BraintreeOptions, 'container'>;

export interface IDropInProps {
options: Options;
preselectVaultedPaymentMethod?: boolean,
onInstance?: (instance: Dropin) => void;
}

export default class DropIn extends React.Component<IDropInProps> { }
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "braintree-web-drop-in-react",
"version": "1.0.11",
"version": "1.1.0",
"description": "React component for Braintree Web Drop-In (v3)",
"keywords": [
"braintree",
Expand All @@ -18,12 +18,13 @@
"lib/*"
],
"main": "lib/index.js",
"types": "index.d.ts",
"scripts": {
"build": "babel src -d lib --source-maps && terser lib/index.js -o lib/index.min.js --source-map 'content=lib/index.js.map'",
"clean": "rimraf lib",
"example": "cd example && npm install && npm run start",
"format": "prettier --write 'src/**.js' package.json CHANGELOG.md README.md .travis.yml example/index.html example/index.js example/README.md example/package.json",
"test": "jest",
"example": "cd example && npm install && npm run start"
"test": "jest"
},
"dependencies": {
"braintree-web-drop-in": "^1.20.2",
Expand All @@ -37,6 +38,8 @@
"@babel/preset-env": "^7.6.2",
"@babel/preset-react": "^7.0.0",
"@babel/runtime": "^7.6.2",
"@types/braintree-web-drop-in": "^1.18.0",
"@types/react": "^16.9.5",
"babel-jest": "^24.9.0",
"jest": "^24.9.0",
"prettier": "^1.18.2",
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default class DropIn extends React.Component {
async componentDidMount() {
this.instance = await BraintreeWebDropIn.create({
container: ReactDOM.findDOMNode(this.wrapper),
preselectVaultedPaymentMethod: this.props.preselectVaultedPaymentMethod,
...this.props.options
});

Expand Down
23 changes: 23 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,11 @@
dependencies:
"@babel/types" "^7.3.0"

"@types/braintree-web-drop-in@^1.18.0":
version "1.18.0"
resolved "https://registry.yarnpkg.com/@types/braintree-web-drop-in/-/braintree-web-drop-in-1.18.0.tgz#bcf08748775708963e8faa05120c25445b6b0fab"
integrity sha512-DefnVXmGHd+z9racz7eKrtKH3I3HKqf0X45Pc1DUCH/dHTN3p5cpQ6E6g7l5RR6TuyZMh1fwjWtGa87kvjvR7A==

"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff"
Expand All @@ -995,6 +1000,19 @@
"@types/istanbul-lib-coverage" "*"
"@types/istanbul-lib-report" "*"

"@types/prop-types@*":
version "15.7.3"
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7"
integrity sha512-KfRL3PuHmqQLOG+2tGpRO26Ctg+Cq1E01D2DMriKEATHgWLfeNDmq9e29Q9WIky0dQ3NPkd1mzYH8Lm936Z9qw==

"@types/react@^16.9.5":
version "16.9.5"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.5.tgz#079dabd918b19b32118c25fd00a786bb6d0d5e51"
integrity sha512-jQ12VMiFOWYlp+j66dghOWcmDDwhca0bnlcTxS4Qz/fh5gi6wpaZDthPEu/Gc/YlAuO87vbiUXL8qKstFvuOaA==
dependencies:
"@types/prop-types" "*"
csstype "^2.2.0"

"@types/stack-utils@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e"
Expand Down Expand Up @@ -1560,6 +1578,11 @@ cssstyle@^1.0.0:
dependencies:
cssom "0.3.x"

csstype@^2.2.0:
version "2.6.7"
resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.7.tgz#20b0024c20b6718f4eda3853a1f5a1cce7f5e4a5"
integrity sha512-9Mcn9sFbGBAdmimWb2gLVDtFJzeKtDGIr76TUqmjZrw9LFXBMSU70lcs+C0/7fyCd6iBDqmksUcCOUIkisPHsQ==

dashdash@^1.12.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
Expand Down

0 comments on commit 3f74dd9

Please sign in to comment.