@crimson-education/sdk 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # @crimson/sdk 使用文档
1
+ # @crimson-education/sdk 使用文档
2
2
 
3
- `@crimson/sdk` 是一个用于访问 Crimson App(Roadmap 相关)后端接口的 TypeScript SDK,包含三层能力:
3
+ `@crimson-education/sdk` 是一个用于访问 Crimson App(Roadmap 相关)后端接口的 TypeScript SDK,包含三层能力:
4
4
 
5
5
  - **Core(框架无关)**:`CrimsonClient` + 各业务 API(missions / tasks / roadmap / users / mission library)
6
6
  - **iframe(跨域/嵌入场景)**:通过 `postMessage` 初始化鉴权信息,并提供可订阅的鉴权状态
7
- - **React(可选)**:基于 `@tanstack/react-query` 的 Provider 与 Hooks(通过 `@crimson/sdk/react` 引入)
7
+ - **React(可选)**:基于 `@tanstack/react-query` 的 Provider 与 Hooks(通过 `@crimson-education/sdk/react` 引入)
8
8
 
9
9
  > 说明:SDK 默认依赖运行时 `fetch`。在 Node.js 环境建议使用 Node 18+(内置 `fetch`),或自行注入/polyfill。
10
10
 
@@ -17,7 +17,7 @@
17
17
  如果已发布到 npm:
18
18
 
19
19
  ```bash
20
- npm i @crimson/sdk
20
+ npm i @crimson-education/sdk
21
21
  ```
22
22
 
23
23
  ### 本地开发构建
@@ -36,7 +36,7 @@ npm run build
36
36
  ## 快速开始(Core)
37
37
 
38
38
  ```ts
39
- import { createCrimsonClient } from "@crimson/sdk";
39
+ import { createCrimsonClient } from "@crimson-education/sdk";
40
40
 
41
41
  const client = createCrimsonClient({
42
42
  apiUrl: "https://api.example.com",
@@ -225,7 +225,7 @@ SDK 会将后端返回的 action item 做归一化,保证至少返回以下核
225
225
 
226
226
  ## iframe 层(嵌入/跨域场景)
227
227
 
228
- 入口:`@crimson/sdk`(主入口会导出 iframe 层)
228
+ 入口:`@crimson-education/sdk`(主入口会导出 iframe 层)
229
229
 
230
230
  典型用法:
231
231
 
@@ -268,7 +268,7 @@ window.frames[0]?.postMessage(
268
268
 
269
269
  ---
270
270
 
271
- ## React 层(`@crimson/sdk/react`)
271
+ ## React 层(`@crimson-education/sdk/react`)
272
272
 
273
273
  React 层通过 `peerDependencies` 声明依赖(不会强制安装):
274
274
 
@@ -278,7 +278,7 @@ React 层通过 `peerDependencies` 声明依赖(不会强制安装):
278
278
  ### CrimsonProvider
279
279
 
280
280
  ```tsx
281
- import { CrimsonProvider } from "@crimson/sdk/react";
281
+ import { CrimsonProvider } from "@crimson-education/sdk/react";
282
282
 
283
283
  export function App() {
284
284
  return (
package/dist/index.js CHANGED
@@ -18,5 +18,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  __exportStar(require("./core"), exports);
19
19
  // iframe layer (postMessage communication)
20
20
  __exportStar(require("./iframe"), exports);
21
- // React layer is available via "@crimson/sdk/react" subpath
21
+ // React layer is available via "@crimson-education/sdk/react" subpath
22
22
  // Do NOT export here to avoid forcing React dependency on non-React consumers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crimson-education/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Crimson SDK for accessing Crimson App APIs",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -41,8 +41,8 @@
41
41
  },
42
42
  "homepage": "https://github.com/crimson-education/crimson-sdk#readme",
43
43
  "peerDependencies": {
44
- "react": ">=18.0.0",
45
- "@tanstack/react-query": ">=5.0.0"
44
+ "@tanstack/react-query": ">=5.0.0",
45
+ "react": ">=18.0.0"
46
46
  },
47
47
  "peerDependenciesMeta": {
48
48
  "react": {
@@ -53,9 +53,12 @@
53
53
  }
54
54
  },
55
55
  "devDependencies": {
56
+ "@tanstack/react-query": "^5.90.15",
56
57
  "@types/node": "^24.10.1",
58
+ "@types/react": "^19.2.7",
57
59
  "chai": "^6.2.1",
58
60
  "mocha": "^11.7.5",
61
+ "react": "^19.2.3",
59
62
  "typescript": "^5.0.0"
60
63
  }
61
64
  }