braintreeact
Advanced tools
Comparing version 1.0.4 to 1.1.0
import React from 'react'; | ||
import { FieldOptions, FieldEvents } from './types'; | ||
declare const Field: React.FC<BaseProps & FieldOptions & FieldEvents>; | ||
import { FieldProps } from './types'; | ||
declare const Field: React.FC<FieldProps>; | ||
export default Field; | ||
declare type BaseProps = { | ||
className?: string; | ||
style?: React.CSSProperties; | ||
}; |
@@ -5,2 +5,2 @@ export { default as Dropin } from './Dropin'; | ||
export { default as DropinContext } from './Context'; | ||
export { DropinProps, PaypalButtonStyles } from './types'; | ||
export { DropinProps, PaypalButtonStyles, FieldProps } from './types'; |
@@ -97,3 +97,3 @@ 'use strict'; | ||
var DropinProvider = function (_a) { | ||
var children = _a.children, authorization = _a.authorization, styles = _a.styles, paypalClientId = _a.paypalClientId, paypalStyles = _a.paypalStyles; | ||
var children = _a.children, authorization = _a.authorization, styles = _a.styles, withPaypal = _a.withPaypal, paypalStyles = _a.paypalStyles; | ||
var _b = React.useState({ | ||
@@ -151,3 +151,3 @@ cvv: {}, | ||
_b.trys.push([0, 6, , 7]); | ||
if (!(client && paypalClientId)) return [3 /*break*/, 5]; | ||
if (!(client && withPaypal)) return [3 /*break*/, 5]; | ||
_a = paypalInstance; | ||
@@ -160,3 +160,2 @@ return [4 /*yield*/, braintreeWeb.paypalCheckout.create({ | ||
return [4 /*yield*/, paypalInstance.current.loadPayPalSDK({ | ||
'client-id': paypalClientId, | ||
vault: true, | ||
@@ -209,3 +208,3 @@ // @ts-ignore | ||
}); | ||
}, [client, paypalClientId, paypalStyles]); | ||
}, [client, withPaypal, paypalStyles]); | ||
React.useEffect(function () { | ||
@@ -212,0 +211,0 @@ if (!client) { |
@@ -8,3 +8,3 @@ /// <reference types="react" /> | ||
styles?: object; | ||
paypalClientId?: string; | ||
withPaypal?: boolean; | ||
paypalStyles?: PaypalButtonStyles; | ||
@@ -42,2 +42,7 @@ }; | ||
}; | ||
declare type BaseFieldProps = { | ||
className?: string; | ||
style?: React.CSSProperties; | ||
}; | ||
export declare type FieldProps = BaseFieldProps & FieldOptions & FieldEvents; | ||
export declare type PaypalButtonStyles = { | ||
@@ -53,1 +58,2 @@ shape?: 'pill' | 'rect'; | ||
}; | ||
export {}; |
import React from 'react'; | ||
import { FieldOptions, FieldEvents } from './types'; | ||
declare const Field: React.FC<BaseProps & FieldOptions & FieldEvents>; | ||
import { FieldProps } from './types'; | ||
declare const Field: React.FC<FieldProps>; | ||
export default Field; | ||
declare type BaseProps = { | ||
className?: string; | ||
style?: React.CSSProperties; | ||
}; |
@@ -5,2 +5,2 @@ export { default as Dropin } from './Dropin'; | ||
export { default as DropinContext } from './Context'; | ||
export { DropinProps, PaypalButtonStyles } from './types'; | ||
export { DropinProps, PaypalButtonStyles, FieldProps } from './types'; |
@@ -89,3 +89,3 @@ import React, { useState, useRef, useCallback, useEffect, useContext } from 'react'; | ||
var DropinProvider = function (_a) { | ||
var children = _a.children, authorization = _a.authorization, styles = _a.styles, paypalClientId = _a.paypalClientId, paypalStyles = _a.paypalStyles; | ||
var children = _a.children, authorization = _a.authorization, styles = _a.styles, withPaypal = _a.withPaypal, paypalStyles = _a.paypalStyles; | ||
var _b = useState({ | ||
@@ -143,3 +143,3 @@ cvv: {}, | ||
_b.trys.push([0, 6, , 7]); | ||
if (!(client$1 && paypalClientId)) return [3 /*break*/, 5]; | ||
if (!(client$1 && withPaypal)) return [3 /*break*/, 5]; | ||
_a = paypalInstance; | ||
@@ -152,3 +152,2 @@ return [4 /*yield*/, paypalCheckout.create({ | ||
return [4 /*yield*/, paypalInstance.current.loadPayPalSDK({ | ||
'client-id': paypalClientId, | ||
vault: true, | ||
@@ -201,3 +200,3 @@ // @ts-ignore | ||
}); | ||
}, [client$1, paypalClientId, paypalStyles]); | ||
}, [client$1, withPaypal, paypalStyles]); | ||
useEffect(function () { | ||
@@ -204,0 +203,0 @@ if (!client$1) { |
@@ -8,3 +8,3 @@ /// <reference types="react" /> | ||
styles?: object; | ||
paypalClientId?: string; | ||
withPaypal?: boolean; | ||
paypalStyles?: PaypalButtonStyles; | ||
@@ -42,2 +42,7 @@ }; | ||
}; | ||
declare type BaseFieldProps = { | ||
className?: string; | ||
style?: React.CSSProperties; | ||
}; | ||
export declare type FieldProps = BaseFieldProps & FieldOptions & FieldEvents; | ||
export declare type PaypalButtonStyles = { | ||
@@ -53,1 +58,2 @@ shape?: 'pill' | 'rect'; | ||
}; | ||
export {}; |
{ | ||
"name": "braintreeact", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"main": "./lib/cjs/index.js", | ||
@@ -13,5 +13,6 @@ "module": "./lib/esm/index.js", | ||
"@types/braintree-web": "3.75.0", | ||
"@types/react": "17.0.3", | ||
"@types/react": "17.0.4", | ||
"@types/react-dom": "17.0.3", | ||
"braintree-web": "3.76.2", | ||
"npm-run-all": "4.1.5", | ||
"react": "17.0.2", | ||
@@ -33,4 +34,7 @@ "react-dom": "17.0.2", | ||
"watch": "rollup -cw", | ||
"prepare": "npm run build" | ||
"prepare": "npm run build", | ||
"start:example": "yarn --cwd example run start", | ||
"start:lib": "yarn watch", | ||
"start": "run-p start:**" | ||
} | ||
} |
41871
841
13