@tangle-network/sandbox-ui 0.116.7 → 0.116.9

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.
@@ -1,15 +1,11 @@
1
1
  import * as React$1 from "react";
2
+ import { ReactNode } from "react";
2
3
  //#region src/integrations/types.d.ts
3
- /**
4
- * Shapes for the integrations primitives. Mirrors the platform's
5
- * `/v1/integrations/*` response shape so consumers can pipe payloads
6
- * straight through. Defined here (rather than imported from
7
- * `@tangle-network/agent-runtime/platform`) so the UI package stays
8
- * leaf-level — no dependency on the server-side client.
9
- */
4
+ /** Legacy endpoint shapes, retained for useIntegrations and IntegrationsPanel. */
10
5
  interface IntegrationConnection {
11
6
  id: string;
12
7
  providerId: string;
8
+ /** Absent on provider-keyed hubs. */
13
9
  connectorId?: string;
14
10
  status: "connected" | "pending" | "revoked" | "expired" | (string & {});
15
11
  grantedScopes?: string[];
@@ -27,15 +23,10 @@ interface IntegrationConnector {
27
23
  interface IntegrationProvider {
28
24
  providerId: string;
29
25
  displayName?: string;
30
- /** The hub catalog's name for the provider ("GitHub", "Google Sheets"). */
31
26
  title?: string;
32
27
  description?: string;
33
28
  iconUrl?: string;
34
29
  connectors?: IntegrationConnector[];
35
- /**
36
- * True when the platform can currently receive this provider's events.
37
- * Absent means the platform predates inbound-readiness discovery.
38
- */
39
30
  eventIngressConfigured?: boolean;
40
31
  }
41
32
  interface IntegrationHealth {
@@ -44,8 +35,6 @@ interface IntegrationHealth {
44
35
  checkedAt?: string;
45
36
  message?: string;
46
37
  }
47
- //#endregion
48
- //#region src/integrations/integrations-panel.d.ts
49
38
  type IntegrationSort = "featured" | "alpha";
50
39
  interface IntegrationConnectionAction {
51
40
  id: string;
@@ -59,63 +48,214 @@ interface IntegrationsPanelProps {
59
48
  healthByConnectionId?: Record<string, IntegrationHealth>;
60
49
  isLoading?: boolean;
61
50
  error?: Error | null;
62
- /**
63
- * Invoked when the user clicks an unconnected provider tile. The consumer
64
- * should call its data hook's `connect(...)` action.
65
- */
66
51
  onConnect: (input: {
67
52
  providerId: string;
68
53
  connectorId: string;
69
54
  }) => void | Promise<void>;
70
- /**
71
- * Invoked when the user confirms disconnecting a live connection from the
72
- * disconnect control on a connected tile. May return a promise; the
73
- * confirmation dialog shows a loading state until it settles and surfaces a
74
- * thrown error inline.
75
- */
55
+ /** Confirmation remains open on rejection; cancellation remains available in flight. */
76
56
  onDisconnect: (connectionId: string) => void | Promise<void>;
77
- /**
78
- * Resolver for a connected app's management page URL. When it returns a URL,
79
- * the connected tile's body and the overflow menu's "Manage" item become a
80
- * real link opened in a new tab (so cmd/middle-click and "open in new tab"
81
- * work). Return undefined to omit Manage for a given connection. Preferred
82
- * over `onManage` — only fall back to the callback when the URL must be minted
83
- * imperatively on click (e.g. a one-time token).
84
- */
57
+ /** Preferred over onManage. Legacy links retain their new-window behavior. */
85
58
  getManageHref?: (connection: IntegrationConnection) => string | undefined;
86
- /**
87
- * Imperative fallback for opening a connected app's management page, used only
88
- * when `getManageHref` is not supplied (or returns undefined). The consumer is
89
- * responsible for opening the page (e.g. `window.open(...)`).
90
- */
91
59
  onManage?: (input: {
92
60
  connectionId: string;
93
61
  providerId: string;
94
62
  }) => void | Promise<void>;
95
- /** Consumer-owned access context shown below the connected account. */
96
63
  getConnectionContext?: (connection: IntegrationConnection) => string | undefined;
97
- /** Additional authorized actions in the connected card menu. */
98
64
  getConnectionActions?: (connection: IntegrationConnection) => IntegrationConnectionAction[];
99
- /** Empty-state message when the catalog hasn't loaded any providers. */
100
65
  emptyCatalogLabel?: string;
101
- /**
102
- * Provider ids surfaced first (in this order) before the rest are sorted
103
- * alphabetically. Matching is normalized (case / separators ignored).
104
- * Defaults to a curated list of common GTM/work providers.
105
- */
66
+ /** Normalized provider IDs, in order, before the alphabetic tail. */
106
67
  featuredIds?: string[];
107
- /** Initial sort mode. Defaults to "featured". */
108
68
  defaultSort?: IntegrationSort;
109
- /**
110
- * Tiles the loading skeleton draws. A skeleton exists to reserve the space
111
- * the real content will take, so pass the catalog size you expect when the
112
- * consumer knows it; the default fills two rows at the widest breakpoint.
113
- */
114
69
  skeletonCount?: number;
115
70
  className?: string;
116
71
  }
72
+ /** Display-only contracts. No Hub SDK, credentials, grants, or policy inference. */
73
+ type IntegrationTone = "neutral" | "success" | "warning" | "error";
74
+ interface IntegrationCapabilities {
75
+ manage?: boolean;
76
+ disconnect?: boolean;
77
+ test?: boolean;
78
+ editPermissions?: boolean;
79
+ resetPermissions?: boolean;
80
+ }
81
+ interface IntegrationDisplayAction {
82
+ id: string;
83
+ label: string;
84
+ disabled?: boolean;
85
+ /** The owner handles asynchronous outcomes and supplies updated display state. */
86
+ onSelect: () => void;
87
+ }
88
+ interface IntegrationDisplayConnection {
89
+ id: string;
90
+ accountDisplay?: string | null;
91
+ statusLabel: string;
92
+ statusTone?: IntegrationTone;
93
+ /** Already formatted by the owner (last used, access context, etc.). */
94
+ detail?: string;
95
+ capabilities: IntegrationCapabilities;
96
+ /** Consumer-owned destination; the library never builds a Platform URL. */
97
+ manageHref?: string;
98
+ /** Only needed by the legacy panel's existing link contract. */
99
+ manageInNewWindow?: boolean;
100
+ actions?: readonly IntegrationDisplayAction[];
101
+ }
102
+ interface IntegrationDisplayProvider {
103
+ providerId: string;
104
+ title: string;
105
+ description?: string;
106
+ iconUrl?: string;
107
+ category?: string | null;
108
+ /** Optional local provider-information destination. */
109
+ to?: string;
110
+ }
111
+ interface IntegrationsProviderRow extends IntegrationDisplayProvider {
112
+ kind: "provider";
113
+ connections: readonly IntegrationDisplayConnection[];
114
+ /** Explicit selection. null never selects an arbitrary account. */
115
+ selectedConnectionId: string | null;
116
+ canConnect: boolean;
117
+ /** A display hint for the owner's connect callback, not an auth implementation. */
118
+ authKind?: string | null;
119
+ }
120
+ interface IntegrationsAppRow extends IntegrationDisplayProvider {
121
+ kind: "app";
122
+ logoProviderId: string;
123
+ installedCount: number;
124
+ to: string;
125
+ }
126
+ type IntegrationsCatalogRow = IntegrationsProviderRow | IntegrationsAppRow;
127
+ interface IntegrationsCatalogProps {
128
+ /** Order belongs to the owner; filtering does not reorder active accounts. */
129
+ rows: readonly IntegrationsCatalogRow[];
130
+ query: string;
131
+ onQueryChange: (query: string) => void;
132
+ categoryFilter?: string;
133
+ onCategoryFilterChange?: (category: string) => void;
134
+ sort?: IntegrationSort;
135
+ onSortChange?: (sort: IntegrationSort) => void;
136
+ onSelectConnection: (providerId: string, connectionId: string | null) => void;
137
+ onConnect?: (row: IntegrationsProviderRow) => void;
138
+ onManage?: (connection: IntegrationDisplayConnection, row: IntegrationsProviderRow) => void;
139
+ onDisconnect?: (connection: IntegrationDisplayConnection, row: IntegrationsProviderRow) => void;
140
+ onRequestIntegration?: (prefill: string) => void;
141
+ onRetry?: () => void;
142
+ loading?: boolean;
143
+ error?: string | null;
144
+ actionError?: string | null;
145
+ connectError?: string | null;
146
+ busyProviderId?: string | null;
147
+ /** Compact facade reserves its context line before any account has loaded. */
148
+ reserveConnectionContext?: boolean;
149
+ skeletonCount?: number;
150
+ emptyCatalogLabel?: string;
151
+ title?: string;
152
+ description?: string;
153
+ /** One renderer; tiles preserves the public panel's compact geometry. */
154
+ layout?: "cards" | "tiles";
155
+ className?: string;
156
+ }
157
+ interface IntegrationPermissionOption {
158
+ value: string;
159
+ label: string;
160
+ }
161
+ interface IntegrationPermissionDisplay {
162
+ actionPath: string;
163
+ title: string;
164
+ riskLabel: string;
165
+ riskTone?: IntegrationTone;
166
+ /** Supplied effective decision; null remains unknown, never Allow/Ask. */
167
+ decision: string | null;
168
+ decisionOptions: readonly IntegrationPermissionOption[];
169
+ sourceLabel: string;
170
+ canReset?: boolean;
171
+ disabled?: boolean;
172
+ }
173
+ interface IntegrationPermissionGroup {
174
+ id: string;
175
+ title: string;
176
+ description?: string;
177
+ collapsed?: boolean;
178
+ rows: readonly IntegrationPermissionDisplay[];
179
+ }
180
+ interface IntegrationConnectionDetails {
181
+ loading?: boolean;
182
+ busy?: boolean;
183
+ error?: string | null;
184
+ testResult?: {
185
+ message: string;
186
+ tone: IntegrationTone;
187
+ };
188
+ permissionGroups?: readonly IntegrationPermissionGroup[];
189
+ }
190
+ interface IntegrationConnectionDetailProps {
191
+ provider: IntegrationDisplayProvider;
192
+ connections: readonly IntegrationDisplayConnection[];
193
+ selectedConnectionId: string | null;
194
+ onSelectConnection: (connectionId: string | null) => void;
195
+ /** Keying all outcomes by ID prevents another account's policy flashing on selection. */
196
+ detailsByConnectionId: Readonly<Record<string, IntegrationConnectionDetails | undefined>>;
197
+ loading?: boolean;
198
+ error?: string | null;
199
+ backHref?: string;
200
+ description?: string;
201
+ onRetry?: (connectionId: string | null) => void;
202
+ onTestConnection?: (connectionId: string) => void;
203
+ onDisconnect?: (connectionId: string) => void;
204
+ onDecisionChange?: (connectionId: string, actionPath: string, decision: string) => void;
205
+ onResetDecision?: (connectionId: string, actionPath: string) => void;
206
+ className?: string;
207
+ }
208
+ interface IntegrationParameterField {
209
+ key: string;
210
+ label: string;
211
+ description?: string;
212
+ placeholder?: string;
213
+ required?: boolean;
214
+ }
215
+ interface IntegrationConnectDialogProps {
216
+ open: boolean;
217
+ onOpenChange: (open: boolean) => void;
218
+ providerId: string;
219
+ title: string;
220
+ description?: string | null;
221
+ busy?: boolean;
222
+ error?: string | null;
223
+ /** Caller owns validation, requests, failures and closing on success. */
224
+ onSubmit: () => void;
225
+ canSubmit?: boolean;
226
+ /** Provider-specific fields/validation remain in the application. */
227
+ children?: ReactNode;
228
+ }
229
+ interface ApiKeyConnectDialogProps extends IntegrationConnectDialogProps {
230
+ /** Transient controlled input only; never retained by this package. */
231
+ value: string;
232
+ onValueChange: (value: string) => void;
233
+ }
234
+ interface OAuthConnectionParameterDialogProps extends IntegrationConnectDialogProps {
235
+ parameters: readonly IntegrationParameterField[];
236
+ values: Readonly<Record<string, string>>;
237
+ onValueChange: (key: string, value: string) => void;
238
+ }
239
+ //#endregion
240
+ //#region src/integrations/integrations-panel.d.ts
241
+ /** Compatibility facade: legacy effects/sorting, one controlled catalog renderer. */
117
242
  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;
118
243
  //#endregion
244
+ //#region src/integrations/integrations-catalog.d.ts
245
+ export declare function catalogRowActive(row: IntegrationsCatalogRow): boolean;
246
+ /** Platform's catalog presentation, with app-owned state, destinations and effects. */
247
+ export declare function IntegrationsCatalog({ rows, query, onQueryChange, categoryFilter, onCategoryFilterChange, sort, onSortChange, onSelectConnection, onConnect, onManage, onDisconnect, onRequestIntegration, onRetry, loading, error, actionError, connectError, busyProviderId, reserveConnectionContext, skeletonCount, emptyCatalogLabel, title, description, layout, className }: IntegrationsCatalogProps): import("react").JSX.Element;
248
+ //#endregion
249
+ //#region src/integrations/connection-detail.d.ts
250
+ /** Platform's permission layout, without its fetching, defaults or persistence. */
251
+ export declare function IntegrationConnectionDetail({ provider, connections, selectedConnectionId, onSelectConnection, detailsByConnectionId, loading, error, backHref, description, onRetry, onTestConnection, onDisconnect, onDecisionChange, onResetDecision, className }: IntegrationConnectionDetailProps): import("react").JSX.Element;
252
+ //#endregion
253
+ //#region src/integrations/connection-dialogs.d.ts
254
+ /** Key bytes remain in owner-controlled value/onValueChange; no request or storage. */
255
+ export declare function ApiKeyConnectDialog(props: ApiKeyConnectDialogProps): React$1.JSX.Element;
256
+ /** Parameter schema/values and all auth behavior belong to the owner. */
257
+ export declare function OAuthConnectionParameterDialog(props: OAuthConnectionParameterDialogProps): React$1.JSX.Element;
258
+ //#endregion
119
259
  //#region src/integrations/use-integrations.d.ts
120
260
  /**
121
261
  * Endpoint contract expected on the consumer app's server (which
@@ -140,6 +280,8 @@ interface UseIntegrationsOptions {
140
280
  fetchImpl?: typeof fetch;
141
281
  /** Whether the initial load happens automatically on mount. */
142
282
  autoLoad?: boolean;
283
+ /** Refresh on visible focus/visibility return and persisted pageshow. Default: false. */
284
+ refreshOnReturn?: boolean;
143
285
  }
144
286
  interface UseIntegrationsResult {
145
287
  catalog: IntegrationProvider[];
@@ -147,10 +289,11 @@ interface UseIntegrationsResult {
147
289
  healthByConnectionId: Record<string, IntegrationHealth>;
148
290
  isLoading: boolean;
149
291
  error: Error | null;
292
+ /** Coalesces requests with at most one trailing refresh; resolves after the queue drains. */
150
293
  refresh: () => Promise<void>;
151
- /** Kick off OAuth — navigates the window on success. */
294
+ /** Kick off OAuth — navigates on success; rejects with AbortError when its lifetime ends. */
152
295
  connect: (input: ConnectInput) => Promise<void>;
153
- /** Revoke a connection by id; refreshes the connections list. */
296
+ /** Revoke by id and refresh; rejects with AbortError when its lifetime ends. */
154
297
  disconnect: (connectionId: string) => Promise<void>;
155
298
  }
156
299
  interface ConnectInput {
@@ -163,7 +306,7 @@ interface ConnectInput {
163
306
  returnUrl: string;
164
307
  requestedScopes?: string[];
165
308
  }
166
- export declare function useIntegrations({ apiBaseUrl, fetchImpl, autoLoad }: UseIntegrationsOptions): UseIntegrationsResult;
309
+ export declare function useIntegrations({ apiBaseUrl, fetchImpl, autoLoad, refreshOnReturn }: UseIntegrationsOptions): UseIntegrationsResult;
167
310
  //#endregion
168
311
  //#region src/integrations/provider-logo.d.ts
169
312
  /**
@@ -198,4 +341,4 @@ interface ProviderIconProps {
198
341
  */
199
342
  export declare function ProviderIcon({ id, iconUrl, displayName, size, className }: ProviderIconProps): React$1.JSX.Element;
200
343
  //#endregion
201
- export type { ConnectInput, IntegrationConnection, IntegrationConnectionAction, IntegrationConnector, IntegrationHealth, IntegrationProvider, IntegrationSort, IntegrationsPanelProps, ProviderIconProps, UseIntegrationsOptions, UseIntegrationsResult };
344
+ export { ApiKeyConnectDialog as ApiKeyConnectModal, type ApiKeyConnectDialogProps, type ConnectInput, type IntegrationCapabilities, type IntegrationConnectDialogProps, type IntegrationConnection, type IntegrationConnectionAction, type IntegrationConnectionDetailProps, type IntegrationConnectionDetails, type IntegrationConnector, type IntegrationDisplayAction, type IntegrationDisplayConnection, type IntegrationDisplayProvider, type IntegrationHealth, type IntegrationParameterField, type IntegrationPermissionDisplay, type IntegrationPermissionGroup, type IntegrationPermissionOption, type IntegrationProvider, type IntegrationSort, type IntegrationTone, type IntegrationsAppRow, type IntegrationsCatalogProps, type IntegrationsCatalogRow, type IntegrationsPanelProps, type IntegrationsProviderRow, OAuthConnectionParameterDialog as OAuthConnectionParameterModal, type OAuthConnectionParameterDialogProps, type ProviderIconProps, type UseIntegrationsOptions, type UseIntegrationsResult };