# @thenextgateway/core 中文文档

规范地址：https://npmcn.com/package/%40thenextgateway/core/

版本：2\.1\.1
npm 元数据更新时间：2026-11-02T15:44:05.586Z
中文译文更新时间：2026-11-02T16:31:44.829Z
软件包许可：MIT

本文由上游 README 机器翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40thenextgateway/core
原文对照：https://npmcn.com/package/%40thenextgateway/core/?lang=original

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：30.9 kB，23 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：0 个
- 首次发布：2026-08-07T12:48:04.686Z
- 最新版本发布：2026-11-02T15:44:05.408Z
- 已发布版本数：7（近 12 个月 7 个）

## 中文简介

TNG包的核心类型和常量。

## 安装

```sh
npm install @thenextgateway/core
```

也可以使用：`pnpm add @thenextgateway/core`、`yarn add @thenextgateway/core`、`bun add @thenextgateway/core`

## README

# @thenextgateway /核心

TNG包共享的核心TypeScript类型和常量。

## 安装

```bash
npm install @thenextgateway/core
```

## 使用

```ts
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"
```

## 出口

这个包主要由 `@thenextgateway/cashier.sdk` ,包括:

-   出纳配置类型包括 `CashierConfig`， `MethodStepConfig`, `AmountStepConfig`.
-   事务常量和类型，包括 `TNG_TRANSACTION_TYPES`， `TNG_TRANSACTION_STATES`， `TNG_TRANSACTION_STATUSES`， `TNGTransactionType`， `TNGTransactionState`, `TNGTransactionStatus`.
-   收银员和主机应用程序使用的跨帧消息类型，包括 `CROSSFRAME_MESSAGE_TYPES` 和 `CASHIER_MESSAGE_TYPES`． 消息类型值的前缀为 `tng_`.
-   主机侦听器类型，包括 `HostGlobalListeners` 和 `HostEventData`.
-   付款方式、进度步骤、错误、图标、样式表和主题类型。

## 常见问题

### @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 和提交记录判断。

