@tangle-network/sandbox-ui 0.116.5 → 0.116.6

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
@@ -38,6 +38,17 @@ Import styles in your app root:
38
38
  import "@tangle-network/sandbox-ui/styles";
39
39
  ```
40
40
 
41
+ ### Workspace integration access
42
+
43
+ Use `IntegrationsPanel` from `/integrations` for the provider catalog, logos, search, connection status, and account actions.
44
+ Do not render a second connection catalog above it.
45
+ Supply `getConnectionContext` for a short access label on each connected card.
46
+ Supply `getConnectionActions` for authorized workspace actions in that card's menu.
47
+ Each action has an `id`, `label`, optional `disabled` flag, and `onSelect` callback.
48
+ The panel waits for asynchronous actions and surfaces failures.
49
+ Keep workspace authorization and binding persistence in the consuming application's server.
50
+ When a provider has multiple accounts, include distinct account labels and identities in its workspace actions.
51
+
41
52
  ### Embed a sandbox app
42
53
 
43
54
  Use `EmbeddedAppView` when a workspace presents a running web app beside an agent conversation.
package/dist/globals.css CHANGED
@@ -1043,6 +1043,9 @@
1043
1043
  .min-h-\[120px\] {
1044
1044
  min-height: 120px;
1045
1045
  }
1046
+ .min-h-\[136px\] {
1047
+ min-height: 136px;
1048
+ }
1046
1049
  .min-h-\[160px\] {
1047
1050
  min-height: 160px;
1048
1051
  }
@@ -47,6 +47,12 @@ interface IntegrationHealth {
47
47
  //#endregion
48
48
  //#region src/integrations/integrations-panel.d.ts
49
49
  type IntegrationSort = "featured" | "alpha";
50
+ interface IntegrationConnectionAction {
51
+ id: string;
52
+ label: string;
53
+ disabled?: boolean;
54
+ onSelect: () => void | Promise<void>;
55
+ }
50
56
  interface IntegrationsPanelProps {
51
57
  catalog: IntegrationProvider[];
52
58
  connections: IntegrationConnection[];
@@ -86,6 +92,10 @@ interface IntegrationsPanelProps {
86
92
  connectionId: string;
87
93
  providerId: string;
88
94
  }) => void | Promise<void>;
95
+ /** Consumer-owned access context shown below the connected account. */
96
+ getConnectionContext?: (connection: IntegrationConnection) => string | undefined;
97
+ /** Additional authorized actions in the connected card menu. */
98
+ getConnectionActions?: (connection: IntegrationConnection) => IntegrationConnectionAction[];
89
99
  /** Empty-state message when the catalog hasn't loaded any providers. */
90
100
  emptyCatalogLabel?: string;
91
101
  /**
@@ -104,7 +114,7 @@ interface IntegrationsPanelProps {
104
114
  skeletonCount?: number;
105
115
  className?: string;
106
116
  }
107
- export declare function IntegrationsPanel({ catalog, connections, healthByConnectionId, isLoading, error, onConnect, onDisconnect, getManageHref, onManage, emptyCatalogLabel, featuredIds, defaultSort, skeletonCount, className }: IntegrationsPanelProps): React$1.JSX.Element;
117
+ export declare function IntegrationsPanel({ catalog, connections, healthByConnectionId, isLoading, error, onConnect, onDisconnect, getManageHref, onManage, getConnectionContext, getConnectionActions, emptyCatalogLabel, featuredIds, defaultSort, skeletonCount, className }: IntegrationsPanelProps): React$1.JSX.Element;
108
118
  //#endregion
109
119
  //#region src/integrations/use-integrations.d.ts
110
120
  /**
@@ -188,4 +198,4 @@ interface ProviderIconProps {
188
198
  */
189
199
  export declare function ProviderIcon({ id, iconUrl, displayName, size, className }: ProviderIconProps): React$1.JSX.Element;
190
200
  //#endregion
191
- export type { ConnectInput, IntegrationConnection, IntegrationConnector, IntegrationHealth, IntegrationProvider, IntegrationSort, IntegrationsPanelProps, ProviderIconProps, UseIntegrationsOptions, UseIntegrationsResult };
201
+ export type { ConnectInput, IntegrationConnection, IntegrationConnectionAction, IntegrationConnector, IntegrationHealth, IntegrationProvider, IntegrationSort, IntegrationsPanelProps, ProviderIconProps, UseIntegrationsOptions, UseIntegrationsResult };
@@ -118,7 +118,21 @@ function displayNameOf(provider) {
118
118
  function matchesQuery(provider, q) {
119
119
  return `${displayNameOf(provider)} ${provider.providerId} ${provider.description ?? ""}`.toLowerCase().includes(q);
120
120
  }
121
- function IntegrationsPanel({ catalog, connections, healthByConnectionId, isLoading, error, onConnect, onDisconnect, getManageHref, onManage, emptyCatalogLabel = "No integrations available yet.", featuredIds = DEFAULT_FEATURED_IDS, defaultSort = "featured", skeletonCount = DEFAULT_SKELETON_COUNT, className }) {
121
+ function IntegrationsPanel({ catalog, connections, healthByConnectionId, isLoading, error, onConnect, onDisconnect, getManageHref, onManage, getConnectionContext, getConnectionActions, emptyCatalogLabel = "No integrations available yet.", featuredIds = DEFAULT_FEATURED_IDS, defaultSort = "featured", skeletonCount = DEFAULT_SKELETON_COUNT, className }) {
122
+ const tileBoxClass = cn(TILE_BOX_CLASS, getConnectionContext && "w-full min-h-[136px]");
123
+ const [actionError, setActionError] = React$1.useState(null);
124
+ const [pendingAction, setPendingAction] = React$1.useState(false);
125
+ const runConnectionAction = async (action) => {
126
+ setActionError(null);
127
+ setPendingAction(true);
128
+ try {
129
+ await action.onSelect();
130
+ } catch (error) {
131
+ setActionError(error instanceof Error ? error.message : "Could not update the connection.");
132
+ } finally {
133
+ setPendingAction(false);
134
+ }
135
+ };
122
136
  const [query, setQuery] = React$1.useState("");
123
137
  const [sort, setSort] = React$1.useState(defaultSort);
124
138
  const [disconnectTarget, setDisconnectTarget] = React$1.useState(null);
@@ -213,7 +227,7 @@ function IntegrationsPanel({ catalog, connections, healthByConnectionId, isLoadi
213
227
  className: TILE_GRID_CLASS,
214
228
  children: Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ jsxs("div", {
215
229
  "aria-hidden": true,
216
- className: cn(TILE_BOX_CLASS, "animate-pulse border-border bg-muted/40"),
230
+ className: cn(tileBoxClass, "animate-pulse border-border bg-muted/40"),
217
231
  children: [/* @__PURE__ */ jsx("div", {
218
232
  className: "shrink-0 rounded-2xl bg-muted",
219
233
  style: {
@@ -243,6 +257,11 @@ function IntegrationsPanel({ catalog, connections, healthByConnectionId, isLoadi
243
257
  sort,
244
258
  onSortChange: setSort
245
259
  }),
260
+ actionError ? /* @__PURE__ */ jsx("p", {
261
+ role: "alert",
262
+ className: "text-sm text-destructive",
263
+ children: actionError
264
+ }) : null,
246
265
  connectError ? /* @__PURE__ */ jsx("div", {
247
266
  role: "alert",
248
267
  "data-testid": "integration-connect-error",
@@ -259,13 +278,15 @@ function IntegrationsPanel({ catalog, connections, healthByConnectionId, isLoadi
259
278
  const live = connectionIndex.get(`${provider.providerId}:${connectorId}`);
260
279
  const name = displayNameOf(provider);
261
280
  if (Boolean(live) && live) {
281
+ const connectionContext = getConnectionContext?.(live);
282
+ const connectionActions = getConnectionActions?.(live) ?? [];
262
283
  const manageHref = getManageHref?.(live);
263
284
  const canManage = Boolean(manageHref) || Boolean(onManage);
264
285
  return /* @__PURE__ */ jsxs("div", {
265
286
  "data-testid": `integration-${provider.providerId}`,
266
287
  "data-connected": "true",
267
288
  title: live.accountDisplay ? `${name} — ${live.accountDisplay}` : name,
268
- className: cn(TILE_BOX_CLASS, "group relative", "border-[var(--surface-success-border)] bg-[var(--surface-success-bg)]"),
289
+ className: cn(tileBoxClass, "group relative", "border-[var(--surface-success-border)] bg-[var(--surface-success-bg)]"),
269
290
  children: [
270
291
  manageHref ? /* @__PURE__ */ jsx("a", {
271
292
  href: manageHref,
@@ -302,6 +323,11 @@ function IntegrationsPanel({ catalog, connections, healthByConnectionId, isLoadi
302
323
  }) : null]
303
324
  })]
304
325
  }),
326
+ connectionContext ? /* @__PURE__ */ jsx("span", {
327
+ className: "pointer-events-none w-full truncate text-[11px] leading-4 text-muted-foreground",
328
+ title: connectionContext,
329
+ children: connectionContext
330
+ }) : null,
305
331
  /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
306
332
  asChild: true,
307
333
  children: /* @__PURE__ */ jsx("button", {
@@ -334,7 +360,14 @@ function IntegrationsPanel({ catalog, connections, healthByConnectionId, isLoadi
334
360
  }),
335
361
  children: [/* @__PURE__ */ jsx(ExternalLink, { className: "mr-2 h-4 w-4" }), " Manage"]
336
362
  }) : null,
337
- canManage ? /* @__PURE__ */ jsx(DropdownMenuSeparator, {}) : null,
363
+ connectionActions.map((action) => /* @__PURE__ */ jsx(DropdownMenuItem, {
364
+ disabled: action.disabled || pendingAction,
365
+ onSelect: () => {
366
+ runConnectionAction(action);
367
+ },
368
+ children: action.label
369
+ }, action.id)),
370
+ canManage || connectionActions.length > 0 ? /* @__PURE__ */ jsx(DropdownMenuSeparator, {}) : null,
338
371
  /* @__PURE__ */ jsxs(DropdownMenuItem, {
339
372
  "data-testid": `disconnect-${provider.providerId}`,
340
373
  className: "text-destructive focus:text-destructive",
@@ -364,7 +397,7 @@ function IntegrationsPanel({ catalog, connections, healthByConnectionId, isLoadi
364
397
  });
365
398
  },
366
399
  title: provider.description ? provider.description : `Connect ${name}`,
367
- className: cn(TILE_BOX_CLASS, "group border-border bg-card transition-all", "hover:border-[var(--border-strong)] hover:bg-accent/40 hover:shadow-sm", focusRing),
400
+ className: cn(tileBoxClass, "group border-border bg-card transition-all", "hover:border-[var(--border-strong)] hover:bg-accent/40 hover:shadow-sm", focusRing),
368
401
  children: [/* @__PURE__ */ jsx(ProviderIcon, {
369
402
  id: provider.providerId,
370
403
  iconUrl: provider.iconUrl,
package/dist/styles.css CHANGED
@@ -1043,6 +1043,9 @@
1043
1043
  .min-h-\[120px\] {
1044
1044
  min-height: 120px;
1045
1045
  }
1046
+ .min-h-\[136px\] {
1047
+ min-height: 136px;
1048
+ }
1046
1049
  .min-h-\[160px\] {
1047
1050
  min-height: 160px;
1048
1051
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/sandbox-ui",
3
- "version": "0.116.5",
3
+ "version": "0.116.6",
4
4
  "description": "Unified UI component library for Tangle Sandbox — primitives, chat, dashboard, terminal, editor, and workspace components",
5
5
  "repository": {
6
6
  "type": "git",