@finicity/connect-web-sdk

中文文档
1.0.0-rc.4发布于 2022/05/14MITTypeScriptCommonJS零依赖近 30 天下载 11.8万

Finicity Connect Web SDK

原始使用文档
文档目录7 节
  1. Overview
  2. Installing
  3. Usage
  4. Embedded Experience
  5. Popup Experience
  6. Connect Event Handlers
  7. Connect Options

Finicity Connect Web SDK

Overview

The Finicity Connect Web SDK provides an easy way for developers to integrate Finicity Connect into their web application. It supports both the embedded experience via iframe or through a popup window.

Installing

npm install @finicity/connect-web-sdk

Usage

Embedded Experience

import { FinicityConnect, ConnectEventHandlers, ConnectOptions, ConnectDoneEvent, ConnectCancelEvent, ConnectErrorEvent, ConnectRouteEvent } from '@finicity/connect-web-sdk';

export class ConnectComponent {
  
  connectEventHandlers: ConnectEventHandlers = {
    onDone: (event: ConnectDoneEvent) => { console.log(event); },
    onCancel: (event: ConnectCancelEvent) => { console.log(event); },
    onError: (event: ConnectErrorEvent) => { console.log(event); },
    onRoute: (event: ConnectRouteEvent) => { console.log(event); },
    onUser: (event: any) => { console.log(event); },
    onLoad: () => { console.log('loaded'); }
  };

  connectOptions: ConnectOptions = {
    overlay: 'rgba(199,201,199, 0.5)'
  };

  constructor() {
    FinicityConnect.launch(
      'CONNECT_URL',
     this.connectEventHandlers,
     this.connectOptions);
  }
}

Popup Experience

import { FinicityConnect, ConnectEventHandlers, ConnectOptions, ConnectDoneEvent, ConnectCancelEvent, ConnectErrorEvent, ConnectRouteEvent } from '@finicity/connect-web-sdk';

export class ConnectComponent {
  
  connectEventHandlers: ConnectEventHandlers = {
    onDone: (event: ConnectDoneEvent) => { console.log(event); },
    onCancel: (event: ConnectCancelEvent) => { console.log(event); },
    onError: (event: ConnectErrorEvent) => { console.log(event); },
    onRoute: (event: ConnectRouteEvent) => { console.log(event); },
    onUser: (event: any) => { console.log(event); },
    onLoad: () => { console.log('loaded'); }
  };

  connectOptions: ConnectOptions = {
    popup: true,
    popupOptions: {
      width: 600,
      height: 600,
      top: window.top.outerHeight / 2 + window.top.screenY - (600 / 2),
      left: window.top.outerWidth / 2 + window.top.screenX - (600 / 2)
    }
  };

  constructor() {
    FinicityConnect.launch(
      'CONNECT_URL',
     this.connectEventHandlers,
     this.connectOptions);
  }
}

Connect Event Handlers

Event TypeDescription
onLoadCalled when the Connect web page is loaded and ready to display
onDoneCalled when the user successfully completes the Connect application
onCancelCalled when the user cancels the Connect application
onErrorCalled when an error occurs while the user is using the Connect
onRouteCalled with the user is navigating through the screens of the Connect application
onUserCalled when a user performs an action. User events provide visibility into what action a user could take within the Connect application

For more detailed information on these events visit: Connect Event Types

Connect Options

OptionDescription
overlayChanges the overlay color where the Connect modal is displayed (only for iframe, defaults to rgba(0,0,0,0.8))
selectorCSS selector in which Connect should be embedded to. Connect will expand to fill the container's dimensions, the element's position must not be static. Connect will be displayed in a modal by default
nodeElement in which Connect should be embedded to. Connect will expand to fill the container's dimensions, the element's position must not be static. Connect will be displayed in a modal by default
popupIndicates if Connect should be displayed in a popup (defaults to false)
popupOptionsUsed to configure the popup's width/height and positioning (top/left)

版本与发布记录

@finicity/connect-web-sdk 共发布 7 个版本,首次发布于 2021/05/12;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.0.0-rc.4latest2022/05/144 年前
1.0.0-rc.32022/02/284 年前
1.0.0-rc.22021/12/014 年前
1.0.0-rc.12021/11/244 年前
1.0.0-rc.02021/05/195 年前
0.0.1-alpha.42021/05/135 年前

关于 @finicity/connect-web-sdk 的常见问题

@finicity/connect-web-sdk 是什么?

Finicity Connect Web SDK

如何安装 @finicity/connect-web-sdk?

在项目目录运行 npm install @finicity/connect-web-sdk,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:core-js(^3.9.1)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@finicity/connect-web-sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@finicity/connect-web-sdk 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@finicity/connect-web-sdk 可以商用吗?

@finicity/connect-web-sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@finicity/connect-web-sdk 的下载量有多少?

根据 npm 官方下载统计,@finicity/connect-web-sdk 在 2026/10/15 – 2026/11/13 这 30 天内被下载 118,168 次,日均约 3,939 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@finicity/connect-web-sdk 还在维护吗?

最新版本 1.0.0-rc.4 发布于 2022/05/14(4 年前);至今共发布 7 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/05/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。