@@ -3,10 +3,14 @@ import AppRegistry, {
33 AppRegistryProvider ,
44 GlobalAppRegistryProvider ,
55} from '@mongodb-js/compass-app-registry' ;
6- import type { ConnectionInfo } from '@mongodb-js/compass-connections/provider ' ;
6+ import type { AtlasClusterMetadata } from '@mongodb-js/connection-info ' ;
77import { useConnectionActions } from '@mongodb-js/compass-connections/provider' ;
88import { CompassInstanceStorePlugin } from '@mongodb-js/compass-app-stores' ;
9- import type { OpenWorkspaceOptions } from '@mongodb-js/compass-workspaces' ;
9+ import type {
10+ CollectionTabInfo ,
11+ OpenWorkspaceOptions ,
12+ WorkspaceTab ,
13+ } from '@mongodb-js/compass-workspaces' ;
1014import WorkspacesPlugin , {
1115 WorkspacesProvider ,
1216} from '@mongodb-js/compass-workspaces' ;
@@ -63,6 +67,7 @@ import {
6367 CompassAssistantProvider ,
6468} from '@mongodb-js/compass-assistant' ;
6569
70+ /** @public */
6671export type TrackFunction = (
6772 event : string ,
6873 properties : Record < string , any >
@@ -91,7 +96,8 @@ type CompassWorkspaceProps = Pick<
9196 'onOpenConnectViaModal'
9297 > ;
9398
94- type CompassWebProps = {
99+ /** @public */
100+ export type CompassWebProps = {
95101 /**
96102 * App name to be passed with the connection string when connection to a
97103 * cluster (default: "Compass Web")
@@ -131,9 +137,12 @@ type CompassWebProps = {
131137 * communicate current workspace back to the parent component for example to
132138 * sync router with the current active workspace
133139 */
134- onActiveWorkspaceTabChange : React . ComponentProps <
135- typeof WorkspacesPlugin
136- > [ 'onActiveWorkspaceTabChange' ] ;
140+ onActiveWorkspaceTabChange < WS extends WorkspaceTab > (
141+ ws : WS | null ,
142+ collectionInfo : WS extends { type : 'Collection' }
143+ ? CollectionTabInfo | null
144+ : never
145+ ) : void ;
137146
138147 /**
139148 * Set of initial preferences to override default values
@@ -159,9 +168,7 @@ type CompassWebProps = {
159168 * when the action is selected from the sidebar actions. Should be used to
160169 * show the Atlas Cloud "Connect" modal
161170 */
162- onOpenConnectViaModal ?: (
163- atlasMetadata : ConnectionInfo [ 'atlasMetadata' ]
164- ) => void ;
171+ onOpenConnectViaModal ?: ( atlasMetadata ?: AtlasClusterMetadata ) => void ;
165172
166173 /**
167174 * Callback prop called when connections fail to load
@@ -259,6 +266,7 @@ const connectedContainerStyles = css({
259266 display : 'flex' ,
260267} ) ;
261268
269+ /** @public */
262270const CompassWeb = ( {
263271 appName,
264272 orgId,
0 commit comments