@burdenoff/planmagnet-fe-sdk 2026.703.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 +162 -0
- package/dist/index.d.ts +840 -0
- package/dist/index.js +1764 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +66 -0
- package/package.json +135 -0
package/README.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# @burdenoff/planmagnet-fe-sdk
|
|
2
|
+
|
|
3
|
+
Embeddable, **product-agnostic** PlanMagnet task UI. Mirrors the
|
|
4
|
+
`@burdenoff/fluidgrids-fe-sdk` embed contract: a standalone component that can
|
|
5
|
+
self-provision an Apollo client from a URL **or** accept a host-injected client
|
|
6
|
+
(BYO-Apollo), plus a provider-less core for shells that already own an
|
|
7
|
+
`ApolloProvider`.
|
|
8
|
+
|
|
9
|
+
Phase 1 ships a **read-only task board** (`TaskBoard` / `TaskBoardCore`) over
|
|
10
|
+
`wspace-planmagnet-svc`. It is farm-free — no HealthyBowl Field/Crop logic; that
|
|
11
|
+
glue is layered by the host app later.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
bun add @burdenoff/planmagnet-fe-sdk
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Peer deps (provided by the host): `react`, `react-dom`, and optionally
|
|
20
|
+
`@burdenoff/fe-libs` (used for the `Card` primitive; externalized, never bundled).
|
|
21
|
+
|
|
22
|
+
Import the stylesheet once (skip if your host already ships fe-libs tokens):
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import "@burdenoff/planmagnet-fe-sdk/styles.css";
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Embed contract
|
|
29
|
+
|
|
30
|
+
Three mount patterns:
|
|
31
|
+
|
|
32
|
+
### 1. Standalone (URL mode) — SDK builds its own client
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { TaskBoard } from "@burdenoff/planmagnet-fe-sdk";
|
|
36
|
+
|
|
37
|
+
<TaskBoard
|
|
38
|
+
apiGatewayUrl="https://graphqlworkspaces.burdenoff.com"
|
|
39
|
+
authToken={platformToken}
|
|
40
|
+
workspaceToken={workspaceToken}
|
|
41
|
+
workspaceId="ws-123"
|
|
42
|
+
tenantId="tenant-abc"
|
|
43
|
+
onTaskClick={(task) => console.log(task)}
|
|
44
|
+
/>;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The SDK appends `/workspaces/graphql` to `apiGatewayUrl` (unless it already ends
|
|
48
|
+
in `/graphql`) and sends the dual-token workspace headers:
|
|
49
|
+
|
|
50
|
+
| Header | Source |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| `authorization: Bearer <authToken>` | platform identity |
|
|
53
|
+
| `x-workspace-authorization: Bearer <workspaceToken>` | workspace access |
|
|
54
|
+
| `x-workspace-id` | `workspaceId` |
|
|
55
|
+
| `x-tenant-id` | `tenantId` (optional) |
|
|
56
|
+
|
|
57
|
+
### 2. BYO-Apollo (host injects its authed client)
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
<TaskBoard workspaceClient={hostApolloClient} workspaceId="ws-123" readonly />
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`workspaceClient` takes priority over `apiGatewayUrl`. This is the path for
|
|
64
|
+
microfe / HealthyBowl shells that already have an authed workspace client.
|
|
65
|
+
|
|
66
|
+
### 3. Provider + Core (share a client across several SDK components)
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
import { PlanMagnetProvider, TaskBoardCore } from "@burdenoff/planmagnet-fe-sdk";
|
|
70
|
+
|
|
71
|
+
<PlanMagnetProvider apiGatewayUrl={url} authToken={token} workspaceId="ws-123">
|
|
72
|
+
<TaskBoardCore projectId="proj-1" onTaskClick={openTask} />
|
|
73
|
+
</PlanMagnetProvider>;
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`TaskBoardCore` reads Apollo from the ambient `ApolloProvider` and never creates
|
|
77
|
+
a client or assumes a router. `PlanMagnetProvider` **always** mounts its own
|
|
78
|
+
`ApolloProvider`, so an embedded board works inside any host page.
|
|
79
|
+
|
|
80
|
+
## Component props
|
|
81
|
+
|
|
82
|
+
### `TaskBoardCoreProps`
|
|
83
|
+
|
|
84
|
+
| Prop | Type | Notes |
|
|
85
|
+
| --- | --- | --- |
|
|
86
|
+
| `projectId?` | `string` | Client-side project scope (Phase 1). |
|
|
87
|
+
| `columns?` | `BoardColumn[]` | Defaults to `DEFAULT_BOARD_COLUMNS`. |
|
|
88
|
+
| `readonly?` | `boolean` | Reserved; Phase 1 board is read-only regardless. |
|
|
89
|
+
| `hideHeader?` | `boolean` | Hide title + count. |
|
|
90
|
+
| `hideFilters?` | `boolean` | Hide priority/type filter bar. |
|
|
91
|
+
| `hiddenFields?` | `string[]` | Suppress card fields: `key`, `priority`, `type`, `labels`, `storyPoints`, `assignee`, `dueDate`. |
|
|
92
|
+
| `onTaskClick?` | `(task: Task) => void` | Card click. |
|
|
93
|
+
| `className?` | `string` | Root container classes. |
|
|
94
|
+
| `workspaceId?` | `string` | Explicit override; else from provider context. |
|
|
95
|
+
|
|
96
|
+
`TaskBoardProps` extends the above with the client-provisioning props
|
|
97
|
+
(`apiGatewayUrl`, `authToken`, `workspaceToken`, `workspaceId` (required),
|
|
98
|
+
`tenantId`, `organizationId`, `trustedOrigins`, `onAuthError`, `workspaceClient`).
|
|
99
|
+
|
|
100
|
+
## Client injection API
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import {
|
|
104
|
+
createPlanMagnetClient,
|
|
105
|
+
setPlanMagnetClient,
|
|
106
|
+
getPlanMagnetClient,
|
|
107
|
+
getPlanMagnetClientSafe,
|
|
108
|
+
isPlanMagnetClientReady,
|
|
109
|
+
waitForPlanMagnetClient,
|
|
110
|
+
resetPlanMagnetClient,
|
|
111
|
+
} from "@burdenoff/planmagnet-fe-sdk";
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`PlanMagnetProvider` publishes the active client to a module singleton so
|
|
115
|
+
non-hook code can reach it via `getPlanMagnetClient()`.
|
|
116
|
+
|
|
117
|
+
## GraphQL
|
|
118
|
+
|
|
119
|
+
Bundled operation documents: `LIST_WORK_ITEMS`, `GET_PROJECTS`,
|
|
120
|
+
`CREATE_WORK_ITEM`, `UPDATE_WORK_ITEM`, `MOVE_WORK_ITEM`. They target the
|
|
121
|
+
prefixed gateway roots (`planmagnetWorkItems`, …) with un-prefixed input names to
|
|
122
|
+
match the local codegen SDL.
|
|
123
|
+
|
|
124
|
+
> Phase 1 hand-writes these docs + the domain types so the SDK compiles without a
|
|
125
|
+
> live `schema:pull`. Phase 2 replaces them with codegen output
|
|
126
|
+
> (`bun run schema:pull && bun run codegen` against a wspace gateway on `:4003`)
|
|
127
|
+
> and adds the `WorkItemLink` cross-product ops.
|
|
128
|
+
|
|
129
|
+
## Local development
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
bun install
|
|
133
|
+
bun run build # tsup → dist/ (+ copies styles.css)
|
|
134
|
+
bun run type:check # tsc --noEmit
|
|
135
|
+
bun run dev # tsup --watch
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Embed-test harness (renders `TaskBoard` against an Apollo `MockedProvider`, no
|
|
139
|
+
backend needed):
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
cd dev && bun install && bun run dev # Vite on :5174
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Status (Phase 1)
|
|
146
|
+
|
|
147
|
+
- [x] Package scaffold mirroring fluidgrids-fe-sdk
|
|
148
|
+
- [x] `PlanMagnetProvider` with client-injection (URL / BYO)
|
|
149
|
+
- [x] `createPlanMagnetClient` + module-singleton set/get/reset
|
|
150
|
+
- [x] `TaskBoard` (standalone) + `TaskBoardCore` (BYO), semantic-token themed
|
|
151
|
+
- [x] Bundled list/project GraphQL ops
|
|
152
|
+
- [x] Mocked embed-test harness
|
|
153
|
+
- [ ] `CreateTask` form (Phase 2 — needs a project selector; the microfe stub is broken)
|
|
154
|
+
- [ ] `TaskList` / `TaskDetail`
|
|
155
|
+
- [ ] Drag-to-move (`MOVE_WORK_ITEM`) + write mutations wired to UI
|
|
156
|
+
- [ ] `WorkItemLink` cross-product ops (needs `schema:pull`)
|
|
157
|
+
- [ ] Codegen-generated types (replace hand-written slices)
|
|
158
|
+
- [ ] Unit tests (Vitest / bun test) ≥ 80%
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
Proprietary — Burdenoff Consultancy Services Pvt. Ltd.
|