@thenextgateway/core

中文文档
2.1.1发布于 2026/11/02MITTypeScriptESM + CJS零依赖

Core types and constants for TNG packages.

原始使用文档
文档目录3 节
  1. Installation
  2. Usage
  3. Exports

@thenextgateway/core

Core TypeScript types and constants shared by TNG packages.

Installation

npm install @thenextgateway/core

Usage

import { CASHIER_MESSAGE_TYPES, CROSSFRAME_MESSAGE_TYPES, TNG_TRANSACTION_TYPES, type TNGCssVars } from "@thenextgateway/core";

const transactionType = TNG_TRANSACTION_TYPES.deposit;

const theme: TNGCssVars = {
  color: {
    primary: {
      default: "#0057ff",
      contrast: "#fff",
    },
  },
};

const initMessageType = CROSSFRAME_MESSAGE_TYPES.init; // "tng_init"
const initConfirmMessageType = CASHIER_MESSAGE_TYPES.initConfirm; // "tng_initConfirm"

Exports

This package is primarily used by @thenextgateway/cashier.sdk and includes:

  • Cashier configuration types, including CashierConfig, MethodStepConfig, and AmountStepConfig.
  • Transaction constants and types, including TNG_TRANSACTION_TYPES, TNG_TRANSACTION_STATES, TNG_TRANSACTION_STATUSES, TNGTransactionType, TNGTransactionState, and TNGTransactionStatus.
  • Cross-frame message types used by Cashier and host applications, including CROSSFRAME_MESSAGE_TYPES and CASHIER_MESSAGE_TYPES. Message type values are prefixed with tng_.
  • Host listener types, including HostGlobalListeners and HostEventData.
  • Payment method, progress step, error, icon, stylesheet, and theming types.

版本与发布记录

@thenextgateway/core 共发布 7 个版本,首次发布于 2026/08/07;过去 12 个月发布了 7 个版本。

版本发布日期距今
2.1.1latest2026/11/02今天
2.1.02026/10/0528 天前
2.0.22026/09/091 个月前
2.0.12026/09/071 个月前
2.0.02026/08/262 个月前
1.0.12026/08/072 个月前

关于 @thenextgateway/core 的常见问题

@thenextgateway/core 是什么?

TNG包的核心类型和常量。

如何安装 @thenextgateway/core?

在项目目录运行 npm install @thenextgateway/core,或使用 pnpm add / yarn add / bun add。

@thenextgateway/core 支持 TypeScript 吗?

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

@thenextgateway/core 支持 ESM 还是 CommonJS?

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

@thenextgateway/core 可以商用吗?

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

@thenextgateway/core 还在维护吗?

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