@palettelab/sdk 0.1.25 → 0.1.26

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.
Files changed (2) hide show
  1. package/README.md +32 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -136,6 +136,7 @@ import {
136
136
  servicesProxy,
137
137
  BrokerCallError,
138
138
  events,
139
+ notifications,
139
140
  usePluginTranslations,
140
141
  translate,
141
142
  normalizePaletteLanguage,
@@ -182,6 +183,7 @@ Public frontend helpers exported by `@palettelab/sdk`:
182
183
  - Install config: `getInstallConfig(pluginId)`, `updateInstallConfig(pluginId, values)`.
183
184
  - Connections: `getConnections(pluginId)`, `startConnection(pluginId, connectionId)`, `disconnectConnection(pluginId, connectionId)`, and `requireConnection(pluginId, connectionId)`.
184
185
  - App-to-app broker: `broker.call(target, payload?)`, `broker.emit(target, payload?)`, `servicesProxy(namespaceVersion)`, `events.on(target, handler)`, `events.emit(target, payload?)`, and `BrokerCallError`.
186
+ - OS notifications: `notifications.push(input)` (also `palette.notifications.push(input)`) — push a persistent notification into the OS notification center.
185
187
  - Organization/user: `UserClient`, `OrganizationClient`, including `current`, `updateProfile`, `listMine`, `listMembers`, `getMember`, `getMemberByEmail`, `inviteMember`, and `updateMemberRole`.
186
188
  - Permissions: `hasPermission(ctx, permission)`, `hasAnyPermission(ctx, permissions)`, `hasAllPermissions(ctx, permissions)`.
187
189
  - Translations: `normalizePaletteLanguage`, `translate`, `usePluginTranslations`.
@@ -503,6 +505,36 @@ const file = folder
503
505
  : null
504
506
  ```
505
507
 
508
+ ## OS Notifications
509
+
510
+ Push a persistent notification into the OS notification center (the bell).
511
+ Unlike a toast, it survives past the moment, shows your app's icon and name,
512
+ and opens/focuses your app window when clicked:
513
+
514
+ ```ts
515
+ import { notifications } from "@palettelab/sdk"
516
+ // or: palette.notifications.push(...)
517
+
518
+ await notifications.push({
519
+ title: "Export complete",
520
+ body: "Your report is ready to download.",
521
+ severity: "success", // "info" | "success" | "warning" | "error"
522
+ route: "/exports/123", // opened inside your app on click
523
+ data: { exportId: 123 }, // arbitrary payload stored with the notification
524
+ })
525
+ ```
526
+
527
+ `route` resolves relative to your app (`/apps/{your-app-id}/exports/123`); pass
528
+ an absolute `/apps/...` route to target another app's window. The source app id
529
+ is inferred from the URL — pass `appId` to override.
530
+
531
+ The stable contract is `POST /api/v1/notifications/` on the platform API; the
532
+ helper is sugar over it. Notifications target the calling user and their active
533
+ organisation, are delivered live over `GET /api/v1/notifications/stream` (SSE),
534
+ and show as a toast plus a notification-center entry. The helper runs in the
535
+ user's session, so sandboxed iframe apps are not supported yet (no session
536
+ cookie inside the iframe).
537
+
506
538
  ## Permissions
507
539
 
508
540
  Use permission helpers to keep UI actions aligned with backend permission gates.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@palettelab/sdk",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "Palette Platform SDK for building plugins and apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",