@palettelab/sdk 0.1.13 → 0.1.14
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 +36 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -122,15 +122,30 @@ import {
|
|
|
122
122
|
PluginProvider,
|
|
123
123
|
usePlatform,
|
|
124
124
|
createPaletteClient,
|
|
125
|
+
DataRoomClient,
|
|
126
|
+
StorageClient,
|
|
125
127
|
usePluginTranslations,
|
|
128
|
+
translate,
|
|
129
|
+
normalizePaletteLanguage,
|
|
126
130
|
usePluginTasks,
|
|
127
131
|
usePluginDataRooms,
|
|
128
132
|
usePluginChat,
|
|
129
133
|
apiFetch,
|
|
130
134
|
apiUpload,
|
|
135
|
+
setBaseUrl,
|
|
136
|
+
getBaseUrl,
|
|
131
137
|
createSandboxBridge,
|
|
138
|
+
isSandboxRuntime,
|
|
132
139
|
getInstallConfig,
|
|
133
140
|
updateInstallConfig,
|
|
141
|
+
hasPermission,
|
|
142
|
+
hasAnyPermission,
|
|
143
|
+
hasAllPermissions,
|
|
144
|
+
PaletteApiError,
|
|
145
|
+
errorFromResponse,
|
|
146
|
+
isPaletteApiError,
|
|
147
|
+
createMockPlatformContext,
|
|
148
|
+
withPluginProvider,
|
|
134
149
|
} from "@palettelab/sdk"
|
|
135
150
|
```
|
|
136
151
|
|
|
@@ -142,6 +157,25 @@ import type { PluginManifest } from "@palettelab/sdk/types"
|
|
|
142
157
|
import { PluginProvider } from "@palettelab/sdk/components"
|
|
143
158
|
```
|
|
144
159
|
|
|
160
|
+
## Helper Reference
|
|
161
|
+
|
|
162
|
+
Public frontend helpers exported by `@palettelab/sdk`:
|
|
163
|
+
|
|
164
|
+
- Provider/context: `PluginProvider`, `usePlatform`, `PlatformCtx`.
|
|
165
|
+
- Client facade: `createPaletteClient(platform?)`.
|
|
166
|
+
- API: `apiFetch(path, init?)`, `apiUpload(path, file, fieldName?, extraFields?)`, `setBaseUrl(url)`, `getBaseUrl()`.
|
|
167
|
+
- Errors: `PaletteApiError`, `errorFromResponse(response)`, `isPaletteApiError(error)`.
|
|
168
|
+
- Data Rooms: `DataRoomClient`, `dataRooms`, plus `list`, `create`, `get`, `folder`, `ensureRoom`, `requireRoomByName`, `findRoomByName`, `createFolder`, `ensureFolder`, `findFolderByName`, `resolveFolderPath`, `findFileByName`, `requestUpload`, `confirmUpload`, and `uploadFile`.
|
|
169
|
+
- Storage: `StorageClient`, `uploadToSignedUrl(uploadUrl, file, contentType?)`.
|
|
170
|
+
- Install config: `getInstallConfig(pluginId)`, `updateInstallConfig(pluginId, values)`.
|
|
171
|
+
- Organization/user: `UserClient`, `OrganizationClient`, including `current`, `updateProfile`, `listMine`, `listMembers`, `getMember`, `getMemberByEmail`, `inviteMember`, and `updateMemberRole`.
|
|
172
|
+
- Permissions: `hasPermission(ctx, permission)`, `hasAnyPermission(ctx, permissions)`, `hasAllPermissions(ctx, permissions)`.
|
|
173
|
+
- Translations: `normalizePaletteLanguage`, `translate`, `usePluginTranslations`.
|
|
174
|
+
- Hooks: `usePluginTasks`, `usePluginDataRooms`, `usePluginChat`.
|
|
175
|
+
- Sandbox: `createSandboxBridge`, `isSandboxRuntime`.
|
|
176
|
+
- Testing: `createMockPlatformContext`, `withPluginProvider`.
|
|
177
|
+
- Types: `PluginManifest`, `PluginComponentProps`, `PlatformContext`, `PaletteClient`, resource, task, chat, data-room, user, organization, translation, and sandbox bridge types.
|
|
178
|
+
|
|
145
179
|
## Plugin Root
|
|
146
180
|
|
|
147
181
|
The platform passes plugin runtime context into your root component. Wrap your UI with `PluginProvider` so hooks can read it.
|
|
@@ -364,8 +398,8 @@ Plugins can read and update their installation configuration through helper APIs
|
|
|
364
398
|
```ts
|
|
365
399
|
import { getInstallConfig, updateInstallConfig } from "@palettelab/sdk"
|
|
366
400
|
|
|
367
|
-
const config = await getInstallConfig()
|
|
368
|
-
await updateInstallConfig({ ...config, enabled: true })
|
|
401
|
+
const config = await getInstallConfig("my-plugin")
|
|
402
|
+
await updateInstallConfig("my-plugin", { ...config, enabled: true })
|
|
369
403
|
```
|
|
370
404
|
|
|
371
405
|
## Sandbox Bridge
|