@tryfinch/react-connect
Advanced tools
Comparing version 3.5.0 to 3.6.0
@@ -21,2 +21,3 @@ export type SuccessEvent = { | ||
zIndex: number; | ||
finchDevMode?: boolean; | ||
}; | ||
@@ -23,0 +24,0 @@ type OpenFn = (overrides?: Partial<Pick<ConnectOptions, 'products' | 'state' | 'payrollProvider'>>) => void; |
@@ -5,6 +5,9 @@ import { useRef, useEffect } from 'react'; | ||
const DEFAULT_FINCH_REDIRECT_URI = 'https://tryfinch.com'; | ||
const DEV_FINCH_CONNECT_URI = 'http://localhost:3000'; | ||
const DEV_DEFAULT_FINCH_REDIRECT_URI = 'http://localhost:4001'; | ||
const FINCH_CONNECT_IFRAME_ID = 'finch-connect-iframe'; | ||
const FINCH_AUTH_MESSAGE_NAME = 'finch-auth-message'; | ||
const constructAuthUrl = ({ clientId, payrollProvider, category, products, manual, sandbox, state, }) => { | ||
const authUrl = new URL(`${BASE_FINCH_CONNECT_URI}/authorize`); | ||
const constructAuthUrl = ({ clientId, payrollProvider, category, products, manual, sandbox, state, finchDevMode, }) => { | ||
const canUseFinchDevMode = finchDevMode && window.location.hostname === 'localhost'; | ||
const authUrl = new URL(`${canUseFinchDevMode ? DEV_FINCH_CONNECT_URI : BASE_FINCH_CONNECT_URI}/authorize`); | ||
if (clientId) | ||
@@ -18,3 +21,3 @@ authUrl.searchParams.append('client_id', clientId); | ||
authUrl.searchParams.append('app_type', 'spa'); | ||
authUrl.searchParams.append('redirect_uri', DEFAULT_FINCH_REDIRECT_URI); | ||
authUrl.searchParams.append('redirect_uri', canUseFinchDevMode ? DEV_DEFAULT_FINCH_REDIRECT_URI : DEFAULT_FINCH_REDIRECT_URI); | ||
/** The host URL of the SDK. This is used to store the referrer for postMessage purposes */ | ||
@@ -30,3 +33,3 @@ authUrl.searchParams.append('sdk_host_url', window.location.origin); | ||
// replace with actual SDK version by rollup | ||
authUrl.searchParams.append('sdk_version', 'react-3.5.0'); | ||
authUrl.searchParams.append('sdk_version', 'react-3.6.0'); | ||
return authUrl.href; | ||
@@ -48,2 +51,3 @@ }; | ||
zIndex: 999, | ||
finchDevMode: false, | ||
}; | ||
@@ -50,0 +54,0 @@ let isUseFinchConnectInitialized = false; |
@@ -9,6 +9,9 @@ 'use strict'; | ||
const DEFAULT_FINCH_REDIRECT_URI = 'https://tryfinch.com'; | ||
const DEV_FINCH_CONNECT_URI = 'http://localhost:3000'; | ||
const DEV_DEFAULT_FINCH_REDIRECT_URI = 'http://localhost:4001'; | ||
const FINCH_CONNECT_IFRAME_ID = 'finch-connect-iframe'; | ||
const FINCH_AUTH_MESSAGE_NAME = 'finch-auth-message'; | ||
const constructAuthUrl = ({ clientId, payrollProvider, category, products, manual, sandbox, state, }) => { | ||
const authUrl = new URL(`${BASE_FINCH_CONNECT_URI}/authorize`); | ||
const constructAuthUrl = ({ clientId, payrollProvider, category, products, manual, sandbox, state, finchDevMode, }) => { | ||
const canUseFinchDevMode = finchDevMode && window.location.hostname === 'localhost'; | ||
const authUrl = new URL(`${canUseFinchDevMode ? DEV_FINCH_CONNECT_URI : BASE_FINCH_CONNECT_URI}/authorize`); | ||
if (clientId) | ||
@@ -22,3 +25,3 @@ authUrl.searchParams.append('client_id', clientId); | ||
authUrl.searchParams.append('app_type', 'spa'); | ||
authUrl.searchParams.append('redirect_uri', DEFAULT_FINCH_REDIRECT_URI); | ||
authUrl.searchParams.append('redirect_uri', canUseFinchDevMode ? DEV_DEFAULT_FINCH_REDIRECT_URI : DEFAULT_FINCH_REDIRECT_URI); | ||
/** The host URL of the SDK. This is used to store the referrer for postMessage purposes */ | ||
@@ -34,3 +37,3 @@ authUrl.searchParams.append('sdk_host_url', window.location.origin); | ||
// replace with actual SDK version by rollup | ||
authUrl.searchParams.append('sdk_version', 'react-3.5.0'); | ||
authUrl.searchParams.append('sdk_version', 'react-3.6.0'); | ||
return authUrl.href; | ||
@@ -52,2 +55,3 @@ }; | ||
zIndex: 999, | ||
finchDevMode: false, | ||
}; | ||
@@ -54,0 +58,0 @@ let isUseFinchConnectInitialized = false; |
{ | ||
"name": "@tryfinch/react-connect", | ||
"version": "3.5.0", | ||
"version": "3.6.0", | ||
"description": "Finch SDK for embedding Finch Connect in API React Single Page Applications (SPA)", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -29,2 +29,3 @@ import { useEffect, useRef } from 'react'; | ||
zIndex: number; | ||
finchDevMode?: boolean; | ||
}; | ||
@@ -60,2 +61,6 @@ | ||
const DEFAULT_FINCH_REDIRECT_URI = 'https://tryfinch.com'; | ||
const DEV_FINCH_CONNECT_URI = 'http://localhost:3000'; | ||
const DEV_DEFAULT_FINCH_REDIRECT_URI = 'http://localhost:4001'; | ||
const FINCH_CONNECT_IFRAME_ID = 'finch-connect-iframe'; | ||
@@ -72,4 +77,9 @@ const FINCH_AUTH_MESSAGE_NAME = 'finch-auth-message'; | ||
state, | ||
finchDevMode, | ||
}: Partial<ConnectOptions>) => { | ||
const authUrl = new URL(`${BASE_FINCH_CONNECT_URI}/authorize`); | ||
const canUseFinchDevMode = finchDevMode && window.location.hostname === 'localhost'; | ||
const authUrl = new URL( | ||
`${canUseFinchDevMode ? DEV_FINCH_CONNECT_URI : BASE_FINCH_CONNECT_URI}/authorize` | ||
); | ||
if (clientId) authUrl.searchParams.append('client_id', clientId); | ||
@@ -80,3 +90,6 @@ if (payrollProvider) authUrl.searchParams.append('payroll_provider', payrollProvider); | ||
authUrl.searchParams.append('app_type', 'spa'); | ||
authUrl.searchParams.append('redirect_uri', DEFAULT_FINCH_REDIRECT_URI); | ||
authUrl.searchParams.append( | ||
'redirect_uri', | ||
canUseFinchDevMode ? DEV_DEFAULT_FINCH_REDIRECT_URI : DEFAULT_FINCH_REDIRECT_URI | ||
); | ||
/** The host URL of the SDK. This is used to store the referrer for postMessage purposes */ | ||
@@ -109,2 +122,3 @@ authUrl.searchParams.append('sdk_host_url', window.location.origin); | ||
zIndex: 999, | ||
finchDevMode: false, | ||
}; | ||
@@ -111,0 +125,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
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
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
936958
32185