New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tryfinch/react-connect

Package Overview
Dependencies
Maintainers
6
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tryfinch/react-connect - npm Package Compare versions

Comparing version

to
3.3.0

9

dist/index.d.ts

@@ -18,6 +18,11 @@ export type SuccessEvent = {

products: string[];
sandbox: boolean;
sandbox: 'provider' /** This is to enable the new Provider Sandbox */
/**
* The old sandbox flag retained for backwards compatibility.
* It's defaults to the Provider Sandbox
*/
| boolean;
zIndex: number;
};
type OpenFn = (overrides?: Partial<Pick<ConnectOptions, 'products' | 'state'>>) => void;
type OpenFn = (overrides?: Partial<Pick<ConnectOptions, 'products' | 'state' | 'payrollProvider'>>) => void;
export declare const useFinchConnect: (options: Partial<ConnectOptions>) => {

@@ -24,0 +29,0 @@ open: OpenFn;

@@ -26,3 +26,3 @@ import { useEffect } from 'react';

// replace with actual SDK version by rollup
authUrl.searchParams.append('sdk_version', 'react-3.1.1');
authUrl.searchParams.append('sdk_version', 'react-3.3.0');
return authUrl.href;

@@ -45,5 +45,12 @@ };

};
let isUseFinchConnectInitialized = false;
const useFinchConnect = (options) => {
if (!options.clientId)
throw new Error('must specify clientId in options for useFinchConnect');
if (isUseFinchConnectInitialized) {
console.error('One useFinchConnect hook has already been registered. Please ensure to only call useFinchConnect once to avoid your event callbacks getting called more than once. You can pass in override options to the open function if you so require.');
}
else {
isUseFinchConnectInitialized = true;
}
const combinedOptions = Object.assign(Object.assign({ clientId: '' }, DEFAULT_OPTIONS), options);

@@ -107,3 +114,6 @@ const open = (overrides) => {

window.addEventListener('message', handleFinchAuth);
return () => window.removeEventListener('message', handleFinchAuth);
return () => {
window.removeEventListener('message', handleFinchAuth);
isUseFinchConnectInitialized = false;
};
}, [combinedOptions.onClose, combinedOptions.onError, combinedOptions.onSuccess]);

@@ -110,0 +120,0 @@ return {

@@ -30,3 +30,3 @@ 'use strict';

// replace with actual SDK version by rollup
authUrl.searchParams.append('sdk_version', 'react-3.1.1');
authUrl.searchParams.append('sdk_version', 'react-3.3.0');
return authUrl.href;

@@ -49,5 +49,12 @@ };

};
let isUseFinchConnectInitialized = false;
const useFinchConnect = (options) => {
if (!options.clientId)
throw new Error('must specify clientId in options for useFinchConnect');
if (isUseFinchConnectInitialized) {
console.error('One useFinchConnect hook has already been registered. Please ensure to only call useFinchConnect once to avoid your event callbacks getting called more than once. You can pass in override options to the open function if you so require.');
}
else {
isUseFinchConnectInitialized = true;
}
const combinedOptions = Object.assign(Object.assign({ clientId: '' }, DEFAULT_OPTIONS), options);

@@ -111,3 +118,6 @@ const open = (overrides) => {

window.addEventListener('message', handleFinchAuth);
return () => window.removeEventListener('message', handleFinchAuth);
return () => {
window.removeEventListener('message', handleFinchAuth);
isUseFinchConnectInitialized = false;
};
}, [combinedOptions.onClose, combinedOptions.onError, combinedOptions.onSuccess]);

@@ -114,0 +124,0 @@ return {

{
"name": "@tryfinch/react-connect",
"version": "3.1.1",
"version": "3.3.0",
"description": "Finch SDK for embedding Finch Connect in API React Single Page Applications (SPA)",

@@ -5,0 +5,0 @@ "keywords": [

@@ -22,7 +22,15 @@ import { useEffect } from 'react';

products: string[];
sandbox: boolean;
sandbox:
| 'provider' /** This is to enable the new Provider Sandbox */
/**
* The old sandbox flag retained for backwards compatibility.
* It's defaults to the Provider Sandbox
*/
| boolean;
zIndex: number;
};
type OpenFn = (overrides?: Partial<Pick<ConnectOptions, 'products' | 'state'>>) => void;
type OpenFn = (
overrides?: Partial<Pick<ConnectOptions, 'products' | 'state' | 'payrollProvider'>>
) => void;

@@ -99,5 +107,15 @@ const POST_MESSAGE_NAME = 'finch-auth-message' as const;

let isUseFinchConnectInitialized = false;
export const useFinchConnect = (options: Partial<ConnectOptions>): { open: OpenFn } => {
if (!options.clientId) throw new Error('must specify clientId in options for useFinchConnect');
if (isUseFinchConnectInitialized) {
console.error(
'One useFinchConnect hook has already been registered. Please ensure to only call useFinchConnect once to avoid your event callbacks getting called more than once. You can pass in override options to the open function if you so require.'
);
} else {
isUseFinchConnectInitialized = true;
}
const combinedOptions: ConnectOptions = {

@@ -109,3 +127,3 @@ clientId: '',

const open: OpenFn = (overrides?: Partial<Pick<ConnectOptions, 'products'>>) => {
const open: OpenFn = (overrides) => {
const openOptions: ConnectOptions = {

@@ -174,3 +192,6 @@ ...combinedOptions,

window.addEventListener('message', handleFinchAuth);
return () => window.removeEventListener('message', handleFinchAuth);
return () => {
window.removeEventListener('message', handleFinchAuth);
isUseFinchConnectInitialized = false;
};
}, [combinedOptions.onClose, combinedOptions.onError, combinedOptions.onSuccess]);

@@ -177,0 +198,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet