Skip to content

Commit

Permalink
chore(cleanup): Remove onboarding_terms_and_conditions experiment (#6301
Browse files Browse the repository at this point in the history
)

### 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
  • Loading branch information
finnian0826 authored Dec 6, 2024
1 parent 144241a commit 6f6416d
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 410 deletions.
14 changes: 1 addition & 13 deletions locales/base/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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</0>.",
"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</0>"
},
"fullNameOrPsuedonym": "Full name or pseudonym",
"namePlaceholder": "ex. name",
"nameAndPicGuideCopyTitle": "What’s your name?",
Expand Down Expand Up @@ -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</0>"
"getStarted": "Get Started"
},
"accessContacts": {
"disclosure": {
Expand Down
90 changes: 33 additions & 57 deletions src/onboarding/registration/RegulatoryTerms.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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(
<Provider store={store}>
Expand All @@ -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(
<Provider store={store}>
<RegulatoryTermsClass
{...getMockI18nProps()}
acceptTerms={acceptTerms}
recoveringFromStoreWipe={false}
/>
</Provider>
)
describe('when accept button is pressed', () => {
it('stores that info', async () => {
const store = createMockStore({})
const wrapper = render(
<Provider store={store}>
<RegulatoryTermsClass
{...getMockI18nProps()}
acceptTerms={acceptTerms}
recoveringFromStoreWipe={false}
/>
</Provider>
)
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(
<Provider store={store}>
<RegulatoryTermsClass
{...getMockI18nProps()}
acceptTerms={acceptTerms}
recoveringFromStoreWipe={false}
/>
</Provider>
)
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(
<Provider store={store}>
<RegulatoryTermsClass
{...getMockI18nProps()}
acceptTerms={acceptTerms}
recoveringFromStoreWipe={false}
/>
</Provider>
)
fireEvent.press(wrapper.getByTestId('AcceptTermsButton'))
expect(acceptTerms).toHaveBeenCalled()
})
it('navigates to PincodeSet', () => {
const store = createMockStore({})
jest.mocked(firstOnboardingScreen).mockReturnValue(Screens.PincodeSet)

const wrapper = render(
<Provider store={store}>
<RegulatoryTermsClass
{...getMockI18nProps()}
acceptTerms={acceptTerms}
recoveringFromStoreWipe={false}
/>
</Provider>
)
fireEvent.press(wrapper.getByTestId('AcceptTermsButton'))
expect(firstOnboardingScreen).toHaveBeenCalled()
expect(navigate).toHaveBeenCalledWith(Screens.PincodeSet)
})
}
)
})
94 changes: 5 additions & 89 deletions src/onboarding/registration/RegulatoryTerms.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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
Expand Down Expand Up @@ -107,71 +106,9 @@ export class RegulatoryTerms extends React.Component<Props> {
)
}

renderColloquialTerms() {
const { t } = this.props

return (
<SectionList
style={styles.scrollView}
contentContainerStyle={styles.scrollContent}
testID="colloquialTermsSectionList"
sections={[
{
title: t('termsColloquial.privacyHeading'),
data: [
{ text: 'termsColloquial.privacy1', onPress: this.onPressGoToPrivacyPolicy },
{ text: 'termsColloquial.privacy2' },
{ text: 'termsColloquial.privacy3' },
],
},
{
title: t('termsColloquial.walletHeading'),
data: [{ text: 'termsColloquial.wallet1' }, { text: 'termsColloquial.wallet2' }],
},
]}
renderItem={({ item }) => {
return (
<View style={styles.itemContainer}>
<Text style={styles.item}>{'\u2022'}</Text>
{item.onPress ? (
<Text style={styles.item}>
<Trans i18nKey={item.text}>
<Text onPress={item.onPress} style={styles.link} />
</Trans>
</Text>
) : (
<Text style={styles.item}>
<Trans i18nKey={item.text} />
</Text>
)}
</View>
)
}}
renderSectionHeader={({ section: { title } }) => (
<Text style={styles.sectionHeader}>{title}</Text>
)}
ListHeaderComponent={
<Text style={styles.titleColloquial}>{t('termsColloquial.title')}</Text>
}
ListFooterComponent={
<Text style={styles.fullTerms}>
<Trans i18nKey="termsColloquial.fullTerms">
<Text onPress={this.onPressGoToTerms} style={styles.link} />
</Trans>
</Text>
}
stickySectionHeadersEnabled={false}
/>
)
}

render() {
const { t } = this.props

const { variant } = getExperimentParams(
ExperimentConfigs[StatsigExperiments.ONBOARDING_TERMS_AND_CONDITIONS]
)

return (
<SafeAreaView
style={styles.container}
Expand All @@ -180,7 +117,7 @@ export class RegulatoryTerms extends React.Component<Props> {
edges={Platform.select({ ios: ['bottom', 'left', 'right'] })}
>
<DevSkipButton nextScreen={Screens.PincodeSet} />
{variant === 'colloquial_terms' ? this.renderColloquialTerms() : this.renderTerms()}
{this.renderTerms()}
<SafeAreaInsetsContext.Consumer>
{(insets) => (
<Button
Expand Down Expand Up @@ -234,25 +171,4 @@ const styles = StyleSheet.create({
marginTop: MARGIN,
marginHorizontal: MARGIN,
},
titleColloquial: {
...typeScale.titleSmall,
marginBottom: Spacing.Small12,
},
sectionHeader: {
...typeScale.labelSemiBoldSmall,
marginVertical: Spacing.Small12,
},
itemContainer: {
flexDirection: 'row',
gap: Spacing.Smallest8,
},
item: {
...typeScale.bodySmall,
flexShrink: 1,
},
fullTerms: {
...typeScale.labelSemiBoldSmall,
marginVertical: Spacing.Small12,
color: Colors.infoDark,
},
})
Loading

0 comments on commit 6f6416d

Please sign in to comment.