Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tryfinch/react-connect

Package Overview
Dependencies
Maintainers
6
Versions
15
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 3.6.1 to 3.7.0

5

dist/index.d.ts

@@ -21,3 +21,6 @@ export type SuccessEvent = {

zIndex: number;
finchDevMode?: boolean;
apiConfig?: {
connectUrl: string;
redirectUrl: string;
};
};

@@ -24,0 +27,0 @@ type OpenFn = (overrides?: Partial<Pick<ConnectOptions, 'products' | 'state' | 'payrollProvider'>>) => void;

20

dist/index.es.js

@@ -5,9 +5,8 @@ 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, finchDevMode, }) => {
const canUseFinchDevMode = finchDevMode && window.location.hostname === 'localhost';
const authUrl = new URL(`${canUseFinchDevMode ? DEV_FINCH_CONNECT_URI : BASE_FINCH_CONNECT_URI}/authorize`);
const constructAuthUrl = ({ clientId, payrollProvider, category, products, manual, sandbox, state, apiConfig, }) => {
const CONNECT_URL = (apiConfig === null || apiConfig === void 0 ? void 0 : apiConfig.connectUrl) || BASE_FINCH_CONNECT_URI;
const REDIRECT_URL = (apiConfig === null || apiConfig === void 0 ? void 0 : apiConfig.redirectUrl) || DEFAULT_FINCH_REDIRECT_URI;
const authUrl = new URL(`${CONNECT_URL}/authorize`);
if (clientId)

@@ -21,3 +20,3 @@ authUrl.searchParams.append('client_id', clientId);

authUrl.searchParams.append('app_type', 'spa');
authUrl.searchParams.append('redirect_uri', canUseFinchDevMode ? DEV_DEFAULT_FINCH_REDIRECT_URI : DEFAULT_FINCH_REDIRECT_URI);
authUrl.searchParams.append('redirect_uri', REDIRECT_URL);
/** The host URL of the SDK. This is used to store the referrer for postMessage purposes */

@@ -33,3 +32,3 @@ authUrl.searchParams.append('sdk_host_url', window.location.origin);

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

@@ -51,3 +50,2 @@ };

zIndex: 999,
finchDevMode: false,
};

@@ -99,4 +97,4 @@ let isUseFinchConnectInitialized = false;

function handleFinchAuth(event) {
const canUseFinchDevMode = combinedOptions.finchDevMode && window.location.hostname === 'localhost';
const CONNECT_URI = canUseFinchDevMode ? DEV_FINCH_CONNECT_URI : BASE_FINCH_CONNECT_URI;
var _a;
const CONNECT_URL = ((_a = combinedOptions.apiConfig) === null || _a === void 0 ? void 0 : _a.connectUrl) || BASE_FINCH_CONNECT_URI;
if (!event.data)

@@ -106,3 +104,3 @@ return;

return;
if (!event.origin.startsWith(CONNECT_URI))
if (!event.origin.startsWith(CONNECT_URL))
return;

@@ -109,0 +107,0 @@ close();

@@ -9,9 +9,8 @@ '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, finchDevMode, }) => {
const canUseFinchDevMode = finchDevMode && window.location.hostname === 'localhost';
const authUrl = new URL(`${canUseFinchDevMode ? DEV_FINCH_CONNECT_URI : BASE_FINCH_CONNECT_URI}/authorize`);
const constructAuthUrl = ({ clientId, payrollProvider, category, products, manual, sandbox, state, apiConfig, }) => {
const CONNECT_URL = (apiConfig === null || apiConfig === void 0 ? void 0 : apiConfig.connectUrl) || BASE_FINCH_CONNECT_URI;
const REDIRECT_URL = (apiConfig === null || apiConfig === void 0 ? void 0 : apiConfig.redirectUrl) || DEFAULT_FINCH_REDIRECT_URI;
const authUrl = new URL(`${CONNECT_URL}/authorize`);
if (clientId)

@@ -25,3 +24,3 @@ authUrl.searchParams.append('client_id', clientId);

authUrl.searchParams.append('app_type', 'spa');
authUrl.searchParams.append('redirect_uri', canUseFinchDevMode ? DEV_DEFAULT_FINCH_REDIRECT_URI : DEFAULT_FINCH_REDIRECT_URI);
authUrl.searchParams.append('redirect_uri', REDIRECT_URL);
/** The host URL of the SDK. This is used to store the referrer for postMessage purposes */

@@ -37,3 +36,3 @@ authUrl.searchParams.append('sdk_host_url', window.location.origin);

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

@@ -55,3 +54,2 @@ };

zIndex: 999,
finchDevMode: false,
};

@@ -103,4 +101,4 @@ let isUseFinchConnectInitialized = false;

function handleFinchAuth(event) {
const canUseFinchDevMode = combinedOptions.finchDevMode && window.location.hostname === 'localhost';
const CONNECT_URI = canUseFinchDevMode ? DEV_FINCH_CONNECT_URI : BASE_FINCH_CONNECT_URI;
var _a;
const CONNECT_URL = ((_a = combinedOptions.apiConfig) === null || _a === void 0 ? void 0 : _a.connectUrl) || BASE_FINCH_CONNECT_URI;
if (!event.data)

@@ -110,3 +108,3 @@ return;

return;
if (!event.origin.startsWith(CONNECT_URI))
if (!event.origin.startsWith(CONNECT_URL))
return;

@@ -113,0 +111,0 @@ close();

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

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

@@ -30,2 +30,3 @@ # @tryfinch/react-connect

// payrollProvider: '<payroll-provider-id>',
// For `sandbox`, omit or use 'false' if in production. Use "finch" or "provider" for sandbox testing, depending on test plan. See Finch's [documentation](https://developer.tryfinch.com/implementation-guide/Test/Testing-Plan) for an overview of Finch and Provider sandboxes.
// sandbox: false,

@@ -32,0 +33,0 @@ // manual: false,

@@ -29,3 +29,6 @@ import { useEffect, useRef } from 'react';

zIndex: number;
finchDevMode?: boolean;
apiConfig?: {
connectUrl: string;
redirectUrl: string;
};
};

@@ -62,5 +65,2 @@

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';

@@ -77,9 +77,8 @@ const FINCH_AUTH_MESSAGE_NAME = 'finch-auth-message';

state,
finchDevMode,
apiConfig,
}: Partial<ConnectOptions>) => {
const canUseFinchDevMode = finchDevMode && window.location.hostname === 'localhost';
const CONNECT_URL = apiConfig?.connectUrl || BASE_FINCH_CONNECT_URI;
const REDIRECT_URL = apiConfig?.redirectUrl || DEFAULT_FINCH_REDIRECT_URI;
const authUrl = new URL(
`${canUseFinchDevMode ? DEV_FINCH_CONNECT_URI : BASE_FINCH_CONNECT_URI}/authorize`
);
const authUrl = new URL(`${CONNECT_URL}/authorize`);
if (clientId) authUrl.searchParams.append('client_id', clientId);

@@ -90,6 +89,3 @@ if (payrollProvider) authUrl.searchParams.append('payroll_provider', payrollProvider);

authUrl.searchParams.append('app_type', 'spa');
authUrl.searchParams.append(
'redirect_uri',
canUseFinchDevMode ? DEV_DEFAULT_FINCH_REDIRECT_URI : DEFAULT_FINCH_REDIRECT_URI
);
authUrl.searchParams.append('redirect_uri', REDIRECT_URL);
/** The host URL of the SDK. This is used to store the referrer for postMessage purposes */

@@ -122,3 +118,2 @@ authUrl.searchParams.append('sdk_host_url', window.location.origin);

zIndex: 999,
finchDevMode: false,
};

@@ -185,10 +180,7 @@

function handleFinchAuth(event: FinchConnectPostMessage) {
const canUseFinchDevMode =
combinedOptions.finchDevMode && window.location.hostname === 'localhost';
const CONNECT_URL = combinedOptions.apiConfig?.connectUrl || BASE_FINCH_CONNECT_URI;
const CONNECT_URI = canUseFinchDevMode ? DEV_FINCH_CONNECT_URI : BASE_FINCH_CONNECT_URI;
if (!event.data) return;
if (event.data.name !== FINCH_AUTH_MESSAGE_NAME) return;
if (!event.origin.startsWith(CONNECT_URI)) return;
if (!event.origin.startsWith(CONNECT_URL)) return;

@@ -195,0 +187,0 @@ close();

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 not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc