import {type ReactElement} from 'react' import {View} from 'react-native' import {type ComAtprotoServerDescribeServer} from '@atproto/api' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {webLinks} from '#/lib/constants' import {useGate} from '#/lib/statsig/statsig' import {atoms as a, useTheme} from '#/alf' import {Admonition} from '#/components/Admonition' import {InlineLinkText} from '#/components/Link' import {Text} from '#/components/Typography' function CommunityGuidelinesNotice({}: {}) { const {_} = useLingui() const gate = useGate() if (gate('disable_onboarding_policy_update_notice')) return null return ( You also agree to{' '} Bluesky’s Community Guidelines . An{' '} updated version of our Community Guidelines {' '} will take effect on October 15th. ) } export const Policies = ({ serviceDescription, needsGuardian, under13, }: { serviceDescription: ComAtprotoServerDescribeServer.OutputSchema needsGuardian: boolean under13: boolean }) => { const t = useTheme() const {_} = useLingui() if (!serviceDescription) { return } const tos = validWebLink(serviceDescription.links?.termsOfService) const pp = validWebLink(serviceDescription.links?.privacyPolicy) if (!tos && !pp) { return ( This service has not provided terms of service or a privacy policy. ) } let els: ReactElement if (tos && pp) { els = ( By creating an account you agree to the{' '} Terms of Service {' '} and{' '} Privacy Policy . ) } else if (tos) { els = ( By creating an account you agree to the{' '} Terms of Service . ) } else if (pp) { els = ( By creating an account you agree to the{' '} Privacy Policy . ) } else { return null } return ( {els ? ( {els} ) : null} {under13 ? ( You must be 13 years of age or older to create an account. ) : needsGuardian ? ( If you are not yet an adult according to the laws of your country, your parent or legal guardian must read these Terms on your behalf. ) : undefined} ) } function validWebLink(url?: string): string | undefined { return url && (url.startsWith('http://') || url.startsWith('https://')) ? url : undefined }