@tryfinch/react-connect
Advanced tools
Comparing version 3.3.0 to 3.3.1
@@ -1,2 +0,2 @@ | ||
import { useEffect } from 'react'; | ||
import { useRef, useEffect } from 'react'; | ||
@@ -26,3 +26,3 @@ const BASE_FINCH_CONNECT_URI = 'https://connect.tryfinch.com'; | ||
// replace with actual SDK version by rollup | ||
authUrl.searchParams.append('sdk_version', 'react-3.3.0'); | ||
authUrl.searchParams.append('sdk_version', 'react-3.3.1'); | ||
return authUrl.href; | ||
@@ -49,8 +49,14 @@ }; | ||
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 isHookMounted = useRef(false); | ||
useEffect(() => { | ||
if (!isHookMounted.current) { | ||
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; | ||
} | ||
isHookMounted.current = true; | ||
} | ||
}, []); | ||
const combinedOptions = Object.assign(Object.assign({ clientId: '' }, DEFAULT_OPTIONS), options); | ||
@@ -57,0 +63,0 @@ const open = (overrides) => { |
@@ -30,3 +30,3 @@ 'use strict'; | ||
// replace with actual SDK version by rollup | ||
authUrl.searchParams.append('sdk_version', 'react-3.3.0'); | ||
authUrl.searchParams.append('sdk_version', 'react-3.3.1'); | ||
return authUrl.href; | ||
@@ -53,8 +53,14 @@ }; | ||
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 isHookMounted = react.useRef(false); | ||
react.useEffect(() => { | ||
if (!isHookMounted.current) { | ||
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; | ||
} | ||
isHookMounted.current = true; | ||
} | ||
}, []); | ||
const combinedOptions = Object.assign(Object.assign({ clientId: '' }, DEFAULT_OPTIONS), options); | ||
@@ -61,0 +67,0 @@ const open = (overrides) => { |
{ | ||
"name": "@tryfinch/react-connect", | ||
"version": "3.3.0", | ||
"version": "3.3.1", | ||
"description": "Finch SDK for embedding Finch Connect in API React Single Page Applications (SPA)", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -1,2 +0,2 @@ | ||
import { useEffect } from 'react'; | ||
import { useEffect, useRef } from 'react'; | ||
@@ -110,11 +110,18 @@ export type SuccessEvent = { | ||
if (!options.clientId) throw new Error('must specify clientId in options for useFinchConnect'); | ||
const isHookMounted = useRef(false); | ||
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; | ||
} | ||
useEffect(() => { | ||
if (!isHookMounted.current) { | ||
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; | ||
} | ||
isHookMounted.current = true; | ||
} | ||
}, []); | ||
const combinedOptions: ConnectOptions = { | ||
@@ -121,0 +128,0 @@ clientId: '', |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
928589
32108