From 6f6416df2fc8906239bee933c7b534262a640fd8 Mon Sep 17 00:00:00 2001 From: Finnian Jacobson-Schulte <140328381+finnian0826@users.noreply.github.com> Date: Sat, 7 Dec 2024 06:59:15 +1300 Subject: [PATCH] chore(cleanup): Remove onboarding_terms_and_conditions experiment (#6301) ### Description Test experiment added to enum/constants so that CI can pass. With those being empty tests would fail, and looking at git history could not find a time when it was empty. This seemed like the easiest solution, and added a comment explaining. ### Test plan CI ### Related issues - Part of ACT-1443 ### Backwards compatibility Yes ### Network scalability If a new NetworkId and/or Network are added in the future, the changes in this PR will: - N/A --- locales/base/translation.json | 14 +- .../registration/RegulatoryTerms.test.tsx | 90 +++----- .../registration/RegulatoryTerms.tsx | 94 +------- src/onboarding/welcome/Welcome.test.tsx | 203 ++---------------- src/onboarding/welcome/Welcome.tsx | 72 +------ src/statsig/constants.ts | 7 +- src/statsig/types.ts | 2 +- 7 files changed, 72 insertions(+), 410 deletions(-) diff --git a/locales/base/translation.json b/locales/base/translation.json index a32a50f5450..cba0690cbba 100644 --- a/locales/base/translation.json +++ b/locales/base/translation.json @@ -729,17 +729,6 @@ "goldDisclaimer": "When you create an \"account\" with {{appName}} you are creating a digital wallet to which only you hold the keys. No other person or entity, including {{appName}}, can recover your key, change or undo transactions, or recover lost funds. Be aware that digital assets are part of a new asset class and present a risk of financial loss. Carefully consider your financial circumstances and tolerance for financial risk before purchasing any digital asset.", "goldDisclaimerWithPoints": "When you create an \"account\" with {{appName}} you are creating a digital wallet to which only you hold the keys. No other person or entity, including {{appName}}, can recover your key, change or undo transactions, or recover lost funds. {{appName}} grants tokenized loyalty rewards (\"Points\") to Users for engaging in certain in-app activities. Points are on-chain, non-transferable, and non-redeemable collectibles. No guarantees are made about Points availability or value. Be aware that digital assets are part of a new asset class and present a risk of financial loss. Carefully consider your financial circumstances and tolerance for financial risk before purchasing any digital asset." }, - "termsColloquial": { - "title": "Let’s start by creating your wallet", - "privacyHeading": "Your Info & Privacy:", - "privacy1": "We gather usage data which helps us improve the app and security. The type of information we collect, how we use it and your rights related to that information can all be seen in our <0>Privacy Policy.", - "privacy2": "If you decide to link your phone number, we will store an encrypted copy of it.", - "privacy3": "If you decide to connect your contacts, we use their names, numbers, and profile pictures to make it easier to find them.", - "walletHeading": "Your Digital Wallet with {{appName}}:", - "wallet1": "You’re about to create a digital wallet. Only you have the key to your wallet. We cannot recover your key or your assets if you lose your key. We also cannot reverse actions taken through {{appName}} on blockchains.", - "wallet2": "Digital assets, the assets with which you will interact with {{appName}}, come with unique risks. By using {{appName}}, you accept these risks and take responsibility for them. Please consider your finances and risk tolerance before making choices.", - "fullTerms": "Read our full <0>Terms & Conditions" - }, "fullNameOrPsuedonym": "Full name or pseudonym", "namePlaceholder": "ex. name", "nameAndPicGuideCopyTitle": "What’s your name?", @@ -848,8 +837,7 @@ "hasWallet": "I already have a wallet", "hasWalletV1_88": "I have a wallet", "header": "Welcome to {{appName}}! Let's create your crypto wallet.", - "getStarted": "Get Started", - "agreeToTerms": "By creating a wallet you agree to our <0>Terms and Conditions" + "getStarted": "Get Started" }, "accessContacts": { "disclosure": { diff --git a/src/onboarding/registration/RegulatoryTerms.test.tsx b/src/onboarding/registration/RegulatoryTerms.test.tsx index ac6c73f489f..646d63e595b 100644 --- a/src/onboarding/registration/RegulatoryTerms.test.tsx +++ b/src/onboarding/registration/RegulatoryTerms.test.tsx @@ -6,7 +6,7 @@ import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { RegulatoryTerms as RegulatoryTermsClass } from 'src/onboarding/registration/RegulatoryTerms' import { firstOnboardingScreen } from 'src/onboarding/steps' -import { getDynamicConfigParams, getExperimentParams } from 'src/statsig' +import { getDynamicConfigParams } from 'src/statsig' import { createMockStore, getMockI18nProps } from 'test/utils' jest.mock('src/onboarding/steps') @@ -23,8 +23,7 @@ describe('RegulatoryTermsScreen', () => { }, }) }) - it('renders correct components for control', () => { - jest.mocked(getExperimentParams).mockReturnValue({ variant: 'control' }) + it('renders correct components', () => { const store = createMockStore({}) const { getByTestId, queryByTestId } = render( @@ -40,60 +39,37 @@ describe('RegulatoryTermsScreen', () => { expect(queryByTestId('colloquialTermsSectionList')).toBeFalsy() }) - it('renders correct components for colloquial_terms', () => { - jest.mocked(getExperimentParams).mockReturnValue({ variant: 'colloquial_terms' }) - const store = createMockStore({}) - const { getByTestId, queryByTestId } = render( - - - - ) + describe('when accept button is pressed', () => { + it('stores that info', async () => { + const store = createMockStore({}) + const wrapper = render( + + + + ) + fireEvent.press(wrapper.getByTestId('AcceptTermsButton')) + expect(acceptTerms).toHaveBeenCalled() + }) + it('navigates to PincodeSet', () => { + const store = createMockStore({}) + jest.mocked(firstOnboardingScreen).mockReturnValue(Screens.PincodeSet) - expect(getByTestId('colloquialTermsSectionList')).toBeTruthy() - expect(queryByTestId('scrollView')).toBeFalsy() + const wrapper = render( + + + + ) + fireEvent.press(wrapper.getByTestId('AcceptTermsButton')) + expect(firstOnboardingScreen).toHaveBeenCalled() + expect(navigate).toHaveBeenCalledWith(Screens.PincodeSet) + }) }) - - describe.each([{ variant: 'control' }, { variant: 'colloquial_terms' }])( - 'when accept button is pressed ($variant)', - ({ variant }) => { - beforeAll(() => { - jest.mocked(getExperimentParams).mockReturnValue({ variant }) - }) - it('stores that info', async () => { - const store = createMockStore({}) - const wrapper = render( - - - - ) - fireEvent.press(wrapper.getByTestId('AcceptTermsButton')) - expect(acceptTerms).toHaveBeenCalled() - }) - it('navigates to PincodeSet', () => { - const store = createMockStore({}) - jest.mocked(firstOnboardingScreen).mockReturnValue(Screens.PincodeSet) - - const wrapper = render( - - - - ) - fireEvent.press(wrapper.getByTestId('AcceptTermsButton')) - expect(firstOnboardingScreen).toHaveBeenCalled() - expect(navigate).toHaveBeenCalledWith(Screens.PincodeSet) - }) - } - ) }) diff --git a/src/onboarding/registration/RegulatoryTerms.tsx b/src/onboarding/registration/RegulatoryTerms.tsx index 8654d1c8cd1..3beb13a6c26 100644 --- a/src/onboarding/registration/RegulatoryTerms.tsx +++ b/src/onboarding/registration/RegulatoryTerms.tsx @@ -1,6 +1,6 @@ import * as React from 'react' import { Trans, WithTranslation } from 'react-i18next' -import { Platform, ScrollView, SectionList, StyleSheet, Text, View } from 'react-native' +import { Platform, ScrollView, StyleSheet, Text } from 'react-native' import { SafeAreaInsetsContext, SafeAreaView } from 'react-native-safe-area-context' import { connect } from 'react-redux' import { acceptTerms } from 'src/account/actions' @@ -16,12 +16,11 @@ import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { firstOnboardingScreen } from 'src/onboarding/steps' import { RootState } from 'src/redux/reducers' -import { getDynamicConfigParams, getExperimentParams, getFeatureGate } from 'src/statsig' -import { DynamicConfigs, ExperimentConfigs } from 'src/statsig/constants' -import { StatsigDynamicConfigs, StatsigExperiments, StatsigFeatureGates } from 'src/statsig/types' +import { getDynamicConfigParams, getFeatureGate } from 'src/statsig' +import { DynamicConfigs } from 'src/statsig/constants' +import { StatsigDynamicConfigs, StatsigFeatureGates } from 'src/statsig/types' import Colors from 'src/styles/colors' import { typeScale } from 'src/styles/fonts' -import { Spacing } from 'src/styles/styles' import { navigateToURI } from 'src/utils/linking' const MARGIN = 24 @@ -107,71 +106,9 @@ export class RegulatoryTerms extends React.Component { ) } - renderColloquialTerms() { - const { t } = this.props - - return ( - { - return ( - - {'\u2022'} - {item.onPress ? ( - - - - - - ) : ( - - - - )} - - ) - }} - renderSectionHeader={({ section: { title } }) => ( - {title} - )} - ListHeaderComponent={ - {t('termsColloquial.title')} - } - ListFooterComponent={ - - - - - - } - stickySectionHeadersEnabled={false} - /> - ) - } - render() { const { t } = this.props - const { variant } = getExperimentParams( - ExperimentConfigs[StatsigExperiments.ONBOARDING_TERMS_AND_CONDITIONS] - ) - return ( { edges={Platform.select({ ios: ['bottom', 'left', 'right'] })} > - {variant === 'colloquial_terms' ? this.renderColloquialTerms() : this.renderTerms()} + {this.renderTerms()} {(insets) => (