@tryfinch/react-connect
Advanced tools
Comparing version 2.8.1 to 3.0.0
module.exports = { | ||
extends: ['airbnb', 'plugin:prettier/recommended', 'prettier/react'], | ||
extends: [ | ||
'airbnb', | ||
'plugin:prettier/recommended', | ||
'prettier/react', | ||
'plugin:@typescript-eslint/recommended', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['prettier', '@typescript-eslint'], | ||
env: { | ||
@@ -4,0 +11,0 @@ browser: true, |
@@ -1,25 +0,24 @@ | ||
declare module 'react-finch-connect' { | ||
export type SuccessEvent = { | ||
export type SuccessEvent = { | ||
code: string; | ||
}; | ||
export type ErrorEvent = { | ||
}; | ||
export type ErrorEvent = { | ||
errorMessage: string; | ||
}; | ||
export type ConnectOptions = { | ||
}; | ||
export type ConnectOptions = { | ||
category: string | null; | ||
clientId: string; | ||
products?: string[]; | ||
mode?: string; | ||
manual?: boolean; | ||
payrollProvider?: string; | ||
sandbox?: boolean; | ||
category?: string; | ||
onSuccess?: (e: SuccessEvent) => void; | ||
onError?: (e: ErrorEvent) => void; | ||
onClose?: () => void; | ||
zIndex?: bigint | string; | ||
}; | ||
export function useFinchConnect(opts: ConnectOptions): { open: () => void }; | ||
} | ||
manual: boolean; | ||
onSuccess: (e: SuccessEvent) => void; | ||
onError: (e: ErrorEvent) => void; | ||
onClose: () => void; | ||
payrollProvider: string | null; | ||
products: string[]; | ||
sandbox: boolean; | ||
zIndex: number; | ||
}; | ||
type OpenFn = (overrides?: Partial<Pick<ConnectOptions, 'products'>>) => void; | ||
export declare const useFinchConnect: (options: Partial<ConnectOptions>) => { | ||
open: OpenFn; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=index.d.ts.map |
import { useEffect } from 'react'; | ||
var BASE_FINCH_CONNECT_URI = 'https://connect.tryfinch.com'; | ||
var DEFAULT_FINCH_REDIRECT_URI = 'https://tryfinch.com'; | ||
var FINCH_CONNECT_IFRAME_ID = 'finch-connect-iframe'; | ||
var FINCH_AUTH_MESSAGE_NAME = 'finch-auth-message'; | ||
var noop = function noop() {}; // eslint-disable-next-line import/prefer-default-export | ||
var useFinchConnect = function useFinchConnect() { | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var clientId = options.clientId, | ||
_options$products = options.products, | ||
products = _options$products === void 0 ? [] : _options$products, | ||
_options$mode = options.mode, | ||
mode = _options$mode === void 0 ? 'employer' : _options$mode, | ||
category = options.category, | ||
_options$manual = options.manual, | ||
manual = _options$manual === void 0 ? false : _options$manual, | ||
_options$payrollProvi = options.payrollProvider, | ||
payrollProvider = _options$payrollProvi === void 0 ? null : _options$payrollProvi, | ||
_options$sandbox = options.sandbox, | ||
sandbox = _options$sandbox === void 0 ? false : _options$sandbox, | ||
_options$onSuccess = options.onSuccess, | ||
onSuccess = _options$onSuccess === void 0 ? noop : _options$onSuccess, | ||
_options$onError = options.onError, | ||
onError = _options$onError === void 0 ? noop : _options$onError, | ||
_options$onClose = options.onClose, | ||
onClose = _options$onClose === void 0 ? noop : _options$onClose, | ||
_options$zIndex = options.zIndex, | ||
zIndex = _options$zIndex === void 0 ? 999 : _options$zIndex; | ||
var _constructAuthUrl = function _constructAuthUrl(clientId, products) { | ||
var authUrl = new URL("".concat(BASE_FINCH_CONNECT_URI, "/authorize")); | ||
if (clientId) authUrl.searchParams.append('client_id', clientId); | ||
if (payrollProvider) authUrl.searchParams.append('payroll_provider', payrollProvider); | ||
if (category) authUrl.searchParams.append('category', category); | ||
authUrl.searchParams.append('products', products.join(' ')); | ||
const BASE_FINCH_CONNECT_URI = 'https://connect.tryfinch.com'; | ||
const DEFAULT_FINCH_REDIRECT_URI = 'https://tryfinch.com'; | ||
const FINCH_CONNECT_IFRAME_ID = 'finch-connect-iframe'; | ||
const FINCH_AUTH_MESSAGE_NAME = 'finch-auth-message'; | ||
const constructAuthUrl = ({ clientId, payrollProvider, category, products, manual, sandbox, }) => { | ||
const authUrl = new URL(`${BASE_FINCH_CONNECT_URI}/authorize`); | ||
if (clientId) | ||
authUrl.searchParams.append('client_id', clientId); | ||
if (payrollProvider) | ||
authUrl.searchParams.append('payroll_provider', payrollProvider); | ||
if (category) | ||
authUrl.searchParams.append('category', category); | ||
authUrl.searchParams.append('products', (products !== null && products !== void 0 ? products : []).join(' ')); | ||
authUrl.searchParams.append('app_type', 'spa'); | ||
authUrl.searchParams.append('redirect_uri', DEFAULT_FINCH_REDIRECT_URI); | ||
authUrl.searchParams.append('mode', mode); | ||
if (manual) authUrl.searchParams.append('manual', manual); | ||
if (sandbox) authUrl.searchParams.append('sandbox', sandbox); | ||
/* global "2.8.1" */ | ||
authUrl.searchParams.append('sdk_version', "react-".concat("2.8.1")); | ||
authUrl.searchParams.append('mode', 'employer'); | ||
if (manual) | ||
authUrl.searchParams.append('manual', String(manual)); | ||
if (sandbox) | ||
authUrl.searchParams.append('sandbox', String(sandbox)); | ||
// replace with actual SDK version by rollup | ||
authUrl.searchParams.append('sdk_version', 'react-3.0.0'); | ||
return authUrl.href; | ||
}; | ||
var open = function open() { | ||
if (document.getElementById(FINCH_CONNECT_IFRAME_ID)) { | ||
return null; | ||
} | ||
var iframe = document.createElement('iframe'); | ||
iframe.src = _constructAuthUrl(clientId, products); | ||
iframe.frameBorder = '0'; | ||
iframe.id = FINCH_CONNECT_IFRAME_ID; | ||
iframe.style.position = 'fixed'; | ||
iframe.style.zIndex = zIndex.toString(); | ||
iframe.style.height = '100%'; | ||
iframe.style.width = '100%'; | ||
iframe.style.top = '0'; | ||
iframe.style.backgroundColor = 'none transparent'; | ||
iframe.style.border = 'none'; | ||
document.body.prepend(iframe); | ||
document.body.style.overflow = 'hidden'; | ||
}; | ||
var close = function close() { | ||
var frameToRemove = document.getElementById(FINCH_CONNECT_IFRAME_ID); | ||
if (frameToRemove) { | ||
frameToRemove.parentNode.removeChild(frameToRemove); | ||
document.body.style.overflow = 'inherit'; | ||
} | ||
}; | ||
useEffect(function () { | ||
function handleFinchAuth(event) { | ||
var handleFinchAuthSuccess = function handleFinchAuthSuccess(code) { | ||
return onSuccess({ | ||
code: code | ||
}); | ||
}; | ||
var handleFinchAuthError = function handleFinchAuthError(error) { | ||
return onError({ | ||
errorMessage: error | ||
}); | ||
}; | ||
var handleFinchAuthClose = function handleFinchAuthClose() { | ||
return onClose(); | ||
}; | ||
if (!event.data) return; | ||
if (event.data.name !== FINCH_AUTH_MESSAGE_NAME) return; | ||
if (!event.origin.startsWith(BASE_FINCH_CONNECT_URI)) return; | ||
var _event$data = event.data, | ||
code = _event$data.code, | ||
error = _event$data.error, | ||
closed = _event$data.closed; | ||
close(); | ||
if (code) handleFinchAuthSuccess(code);else if (error) handleFinchAuthError(error);else if (closed) handleFinchAuthClose(); | ||
} | ||
window.addEventListener('message', handleFinchAuth); | ||
return function () { | ||
return window.removeEventListener('message', handleFinchAuth); | ||
}; | ||
const noop = () => { | ||
// intentionally empty | ||
}; | ||
const DEFAULT_OPTIONS = { | ||
category: null, | ||
manual: false, | ||
onSuccess: noop, | ||
onError: noop, | ||
onClose: noop, | ||
payrollProvider: null, | ||
products: [], | ||
sandbox: false, | ||
zIndex: 999, | ||
}; | ||
const useFinchConnect = (options) => { | ||
if (!options.clientId) | ||
throw new Error('must specify clientId in options for useFinchConnect'); | ||
const combinedOptions = Object.assign(Object.assign({ clientId: '' }, DEFAULT_OPTIONS), options); | ||
const open = (overrides) => { | ||
const openOptions = Object.assign(Object.assign({}, combinedOptions), overrides); | ||
if (!document.getElementById(FINCH_CONNECT_IFRAME_ID)) { | ||
const iframe = document.createElement('iframe'); | ||
iframe.src = constructAuthUrl(openOptions); | ||
iframe.frameBorder = '0'; | ||
iframe.id = FINCH_CONNECT_IFRAME_ID; | ||
iframe.style.position = 'fixed'; | ||
iframe.style.zIndex = openOptions.zIndex.toString(); | ||
iframe.style.height = '100%'; | ||
iframe.style.width = '100%'; | ||
iframe.style.top = '0'; | ||
iframe.style.backgroundColor = 'none transparent'; | ||
iframe.style.border = 'none'; | ||
document.body.prepend(iframe); | ||
document.body.style.overflow = 'hidden'; | ||
} | ||
}; | ||
}, [onClose, onError, onSuccess]); | ||
return { | ||
open: open | ||
}; | ||
const close = () => { | ||
var _a; | ||
const frameToRemove = document.getElementById(FINCH_CONNECT_IFRAME_ID); | ||
if (frameToRemove) { | ||
(_a = frameToRemove.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(frameToRemove); | ||
document.body.style.overflow = 'inherit'; | ||
} | ||
}; | ||
useEffect(() => { | ||
function handleFinchAuth(event) { | ||
const handleFinchAuthSuccess = (code) => combinedOptions.onSuccess({ code }); | ||
const handleFinchAuthError = (error) => combinedOptions.onError({ errorMessage: error }); | ||
const handleFinchAuthClose = () => combinedOptions.onClose(); | ||
if (!event.data) | ||
return; | ||
if (event.data.name !== FINCH_AUTH_MESSAGE_NAME) | ||
return; | ||
if (!event.origin.startsWith(BASE_FINCH_CONNECT_URI)) | ||
return; | ||
const { code, error, closed } = event.data; | ||
close(); | ||
if (code) | ||
handleFinchAuthSuccess(code); | ||
else if (error) | ||
handleFinchAuthError(error); | ||
else if (closed) | ||
handleFinchAuthClose(); | ||
} | ||
window.addEventListener('message', handleFinchAuth); | ||
return () => window.removeEventListener('message', handleFinchAuth); | ||
}, [combinedOptions.onClose, combinedOptions.onError, combinedOptions.onSuccess]); | ||
return { | ||
open, | ||
}; | ||
}; | ||
@@ -118,0 +98,0 @@ |
@@ -7,116 +7,96 @@ 'use strict'; | ||
var BASE_FINCH_CONNECT_URI = 'https://connect.tryfinch.com'; | ||
var DEFAULT_FINCH_REDIRECT_URI = 'https://tryfinch.com'; | ||
var FINCH_CONNECT_IFRAME_ID = 'finch-connect-iframe'; | ||
var FINCH_AUTH_MESSAGE_NAME = 'finch-auth-message'; | ||
var noop = function noop() {}; // eslint-disable-next-line import/prefer-default-export | ||
var useFinchConnect = function useFinchConnect() { | ||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var clientId = options.clientId, | ||
_options$products = options.products, | ||
products = _options$products === void 0 ? [] : _options$products, | ||
_options$mode = options.mode, | ||
mode = _options$mode === void 0 ? 'employer' : _options$mode, | ||
category = options.category, | ||
_options$manual = options.manual, | ||
manual = _options$manual === void 0 ? false : _options$manual, | ||
_options$payrollProvi = options.payrollProvider, | ||
payrollProvider = _options$payrollProvi === void 0 ? null : _options$payrollProvi, | ||
_options$sandbox = options.sandbox, | ||
sandbox = _options$sandbox === void 0 ? false : _options$sandbox, | ||
_options$onSuccess = options.onSuccess, | ||
onSuccess = _options$onSuccess === void 0 ? noop : _options$onSuccess, | ||
_options$onError = options.onError, | ||
onError = _options$onError === void 0 ? noop : _options$onError, | ||
_options$onClose = options.onClose, | ||
onClose = _options$onClose === void 0 ? noop : _options$onClose, | ||
_options$zIndex = options.zIndex, | ||
zIndex = _options$zIndex === void 0 ? 999 : _options$zIndex; | ||
var _constructAuthUrl = function _constructAuthUrl(clientId, products) { | ||
var authUrl = new URL("".concat(BASE_FINCH_CONNECT_URI, "/authorize")); | ||
if (clientId) authUrl.searchParams.append('client_id', clientId); | ||
if (payrollProvider) authUrl.searchParams.append('payroll_provider', payrollProvider); | ||
if (category) authUrl.searchParams.append('category', category); | ||
authUrl.searchParams.append('products', products.join(' ')); | ||
const BASE_FINCH_CONNECT_URI = 'https://connect.tryfinch.com'; | ||
const DEFAULT_FINCH_REDIRECT_URI = 'https://tryfinch.com'; | ||
const FINCH_CONNECT_IFRAME_ID = 'finch-connect-iframe'; | ||
const FINCH_AUTH_MESSAGE_NAME = 'finch-auth-message'; | ||
const constructAuthUrl = ({ clientId, payrollProvider, category, products, manual, sandbox, }) => { | ||
const authUrl = new URL(`${BASE_FINCH_CONNECT_URI}/authorize`); | ||
if (clientId) | ||
authUrl.searchParams.append('client_id', clientId); | ||
if (payrollProvider) | ||
authUrl.searchParams.append('payroll_provider', payrollProvider); | ||
if (category) | ||
authUrl.searchParams.append('category', category); | ||
authUrl.searchParams.append('products', (products !== null && products !== void 0 ? products : []).join(' ')); | ||
authUrl.searchParams.append('app_type', 'spa'); | ||
authUrl.searchParams.append('redirect_uri', DEFAULT_FINCH_REDIRECT_URI); | ||
authUrl.searchParams.append('mode', mode); | ||
if (manual) authUrl.searchParams.append('manual', manual); | ||
if (sandbox) authUrl.searchParams.append('sandbox', sandbox); | ||
/* global "2.8.1" */ | ||
authUrl.searchParams.append('sdk_version', "react-".concat("2.8.1")); | ||
authUrl.searchParams.append('mode', 'employer'); | ||
if (manual) | ||
authUrl.searchParams.append('manual', String(manual)); | ||
if (sandbox) | ||
authUrl.searchParams.append('sandbox', String(sandbox)); | ||
// replace with actual SDK version by rollup | ||
authUrl.searchParams.append('sdk_version', 'react-3.0.0'); | ||
return authUrl.href; | ||
}; | ||
var open = function open() { | ||
if (document.getElementById(FINCH_CONNECT_IFRAME_ID)) { | ||
return null; | ||
} | ||
var iframe = document.createElement('iframe'); | ||
iframe.src = _constructAuthUrl(clientId, products); | ||
iframe.frameBorder = '0'; | ||
iframe.id = FINCH_CONNECT_IFRAME_ID; | ||
iframe.style.position = 'fixed'; | ||
iframe.style.zIndex = zIndex.toString(); | ||
iframe.style.height = '100%'; | ||
iframe.style.width = '100%'; | ||
iframe.style.top = '0'; | ||
iframe.style.backgroundColor = 'none transparent'; | ||
iframe.style.border = 'none'; | ||
document.body.prepend(iframe); | ||
document.body.style.overflow = 'hidden'; | ||
}; | ||
var close = function close() { | ||
var frameToRemove = document.getElementById(FINCH_CONNECT_IFRAME_ID); | ||
if (frameToRemove) { | ||
frameToRemove.parentNode.removeChild(frameToRemove); | ||
document.body.style.overflow = 'inherit'; | ||
} | ||
}; | ||
react.useEffect(function () { | ||
function handleFinchAuth(event) { | ||
var handleFinchAuthSuccess = function handleFinchAuthSuccess(code) { | ||
return onSuccess({ | ||
code: code | ||
}); | ||
}; | ||
var handleFinchAuthError = function handleFinchAuthError(error) { | ||
return onError({ | ||
errorMessage: error | ||
}); | ||
}; | ||
var handleFinchAuthClose = function handleFinchAuthClose() { | ||
return onClose(); | ||
}; | ||
if (!event.data) return; | ||
if (event.data.name !== FINCH_AUTH_MESSAGE_NAME) return; | ||
if (!event.origin.startsWith(BASE_FINCH_CONNECT_URI)) return; | ||
var _event$data = event.data, | ||
code = _event$data.code, | ||
error = _event$data.error, | ||
closed = _event$data.closed; | ||
close(); | ||
if (code) handleFinchAuthSuccess(code);else if (error) handleFinchAuthError(error);else if (closed) handleFinchAuthClose(); | ||
} | ||
window.addEventListener('message', handleFinchAuth); | ||
return function () { | ||
return window.removeEventListener('message', handleFinchAuth); | ||
}; | ||
const noop = () => { | ||
// intentionally empty | ||
}; | ||
const DEFAULT_OPTIONS = { | ||
category: null, | ||
manual: false, | ||
onSuccess: noop, | ||
onError: noop, | ||
onClose: noop, | ||
payrollProvider: null, | ||
products: [], | ||
sandbox: false, | ||
zIndex: 999, | ||
}; | ||
const useFinchConnect = (options) => { | ||
if (!options.clientId) | ||
throw new Error('must specify clientId in options for useFinchConnect'); | ||
const combinedOptions = Object.assign(Object.assign({ clientId: '' }, DEFAULT_OPTIONS), options); | ||
const open = (overrides) => { | ||
const openOptions = Object.assign(Object.assign({}, combinedOptions), overrides); | ||
if (!document.getElementById(FINCH_CONNECT_IFRAME_ID)) { | ||
const iframe = document.createElement('iframe'); | ||
iframe.src = constructAuthUrl(openOptions); | ||
iframe.frameBorder = '0'; | ||
iframe.id = FINCH_CONNECT_IFRAME_ID; | ||
iframe.style.position = 'fixed'; | ||
iframe.style.zIndex = openOptions.zIndex.toString(); | ||
iframe.style.height = '100%'; | ||
iframe.style.width = '100%'; | ||
iframe.style.top = '0'; | ||
iframe.style.backgroundColor = 'none transparent'; | ||
iframe.style.border = 'none'; | ||
document.body.prepend(iframe); | ||
document.body.style.overflow = 'hidden'; | ||
} | ||
}; | ||
}, [onClose, onError, onSuccess]); | ||
return { | ||
open: open | ||
}; | ||
const close = () => { | ||
var _a; | ||
const frameToRemove = document.getElementById(FINCH_CONNECT_IFRAME_ID); | ||
if (frameToRemove) { | ||
(_a = frameToRemove.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(frameToRemove); | ||
document.body.style.overflow = 'inherit'; | ||
} | ||
}; | ||
react.useEffect(() => { | ||
function handleFinchAuth(event) { | ||
const handleFinchAuthSuccess = (code) => combinedOptions.onSuccess({ code }); | ||
const handleFinchAuthError = (error) => combinedOptions.onError({ errorMessage: error }); | ||
const handleFinchAuthClose = () => combinedOptions.onClose(); | ||
if (!event.data) | ||
return; | ||
if (event.data.name !== FINCH_AUTH_MESSAGE_NAME) | ||
return; | ||
if (!event.origin.startsWith(BASE_FINCH_CONNECT_URI)) | ||
return; | ||
const { code, error, closed } = event.data; | ||
close(); | ||
if (code) | ||
handleFinchAuthSuccess(code); | ||
else if (error) | ||
handleFinchAuthError(error); | ||
else if (closed) | ||
handleFinchAuthClose(); | ||
} | ||
window.addEventListener('message', handleFinchAuth); | ||
return () => window.removeEventListener('message', handleFinchAuth); | ||
}, [combinedOptions.onClose, combinedOptions.onError, combinedOptions.onSuccess]); | ||
return { | ||
open, | ||
}; | ||
}; | ||
@@ -123,0 +103,0 @@ |
{ | ||
"name": "@tryfinch/react-connect", | ||
"version": "2.8.1", | ||
"version": "3.0.0", | ||
"description": "Finch SDK for embedding Finch Connect in API React Single Page Applications (SPA)", | ||
"keywords": [ | ||
"finch", | ||
"sdk", | ||
"payroll", | ||
"react", | ||
"oauth" | ||
], | ||
"homepage": "https://tryfinch.com/", | ||
"author": "", | ||
"license": "MIT", | ||
"repository": "Finch-API/react-finch-connect", | ||
"repository": "Finch-API/react-connect", | ||
"main": "dist/index.js", | ||
@@ -17,5 +25,4 @@ "types": "dist/index.d.ts", | ||
"scripts": { | ||
"test": "cross-env CI=1 react-scripts test --env=jsdom", | ||
"test:watch": "react-scripts test --env=jsdom", | ||
"build": "rollup -c", | ||
"lint": "eslint --ext .js,.jsx,.ts,.tsx src", | ||
"start": "rollup -c -w", | ||
@@ -29,52 +36,16 @@ "prepare": "npm run build", | ||
"devDependencies": { | ||
"@babel/core": "^7.0.0", | ||
"@babel/plugin-external-helpers": "^7.0.0", | ||
"@babel/plugin-proposal-class-properties": "^7.0.0", | ||
"@babel/plugin-proposal-decorators": "^7.0.0", | ||
"@babel/plugin-proposal-do-expressions": "^7.0.0", | ||
"@babel/plugin-proposal-export-default-from": "^7.0.0", | ||
"@babel/plugin-proposal-export-namespace-from": "^7.0.0", | ||
"@babel/plugin-proposal-function-bind": "^7.0.0", | ||
"@babel/plugin-proposal-function-sent": "^7.0.0", | ||
"@babel/plugin-proposal-json-strings": "^7.0.0", | ||
"@babel/plugin-proposal-logical-assignment-operators": "^7.0.0", | ||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0", | ||
"@babel/plugin-proposal-numeric-separator": "^7.0.0", | ||
"@babel/plugin-proposal-optional-chaining": "^7.0.0", | ||
"@babel/plugin-proposal-pipeline-operator": "^7.0.0", | ||
"@babel/plugin-proposal-throw-expressions": "^7.0.0", | ||
"@babel/plugin-syntax-dynamic-import": "^7.0.0", | ||
"@babel/plugin-syntax-import-meta": "^7.0.0", | ||
"@babel/preset-env": "^7.0.0", | ||
"@babel/preset-react": "^7.0.0", | ||
"@rollup/plugin-replace": "^4.0.0", | ||
"@testing-library/react-hooks": "^3.2.1", | ||
"babel-eslint": "^10.0.1", | ||
"cross-env": "^5.2.0", | ||
"@rollup/plugin-typescript": "^11.1.0", | ||
"@types/react": "^16.14.40", | ||
"@typescript-eslint/eslint-plugin": "^5.59.0", | ||
"@typescript-eslint/parser": "^5.59.0", | ||
"eslint": "^7.32.0", | ||
"eslint-config-airbnb": "^18.2.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-config-standard": "^11.0.0", | ||
"eslint-config-standard-react": "^6.0.0", | ||
"eslint-plugin-import": "^2.22.0", | ||
"eslint-plugin-jsx-a11y": "^6.3.1", | ||
"eslint-plugin-node": "^7.0.1", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"eslint-plugin-promise": "^4.0.0", | ||
"eslint-plugin-react": "^7.20.3", | ||
"eslint-plugin-react-hooks": "^4.0.8", | ||
"eslint-plugin-standard": "^3.1.0", | ||
"gh-pages": "^2.0.1", | ||
"prettier": "^2.0.5", | ||
"react": "^16.9.0", | ||
"react-scripts": "^5.0.1", | ||
"react-test-renderer": "^16.9.0", | ||
"rollup": "^2.75.7", | ||
"rollup-plugin-babel": "^4.3.2", | ||
"rollup-plugin-commonjs": "^9.2.0", | ||
"rollup-plugin-dts": "^4.0.1", | ||
"rollup-plugin-node-resolve": "^4.0.0", | ||
"rollup-plugin-peer-deps-external": "^2.2.0", | ||
"rollup-plugin-url": "^2.1.0" | ||
"typescript": "^4.9.5" | ||
} | ||
} |
# @tryfinch/react-connect | ||
[![NPM](https://img.shields.io/npm/v/@tryfinch/react-connect)](https://www.npmjs.com/package/@tryfinch/react-connect) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) | ||
[![NPM](https://img.shields.io/npm/v/@tryfinch/react-connect)](https://www.npmjs.com/package/@tryfinch/react-connect) | ||
@@ -5,0 +5,0 @@ ## Install |
@@ -1,49 +0,20 @@ | ||
import babel from 'rollup-plugin-babel'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
import dts from 'rollup-plugin-dts'; | ||
import external from 'rollup-plugin-peer-deps-external'; | ||
import resolve from 'rollup-plugin-node-resolve'; | ||
import url from 'rollup-plugin-url'; | ||
import replace from '@rollup/plugin-replace'; | ||
import typescript from '@rollup/plugin-typescript'; | ||
import pkg from './package.json'; | ||
const plugins = [external(), replace({ SDK_VERSION: pkg.version }), typescript()]; | ||
export default [ | ||
{ | ||
input: 'src/index.js', | ||
output: [ | ||
{ | ||
file: pkg.main, | ||
format: 'cjs', | ||
sourcemap: true, | ||
}, | ||
{ | ||
file: pkg.module, | ||
format: 'es', | ||
sourcemap: true, | ||
}, | ||
], | ||
plugins: [ | ||
external(), | ||
url({ exclude: ['**/*.svg'] }), | ||
babel({ | ||
exclude: 'node_modules/**', | ||
}), | ||
resolve(), | ||
commonjs(), | ||
replace({ | ||
SDK_VERSION: JSON.stringify(pkg.version), // has to be stringified somehow | ||
}), | ||
], | ||
input: 'src/index.ts', | ||
output: [{ file: pkg.main, format: 'cjs', sourcemap: true }], | ||
plugins, | ||
}, | ||
{ | ||
input: 'src/index.d.ts', | ||
output: [ | ||
{ | ||
file: pkg.types, | ||
format: 'es', | ||
}, | ||
], | ||
plugins: [dts()], | ||
input: 'src/index.ts', | ||
output: [{ file: pkg.module, format: 'es', sourcemap: true }], | ||
plugins, | ||
}, | ||
]; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
13
56213
0
1551830