Skip to content

Commit

Permalink
(BSR) feat(cheactodes): add subscreens others in cheatcodes menu
Browse files Browse the repository at this point in the history
  • Loading branch information
lbeneston-pass committed Jan 6, 2025
1 parent 6a97b0b commit 419dfa1
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 52 deletions.
19 changes: 11 additions & 8 deletions src/cheatcodes/pages/CheatcodesMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import { cheatcodesNavigationProfileButtons } from 'cheatcodes/pages/features/pr
import { cheatcodesNavigationSubscriptionButtons } from 'cheatcodes/pages/features/subscription/CheatcodesNavigationSubscription'
import { cheatcodesNavigationTrustedDeviceButtons } from 'cheatcodes/pages/features/trustedDevice/CheatcodesNavigationTrustedDevice'
import { cheatcodesNavigationTutorialButtons } from 'cheatcodes/pages/features/tutorial/CheatcodesNavigationTutorial'
import { cheatcodesNavigationAccountManagementButtons } from 'cheatcodes/pages/others/CheatcodesNavigationAccountManagement'
import { cheatcodesNavigationErrorsButtons } from 'cheatcodes/pages/others/CheatcodesNavigationErrors'
import { cheatcodesNavigationSignUpButtons } from 'cheatcodes/pages/others/CheatcodesNavigationSignUp'
import { CheatcodesButtonsWithSubscreensProps } from 'cheatcodes/types'
import { ForceUpdate } from 'features/forceUpdate/pages/ForceUpdate'
import { env } from 'libs/environment'
Expand Down Expand Up @@ -62,16 +65,16 @@ export function CheatcodesMenu(): React.JSX.Element {
]

const otherButtons: CheatcodesButtonsWithSubscreensProps[] = [
{ title: 'Nouvelle-Calédonie 🇳🇨', screen: 'CheatcodesScreenNewCaledonia' },
{ title: 'Features flags 🏳️', screen: 'CheatcodesScreenFeatureFlags' },
{ title: 'Remote config 📊', screen: 'CheatcodesScreenRemoteConfig' },
{ title: 'Debug informations 🪲', screen: 'CheatcodesScreenDebugInformations' },
{ title: 'Errors 👾', screen: 'CheatcodesNavigationErrors' },
{ title: 'Pages non écrans ❌', screen: 'CheatcodesNavigationNotScreensPages' },
...cheatcodesNavigationAccountManagementButtons,
...cheatcodesNavigationErrorsButtons,
...cheatcodesNavigationSignUpButtons,
{ title: 'AccesLibre 🌈', screen: 'CheatcodesScreenAccesLibre' },
{ title: 'SignUp 🎨', screen: 'CheatcodesNavigationSignUp' },
{ title: 'Account Management ⚙️', screen: 'CheatcodesNavigationAccountManagement' },
{ title: 'Debug informations 🪲', screen: 'CheatcodesScreenDebugInformations' },
{ title: 'Envoyer une erreur Sentry 📤', onPress: onPressSentry },
{ title: 'Features flags 🏳️', screen: 'CheatcodesScreenFeatureFlags' },
{ title: 'Nouvelle-Calédonie 🇳🇨', screen: 'CheatcodesScreenNewCaledonia' },
{ title: 'Pages non écrans ❌', screen: 'CheatcodesNavigationNotScreensPages' },
{ title: 'Remote config 📊', screen: 'CheatcodesScreenRemoteConfig' },
]

if (screenError) throw screenError
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
import React from 'react'

import { CheatcodesSubscreensButtonList } from 'cheatcodes/components/CheatcodesSubscreenButtonList'
import { CheatcodesTemplateScreen } from 'cheatcodes/components/CheatcodesTemplateScreen'
import { LinkToScreen } from 'cheatcodes/components/LinkToScreen'
import { CheatcodesButtonsWithSubscreensProps } from 'cheatcodes/types'

export const cheatcodesNavigationAccountManagementButtons: [CheatcodesButtonsWithSubscreensProps] =
[
{
title: 'Account Management ⚙️',
screen: 'CheatcodesNavigationAccountManagement',
subscreens: [
{ screen: 'FraudulentSuspendedAccount' },
{ screen: 'SuspendedAccountUponUserRequest' },
{ screen: 'AccountReactivationSuccess' },
{ screen: 'DeleteProfileReason' },
{ screen: 'ConfirmDeleteProfile' },
{ screen: 'DeactivateProfileSuccess' },
{ screen: 'DeleteProfileSuccess' },
{ screen: 'DeleteProfileConfirmation' },
{ screen: 'ResetPasswordExpiredLink' },
{ screen: 'DeleteProfileAccountNotDeletable' },
{ screen: 'DeleteProfileAccountHacked' },
{ screen: 'ResetPasswordEmailSent', navigationParams: { email: '[email protected]' } },
],
},
]

export function CheatcodesNavigationAccountManagement(): React.JSX.Element {
return (
<CheatcodesTemplateScreen title="Account Management ⚙️">
<LinkToScreen screen="FraudulentSuspendedAccount" />
<LinkToScreen screen="SuspendedAccountUponUserRequest" />
<LinkToScreen screen="AccountReactivationSuccess" />
<LinkToScreen screen="DeleteProfileReason" />
<LinkToScreen screen="ConfirmDeleteProfile" />
<LinkToScreen screen="DeactivateProfileSuccess" />
<LinkToScreen screen="DeleteProfileSuccess" />
<LinkToScreen screen="DeleteProfileConfirmation" />
<LinkToScreen screen="ResetPasswordExpiredLink" />
<LinkToScreen
screen="ResetPasswordEmailSent"
navigationParams={{ email: '[email protected]' }}
/>
<LinkToScreen screen="DeleteProfileAccountNotDeletable" />
<LinkToScreen screen="DeleteProfileAccountHacked" />
<CheatcodesTemplateScreen title={cheatcodesNavigationAccountManagementButtons[0].title}>
<CheatcodesSubscreensButtonList buttons={cheatcodesNavigationAccountManagementButtons} />
</CheatcodesTemplateScreen>
)
}
24 changes: 18 additions & 6 deletions src/cheatcodes/pages/others/CheatcodesNavigationErrors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import React, { createElement, FunctionComponent, useState } from 'react'
import { useQuery } from 'react-query'
import styled from 'styled-components/native'

import { CheatcodesSubscreensButtonList } from 'cheatcodes/components/CheatcodesSubscreenButtonList'
import { CheatcodesTemplateScreen } from 'cheatcodes/components/CheatcodesTemplateScreen'
import { LinkToScreen } from 'cheatcodes/components/LinkToScreen'
import { CheatcodesButtonsWithSubscreensProps } from 'cheatcodes/types'
import { NoContentError } from 'features/home/pages/NoContentError'
import { Maintenance } from 'features/maintenance/pages/Maintenance'
import { UseNavigationType } from 'features/navigation/RootNavigator/types'
Expand All @@ -14,6 +16,14 @@ import { LogTypeEnum } from 'libs/monitoring/errors'
import { QueryKeys } from 'libs/queryKeys'
import { Typo } from 'ui/theme'

export const cheatcodesNavigationErrorsButtons: [CheatcodesButtonsWithSubscreensProps] = [
{
title: 'Errors 👾',
screen: 'CheatcodesNavigationErrors',
subscreens: [{ screen: 'BannedCountryError' }],
},
]

const MAX_ASYNC_TEST_REQ_COUNT = 3

export const CheatcodesNavigationErrors: FunctionComponent = () => {
Expand All @@ -26,10 +36,7 @@ export const CheatcodesNavigationErrors: FunctionComponent = () => {
const { refetch: errorAsyncQuery, isFetching } = useQuery(
[QueryKeys.ERROR_ASYNC],
() => errorAsync(),
{
cacheTime: 0,
enabled: false,
}
{ cacheTime: 0, enabled: false }
)

async function errorAsync() {
Expand All @@ -48,8 +55,9 @@ export const CheatcodesNavigationErrors: FunctionComponent = () => {
}

return (
<CheatcodesTemplateScreen title="Errors 👾">
<LinkToScreen screen="BannedCountryError" />
<CheatcodesTemplateScreen title={cheatcodesNavigationErrorsButtons[0].title}>
<CheatcodesSubscreensButtonList buttons={cheatcodesNavigationErrorsButtons} />

<LinkToScreen
title={
asyncTestReqCount < MAX_ASYNC_TEST_REQ_COUNT
Expand All @@ -59,6 +67,7 @@ export const CheatcodesNavigationErrors: FunctionComponent = () => {
disabled={isFetching || asyncTestReqCount >= MAX_ASYNC_TEST_REQ_COUNT}
onPress={() => errorAsyncQuery()}
/>

<LinkToScreen
title="Contentful KO error"
onPress={() =>
Expand All @@ -70,10 +79,12 @@ export const CheatcodesNavigationErrors: FunctionComponent = () => {
)
}
/>

<LinkToScreen
title="Offre inexistante"
onPress={() => navigate('Offer', { id: 0, from: 'searchresults' })}
/>

<LinkToScreen
title="Maintenance Page"
onPress={() =>
Expand All @@ -87,6 +98,7 @@ export const CheatcodesNavigationErrors: FunctionComponent = () => {
)
}
/>

<LinkToScreen
title="Erreur rendering"
onPress={() => {
Expand Down
56 changes: 35 additions & 21 deletions src/cheatcodes/pages/others/CheatcodesNavigationSignUp.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,44 @@
import React from 'react'

import { CheatcodesSubscreensButtonList } from 'cheatcodes/components/CheatcodesSubscreenButtonList'
import { CheatcodesTemplateScreen } from 'cheatcodes/components/CheatcodesTemplateScreen'
import { LinkToScreen } from 'cheatcodes/components/LinkToScreen'
import { useSomeOfferId } from 'cheatcodes/hooks/useSomeOfferId'
import { CheatcodesButtonsWithSubscreensProps } from 'cheatcodes/types'
import { StepperOrigin } from 'features/navigation/RootNavigator/types'
import { ApplicationProcessingModal } from 'shared/offer/components/ApplicationProcessingModal/ApplicationProcessingModal'
import { AuthenticationModal } from 'shared/offer/components/AuthenticationModal/AuthenticationModal'
import { ErrorApplicationModal } from 'shared/offer/components/ErrorApplicationModal/ErrorApplicationModal'
import { FinishSubscriptionModal } from 'shared/offer/components/FinishSubscriptionModal/FinishSubscriptionModal'
import { useModal } from 'ui/components/modals/useModal'

export const cheatcodesNavigationSignUpButtons: [CheatcodesButtonsWithSubscreensProps] = [
{
title: 'SignUp 🎨',
screen: 'CheatcodesNavigationSignUp',
subscreens: [
{ screen: 'AccountCreated' },
{ screen: 'BeneficiaryAccountCreated' },
{ screen: 'SignupConfirmationExpiredLink', navigationParams: { email: '[email protected]' } },
{
screen: 'NotYetUnderageEligibility',
navigationParams: {
eligibilityStartDatetime: new Date('2019-12-01T00:00:00Z').toString(),
},
},

{
screen: 'AfterSignupEmailValidationBuffer',
navigationParams: {
token: 'whichTokenDoYouWantReally',
expiration_timestamp: 456789123,
email: '[email protected]',
},
},
],
},
]

export function CheatcodesNavigationSignUp(): React.JSX.Element {
const offerId = useSomeOfferId()

Expand Down Expand Up @@ -38,46 +67,31 @@ export function CheatcodesNavigationSignUp(): React.JSX.Element {
} = useModal(false)

return (
<CheatcodesTemplateScreen title="SignUp 🎨">
<LinkToScreen
screen="SignupConfirmationExpiredLink"
navigationParams={{ email: '[email protected]' }}
/>
<LinkToScreen
screen="AfterSignupEmailValidationBuffer"
navigationParams={{
token: 'whichTokenDoYouWantReally',
expiration_timestamp: 456789123,
email: '[email protected]',
}}
/>
<LinkToScreen screen="AccountCreated" />
<LinkToScreen screen="BeneficiaryAccountCreated" />
<LinkToScreen
screen="NotYetUnderageEligibility"
navigationParams={{
eligibilityStartDatetime: new Date('2019-12-01T00:00:00Z').toString(),
}}
/>
<CheatcodesTemplateScreen title={cheatcodesNavigationSignUpButtons[0].title}>
<CheatcodesSubscreensButtonList buttons={cheatcodesNavigationSignUpButtons} />

<LinkToScreen title="Finish subscription modal" onPress={showFinishSubscriptionModal} />
<FinishSubscriptionModal
visible={finishSubscriptionModalVisible}
hideModal={hideFinishSubscriptionModal}
from={StepperOrigin.OFFER}
/>

<LinkToScreen title="Authentication modal from offer" onPress={showAuthenticationModal} />
<AuthenticationModal
visible={authenticationModalVisible}
hideModal={hideAuthenticationModal}
offerId={offerId}
from={StepperOrigin.FAVORITE}
/>

<LinkToScreen title="Application Processing Modal" onPress={showApplicationProcessingModal} />
<ApplicationProcessingModal
visible={applicationProcessingModalVisible}
hideModal={hideApplicationProcessingModal}
offerId={offerId}
/>

<LinkToScreen title="Error Application Modal" onPress={showErrorApplicationModal} />
<ErrorApplicationModal
visible={errorApplicationModalVisible}
Expand Down

0 comments on commit 419dfa1

Please sign in to comment.