diff --git a/package.json b/package.json index 6bc658f..4c5eeb5 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,9 @@ "version": "1.9.0", "description": "A small, simple and customizable cookie consent bar for use in React applications.", "main": "build/index.js", + "types": "build/index.d.ts", "dependencies": { + "copy-webpack-plugin": "^4.6.0", "js-cookie": "^2.2.0", "react": "^16.4.0" }, diff --git a/src/index.d.ts b/src/index.d.ts new file mode 100644 index 0000000..5dbb46d --- /dev/null +++ b/src/index.d.ts @@ -0,0 +1,29 @@ +import * as React from 'react'; +import Cookies from "js-cookie"; + +export interface CookieConsentProps { + location?: "top" | "bottom" | "none", + style?: object, + buttonStyle?: object, + contentStyle?: object, + children?: React.ReactNode, + disableStyles?: boolean, + hideOnAccept?: boolean, + onAccept?: Function, + buttonText?: Function | React.ReactNode, + cookieName?: string, + cookieValue?: string | boolean | number, + debug?: boolean, + expires?: number, + containerClasses?: string, + contentClasses?: string, + buttonClasses?: string, + buttonId?: string, + acceptOnScroll?: boolean, + acceptOnScrollPercentage?: number, + extraCookieOptions?: object +} + +export default class CookieConsent extends React.Component {} + +export { Cookies }; diff --git a/webpack.config.js b/webpack.config.js index 16605cc..f52f071 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,4 +1,6 @@ var path = require('path'); +var CopyWebpackPlugin = require('copy-webpack-plugin'); + module.exports = { entry: './src/index.js', output: { @@ -23,5 +25,8 @@ module.exports = { }, externals: { 'react': 'commonjs react' // this line is just to use the React dependency of our parent-testing-project instead of using our own React. - } -}; \ No newline at end of file + }, + plugins: [ + new CopyWebpackPlugin([{ from: 'src/index.d.ts', to: 'index.d.ts' }]) + ] +};