@geins/crm

中文文档
0.13.0发布于 2026/11/09MITTypeScriptESM + CJS零依赖近 30 天下载 1971

Customer Relationship Management package for the Geins SDK. Provides user authentication (login, refresh, password reset) and profile management.

原始使用文档
文档目录9 节
  1. Install
  2. Quick start
  3. Stateless (server-side)
  4. Session (browser-side)
  5. API overview
  6. GeinsCRM services
  7. CrmSession
  8. Documentation
  9. License

@geins/crm

Customer Relationship Management package for the Geins SDK. Provides user authentication (login, refresh, password reset) and profile management.

Install

npm install @geins/crm @geins/core
# or
yarn add @geins/crm @geins/core

@geins/core is a peer dependency and must be installed alongside this package.

Quick start

Stateless (server-side)

import { GeinsCore } from '@geins/core';
import { GeinsCRM } from '@geins/crm';

const core = new GeinsCore({ apiKey: '...', accountName: '...', channel: '...' });
const crm = new GeinsCRM(core);

// Login
const response = await crm.auth.login({ username: '[email protected]', password: '...' });

// Get user profile (requires a valid user token)
const user = await crm.user.get(userToken);

Session (browser-side)

import { CrmSession } from '@geins/crm';

const session = new CrmSession(crm, {
  storage: customStorageAdapter, // optional, defaults to cookies
  events: core.events,           // optional, enables cross-tab sync
});

await session.login({ username: '[email protected]', password: '...' });
const user = await session.getUser(); // auto-refreshes expired tokens
session.logout();

API overview

ExportDescription
GeinsCRMStateless CRM entry point — exposes auth and user services.
CrmSessionBrowser-side session with token persistence, auto-refresh, and event emission.

GeinsCRM services

  • crm.auth — login(), refresh(), getUser(), authorized(), changePassword()
  • crm.user — get(token), update(input, token), create(input)

CrmSession

  • session.login(credentials) — Login and persist tokens.
  • session.getUser() — Get profile with auto-refresh.
  • session.authorized() — Check session validity.
  • session.logout() — Clear all stored tokens.

Documentation

See the full documentation for detailed usage.

License

MIT

版本与发布记录

@geins/crm 共发布 103 个版本,首次发布于 2024/11/12;过去 12 个月发布了 51 个版本。

版本发布日期距今
0.13.0latest2026/11/096 天前
0.11.0-canary-17273fca6f093139e2405de03d8a4a31378c40c3canary2026/11/096 天前
0.11.0-canary-8b01e513a66e8b70ea1743c0266e6929e6bc5fa42026/11/096 天前
0.12.22026/11/096 天前
0.11.0-canary-b242ee14e433fb7ebe33466e2f7ed3c2ebf1f8052026/11/069 天前
0.12.12026/10/2224 天前

关于 @geins/crm 的常见问题

@geins/crm 是什么?

Customer Relationship Management package for the Geins SDK. Provides user authentication (login, refresh, password reset) and profile management.

如何安装 @geins/crm?

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

@geins/crm 支持 TypeScript 吗?

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

@geins/crm 支持 ESM 还是 CommonJS?

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

@geins/crm 可以商用吗?

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

@geins/crm 的下载量有多少?

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

@geins/crm 还在维护吗?

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