Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions packages/compass-web/sandbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useLayoutEffect } from 'react';
import ReactDOM from 'react-dom';
import { resetGlobalCSS, css, Body } from '@mongodb-js/compass-components';
import { CompassWeb } from '../src/index';
import { SandboxConnectionStorageProviver } from '../src/connection-storage';
import { SandboxConnectionStorageProvider } from '../src/connection-storage';
import { sandboxLogger } from './sandbox-logger';
import { sandboxTelemetry } from './sandbox-telemetry';
import { useAtlasProxySignIn } from './sandbox-atlas-sign-in';
Expand Down Expand Up @@ -41,6 +41,9 @@ const App = () => {
? 'web-sandbox-atlas-dev'
: 'web-sandbox-atlas';

const overrideGenAIEnablement =
process.env.COMPASS_WEB_GEN_AI_ENABLEMENT === 'true';

useLayoutEffect(() => {
getMetaEl('csrf-token').setAttribute('content', csrfToken ?? '');
getMetaEl('csrf-time').setAttribute('content', csrfTime ?? '');
Expand All @@ -53,7 +56,7 @@ const App = () => {
const isAtlas = status === 'signed-in';

return (
<SandboxConnectionStorageProviver
<SandboxConnectionStorageProvider
value={isAtlas ? null : sandboxConnectionStorage}
extraConnectionOptions={
isAtlas
Expand All @@ -77,13 +80,18 @@ const App = () => {
enableCreatingNewConnections: !isAtlas,
enableGlobalWrites: isAtlas,
enableRollingIndexes: isAtlas,
enableGenAIFeaturesAtlasProject: isAtlas && overrideGenAIEnablement,
enableGenAISampleDocumentPassingOnAtlasProject:
isAtlas && overrideGenAIEnablement,
enableGenAIFeaturesAtlasOrg: isAtlas && overrideGenAIEnablement,
optInDataExplorerGenAIFeatures: isAtlas && overrideGenAIEnablement,
}}
onTrack={sandboxTelemetry.track}
onDebug={sandboxLogger.debug}
onLog={sandboxLogger.log}
></CompassWeb>
</Body>
</SandboxConnectionStorageProviver>
</SandboxConnectionStorageProvider>
);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/compass-web/src/connection-storage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ const SandboxExtraConnectionOptionsContext = React.createContext<
* non-Atlas deployment
* @internal
*/
export const SandboxConnectionStorageProviver = ({
export const SandboxConnectionStorageProvider = ({
value,
extraConnectionOptions,
children,
Expand Down
2 changes: 2 additions & 0 deletions packages/compass-web/src/entrypoint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import AppRegistry, {
AppRegistryProvider,
GlobalAppRegistryProvider,
} from 'hadron-app-registry';
import { UUID } from 'bson';
import type { ConnectionInfo } from '@mongodb-js/compass-connections/provider';
import { useConnectionActions } from '@mongodb-js/compass-connections/provider';
import { CompassInstanceStorePlugin } from '@mongodb-js/compass-app-stores';
Expand Down Expand Up @@ -284,6 +285,7 @@ const CompassWeb = ({
enableCreatingNewConnections: false,
enableGlobalWrites: false,
optInDataExplorerGenAIFeatures: false,
telemetryAnonymousId: new UUID().toString(),
...initialPreferences,
})
);
Expand Down
Loading