@astrada.co/card-enrollment-sdk

中文文档
1.1.0发布于 2026/09/12MITTypeScript零依赖近 30 天下载 8719

TypeScript types for the Astrada Card Enrollment SDK and Unified Enrollment SDK. Types only; the runtime loads from sdk.astrada.co via a

原始使用文档
文档目录3 节
  1. Card Enrollment SDK (legacy)
  2. Unified Enrollment SDK
  3. Versioning

@astrada.co/card-enrollment-sdk

Official TypeScript types for the Astrada Card Enrollment SDK and Unified Enrollment SDK.

These SDKs load at runtime from a hosted <script> tag (they are not npm runtime packages), so this package ships types only. Install it as a dev dependency to get a typed window.CardEnrollmentSdk / window.UnifiedEnrollmentSdk and typed config + callback payloads.

npm install --save-dev @astrada.co/card-enrollment-sdk
# or
yarn add --dev @astrada.co/card-enrollment-sdk

Card Enrollment SDK (legacy)

import type {
  CardEnrollmentSdkConfig,
  EnrollmentSuccess,
  OnErrorPayload,
} from '@astrada.co/card-enrollment-sdk';

// `window.CardEnrollmentSdk` is typed automatically once the package is imported.
const config: CardEnrollmentSdkConfig = {
  companyName: 'Acme',
  subaccountId: '…',
  getAccessToken: () => fetchToken(),
  onSuccess: (data: EnrollmentSuccess) => {
    console.log(data.cardId, data.enrollmentGuidance.availableEnrollmentMethods);
  },
  onError: (data: OnErrorPayload) => {
    console.log(data.type, data.verificationId);
  },
};

window.CardEnrollmentSdk.openForm(config);

Unified Enrollment SDK

import type {
  UnifiedEnrollmentSdkConfig,
  SdkEvent,
  EnrollmentSuccess,
} from '@astrada.co/card-enrollment-sdk/unified';

const config: UnifiedEnrollmentSdkConfig = {
  companyName: 'Acme',
  subaccountId: '…',
  getAccessToken: () => fetchToken(),
  onEvent: (event: SdkEvent) => {
    if (event.type === 'card-enrolled') console.log(event.cardId);
  },
  onSuccess: (data: EnrollmentSuccess) => {
    console.log(Object.values(data.cards));
  },
};

window.UnifiedEnrollmentSdk.open(config);

The ./unified entry tracks a pre-GA SDK and its types may change ahead of a stable release; the top-level (Card Enrollment SDK) types are stable.

Versioning

These types are generated from the SDK source and checked against it in CI, so they match what the runtime delivers. See the SDK docs at https://docs.astrada.co for full integration guides.

版本与发布记录

@astrada.co/card-enrollment-sdk 共发布 3 个版本,首次发布于 2026/07/29;过去 12 个月发布了 3 个版本。

版本发布日期距今
1.1.0latest2026/09/121 个月前
1.0.12026/07/293 个月前
1.0.02026/07/293 个月前

关于 @astrada.co/card-enrollment-sdk 的常见问题

@astrada.co/card-enrollment-sdk 是什么?

TypeScript types for the Astrada Card Enrollment SDK and Unified Enrollment SDK. Types only; the runtime loads from sdk.astrada.co via a

如何安装 @astrada.co/card-enrollment-sdk?

在项目目录运行 npm install @astrada.co/card-enrollment-sdk,或使用 pnpm add / yarn add / bun add。

@astrada.co/card-enrollment-sdk 支持 TypeScript 吗?

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

@astrada.co/card-enrollment-sdk 需要什么版本的 Node.js?

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

@astrada.co/card-enrollment-sdk 可以商用吗?

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

@astrada.co/card-enrollment-sdk 的下载量有多少?

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

@astrada.co/card-enrollment-sdk 还在维护吗?

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