@complyco/client-recorder-web

中文文档
0.3.1发布于 2026/08/08TypeScriptESM + CJS近 30 天下载 8509

ComplyCo's client web recorder

原始使用文档
文档目录5 节
  1. Getting Started
  2. Masking
  3. Navigation
  4. Plugins
  5. A React example

Client-Recorder

This package allows you to set up web session recording in your web apps.

Getting Started

Please note, the baseUrl comes from the client that you have registered in ComplyCO's dashboard. It will look like app-<...>.client.complyco.com.

The onAuthTokenRequested callback will need to hit an endpoint on your backend which is configured to generate and sign a JWT. The client that you have registered in ComplyCO's dashboard should be configured with the public key that corresponds with the private key used for signing in your backend API.

import { createClientRecorder } from "@complyco/client-recorder-web";
import { GzipPlugin } from "@complyco/client-recorder-web/plugins";

// initialize the recorder once for your pageload
const recorder = createClientRecorder({
  syncOptions: {
    baseUrl: process.env.NEXT_PUBLIC_WIDGET_API as string,
    onAuthTokenRequested,
    plugins: [GzipPlugin],
  },
});

// if your JWT callback function changes, you can pass in your new one
recorder.setOnAuthTokenRequested(onAuthTokenRequested);

// start the recording; you only need to do this once.
// NOTE: The argument is optional. This example shows the defaults
recorder.record({
  blockClass: "complyco-block",
  ignoreClass: "complyco-ignore",
  maskTextClass: "complyco-mask",
  maskAllInputs: true,
  captureNavigation: false,
});

// stops the recording and forces a sync to ComplyCO's backend.
recorder.shutdown();

Masking

All inputs are masked by default, but you can choose to unmask all inputs. With maskAllInputs set to true (the default), mark any fields you want left unmasked with data-complyco-unmask="true" or the complyco-unmask class (e.g. <input class="complyco-unmask"> or <select data-complyco-unmask="true">). Use this to keep specific non-sensitive fields visible (for example, a product name dropdown) while keeping everything else masked.

You can configure the recorder with block, ignore and mask text classes, or you can use our defaults. Our defaults are:

  • complyco-block
  • complyco-ignore
  • complyco-mask

If your UI already has classes from Sentry's Replay functionality, you can just pass the appropriate class names when invoking recorder.record(...).

Navigation

The captureNavigation option allows you to track page navigation events within your single-page application. When enabled, it will record URL changes that occur through:

  • History API calls (pushState, replaceState)
  • Browser back/forward navigation
  • Hash changes

Plugins

Use of plugins is optional, but they may offer performance improvements in certain cases.

  • GzipPlugin: Compresses the recording when sending it to ComplyCO's backend.

A React example

"use client";
import { useState, useEffect } from "react";
import { createClientRecorder } from "@complyco/client-recorder-web";
import { GzipPlugin } from "@complyco/client-recorder-web/plugins";

export type AuthTracerProviderProps = {
  children: React.ReactNode;
  onAuthTokenRequested: any | undefined;
};

export default function AuthTracerProvider({ children, onAuthTokenRequested }: AuthTracerProviderProps) {
  const [recorder] = useState(() => {
    return createClientRecorder({
      syncOptions: {
        baseUrl: process.env.NEXT_PUBLIC_WIDGET_API as string,
        onAuthTokenRequested,
        plugins: [GzipPlugin],
      },
    });
  });

  useEffect(() => {
    if (onAuthTokenRequested) {
      recorder.setOnAuthTokenRequested(onAuthTokenRequested);
    }
  }, [recorder, onAuthTokenRequested]);

  useEffect(() => {
    recorder.record();

    return () => {
      recorder.shutdown();
    };
  });

  return null;
}

版本与发布记录

@complyco/client-recorder-web 共发布 11 个版本,首次发布于 2024/10/02;过去 12 个月发布了 3 个版本。

版本发布日期距今
0.3.1latest2026/08/083 个月前
0.3.02026/08/083 个月前
0.2.02025/12/1910 个月前
0.1.92025/06/141.4 年前
0.1.82025/03/261.6 年前
0.1.72025/01/071.8 年前

关于 @complyco/client-recorder-web 的常见问题

@complyco/client-recorder-web 是什么?

ComplyCo's client web recorder

如何安装 @complyco/client-recorder-web?

在项目目录运行 npm install @complyco/client-recorder-web,或使用 pnpm add / yarn add / bun add。

@complyco/client-recorder-web 支持 TypeScript 吗?

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

@complyco/client-recorder-web 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@complyco/client-recorder-web 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@complyco/client-recorder-web 可以商用吗?

@complyco/client-recorder-web 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@complyco/client-recorder-web 的下载量有多少?

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

@complyco/client-recorder-web 还在维护吗?

最新版本 0.3.1 发布于 2026/08/08(3 个月前);至今共发布 11 个版本,其中过去 12 个月发布了 3 个;首次发布于 2024/10/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。