diff options
| author | Tommaso Sciortino <[email protected]> | 2025-06-27 12:07:38 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-27 19:07:38 +0000 |
| commit | a2a46c7c6700edc6840faa2675d92695d2d3104d (patch) | |
| tree | e0a10e0e5f83f9c55d8a4b459077822626937405 /packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx | |
| parent | 4fbffdf617b2fb87c1b663391fbe488c5c81beb8 (diff) | |
Add privacy notice slash command (#2059)
Diffstat (limited to 'packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx')
| -rw-r--r-- | packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx b/packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx new file mode 100644 index 00000000..f9341bf9 --- /dev/null +++ b/packages/cli/src/ui/privacy/CloudFreePrivacyNotice.tsx @@ -0,0 +1,104 @@ +/** + * @license + * Copyright 2025 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +import { Box, Newline, Text } from 'ink'; +import { RadioButtonSelect } from '../components/shared/RadioButtonSelect.js'; +import { usePrivacySettings } from '../hooks/usePrivacySettings.js'; +import { CloudPaidPrivacyNotice } from './CloudPaidPrivacyNotice.js'; +import { Config } from '@google/gemini-cli-core'; +import { Colors } from '../colors.js'; + +interface CloudFreePrivacyNoticeProps { + config: Config; + onExit: () => void; +} + +export const CloudFreePrivacyNotice = ({ + config, + onExit, +}: CloudFreePrivacyNoticeProps) => { + const { privacyState, updateDataCollectionOptIn } = + usePrivacySettings(config); + + if (privacyState.isLoading) { + return <Text color={Colors.Gray}>Loading...</Text>; + } + + if (privacyState.error) { + return ( + <Text color={Colors.AccentRed}> + Error loading Opt-in settings: {privacyState.error} + </Text> + ); + } + + if (privacyState.isFreeTier === false) { + return <CloudPaidPrivacyNotice onExit={onExit} />; + } + + const items = [ + { label: 'Yes', value: true }, + { label: 'No', value: false }, + ]; + + return ( + <Box flexDirection="column" marginY={1}> + <Text bold color={Colors.AccentPurple}> + Gemini Code Assist for Individuals Privacy Notice + </Text> + <Newline /> + <Text> + This notice and our Privacy Policy + <Text color={Colors.AccentBlue}>[1]</Text> describe how Gemini Code + Assist handles your data. Please read them carefully. + </Text> + <Newline /> + <Text> + When you use Gemini Code Assist for individuals with Gemini CLI, Google + collects your prompts, related code, generated output, code edits, + related feature usage information, and your feedback to provide, + improve, and develop Google products and services and machine learning + technologies. + </Text> + <Newline /> + <Text> + To help with quality and improve our products (such as generative + machine-learning models), human reviewers may read, annotate, and + process the data collected above. We take steps to protect your privacy + as part of this process. This includes disconnecting the data from your + Google Account before reviewers see or annotate it, and storing those + disconnected copies for up to 18 months. Please don't submit + confidential information or any data you wouldn't want a reviewer + to see or Google to use to improve our products, services and + machine-learning technologies. + </Text> + <Newline /> + <Box flexDirection="column"> + <Text> + Allow Google to use this data to develop and improve our products? + </Text> + <RadioButtonSelect + items={items} + initialIndex={privacyState.dataCollectionOptIn ? 0 : 1} + onSelect={(value) => { + updateDataCollectionOptIn(value); + // Only exit if there was no error. + if (!privacyState.error) { + onExit(); + } + }} + /> + </Box> + <Newline /> + <Text> + <Text color={Colors.AccentBlue}>[1]</Text>{' '} + https://policies.google.com/privacy + </Text> + <Newline /> + <Text color={Colors.Gray}>Press Enter to choose an option and exit.</Text> + </Box> + ); +}; |
