Skip to content

Commit

Permalink
(PC-33612) feat(Venue): remove backdoor fake video (#7433)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpeyrou-pass authored Dec 20, 2024
1 parent 5523d5a commit 733c023
Show file tree
Hide file tree
Showing 18 changed files with 6,394 additions and 6,715 deletions.
12,798 changes: 6,389 additions & 6,409 deletions __snapshots__/features/venue/pages/Venue/Venue.native.test.tsx.native-snap

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,6 @@ describe('<VenueContent />', () => {
expect(await screen.findByTestId('defaultVenueBackground')).toBeOnTheScreen()
})

it('should display fake video player', async () => {
renderVenueContent({ videoSectionVisible: true })

expect(await screen.findByLabelText('Faux lecteur vidéo')).toBeOnTheScreen()
})

it('should open survey modal when fake video player is pressed', async () => {
renderVenueContent({ videoSectionVisible: true })

fireEvent.press(await screen.findByLabelText('Faux lecteur vidéo'))

expect(mockShowModal).toHaveBeenCalledWith()
})

describe('movie screening access button', () => {
beforeAll(() => {
useRemoteConfigContextSpy.mockReturnValue({
Expand Down
45 changes: 2 additions & 43 deletions src/features/venue/components/VenueContent/VenueContent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useEffect, useRef } from 'react'
import { NativeScrollEvent, NativeSyntheticEvent, Platform, ScrollView } from 'react-native'
import { IOScrollView as IntersectionObserverScrollView } from 'react-native-intersection-observer'
import Animated, { FadeOut, Layout } from 'react-native-reanimated'
import Animated, { Layout } from 'react-native-reanimated'
import styled, { useTheme } from 'styled-components/native'

import { VenueResponse, VenueTypeCodeKey } from 'api/gen'
Expand All @@ -13,28 +13,21 @@ import { VenueCTA } from 'features/venue/components/VenueCTA/VenueCTA'
import { VenueHeader } from 'features/venue/components/VenueHeader/VenueHeader'
import { VenueTopComponent } from 'features/venue/components/VenueTopComponent/VenueTopComponent'
import { VenueWebMetaHeader } from 'features/venue/components/VenueWebMetaHeader'
import { VideoSection } from 'features/venue/components/VideoSection/VideoSection'
import { VENUE_VIDEO_FAKEDOOR_DATA } from 'features/venue/constants'
import { VenueOffers, VenueOffersArtists } from 'features/venue/types'
import { analytics, isCloseToBottom } from 'libs/analytics'
import { isCloseToBottom } from 'libs/analytics'
import { useRemoteConfigContext } from 'libs/firebase/remoteConfig/RemoteConfigProvider'
import { useFunctionOnce } from 'libs/hooks'
import { BatchEvent, BatchProfile } from 'libs/react-native-batch'
import { useOpacityTransition } from 'ui/animations/helpers/useOpacityTransition'
import { AnchorProvider } from 'ui/components/anchor/AnchorContext'
import { useGetHeaderHeight } from 'ui/components/headers/PageHeaderWithoutPlaceholder'
import { SurveyModal } from 'ui/components/modals/SurveyModal'
import { useModal } from 'ui/components/modals/useModal'
import { BicolorCircledClock } from 'ui/svg/icons/BicolorCircledClock'
import { Spacer } from 'ui/theme'

type Props = {
venue: VenueResponse
gtlPlaylists?: GtlPlaylistData[]
venueArtists?: VenueOffersArtists
venueOffers?: VenueOffers
videoSectionVisible?: boolean
onCloseVideoFakeDoor?: () => void
}

const trackEventHasSeenVenueForSurvey = () =>
Expand All @@ -46,8 +39,6 @@ export const VenueContent: React.FunctionComponent<Props> = ({
gtlPlaylists,
venueArtists,
venueOffers,
videoSectionVisible,
onCloseVideoFakeDoor,
}) => {
const triggerBatch = useFunctionOnce(trackEventHasSeenVenueForSurvey)
const scrollViewRef = useRef<ScrollView>(null)
Expand Down Expand Up @@ -85,26 +76,7 @@ export const VenueContent: React.FunctionComponent<Props> = ({
const { isDesktopViewport, isTabletViewport } = useTheme()
const headerHeight = useGetHeaderHeight()
const isLargeScreen = isDesktopViewport || isTabletViewport
const { visible, hideModal, showModal } = useModal()
const { isButtonVisible, wording } = useOfferCTA()
const closeModal = () => {
onCloseVideoFakeDoor?.()
hideModal()
}

const handlePressVideo = () => {
showModal()
analytics.logConsultVenueVideoFakeDoor({ venueType: venue.venueTypeCode })
}

const buildSurveyURL = () => {
const urlOrigin = VENUE_VIDEO_FAKEDOOR_DATA.surveyURL

if (venue.venueTypeCode) {
return `${urlOrigin}?VenueType=${venue.venueTypeCode}`
}
return urlOrigin
}

const shouldDisplayCTA =
venue.venueTypeCode !== VenueTypeCodeKey.MOVIE &&
Expand All @@ -119,14 +91,6 @@ export const VenueContent: React.FunctionComponent<Props> = ({

return (
<AnchorProvider scrollViewRef={scrollViewRef} handleCheckScrollY={handleCheckScrollY}>
<SurveyModal
Icon={BicolorCircledClock}
hideModal={closeModal}
visible={visible}
title={VENUE_VIDEO_FAKEDOOR_DATA.title}
surveyDescription={VENUE_VIDEO_FAKEDOOR_DATA.description}
surveyUrl={buildSurveyURL()}
/>
<Container>
<VenueWebMetaHeader venue={venue} />
{/* On web VenueHeader is called before Body for accessibility navigate order */}
Expand All @@ -139,11 +103,6 @@ export const VenueContent: React.FunctionComponent<Props> = ({
{isLargeScreen ? <Placeholder height={headerHeight} /> : null}
<VenueTopComponent venue={venue} />
<Spacer.Column numberOfSpaces={isDesktopViewport ? 10 : 6} />
{videoSectionVisible ? (
<Animated.View exiting={FadeOut.duration(200)}>
<VideoSection venueType={venue.venueTypeCode} onPress={handlePressVideo} />
</Animated.View>
) : null}
<Animated.View layout={Layout.duration(200)}>
<VenueBody
venue={venue}
Expand Down
64 changes: 0 additions & 64 deletions src/features/venue/components/VideoSection/FakeVideoPlayer.tsx

This file was deleted.

49 changes: 0 additions & 49 deletions src/features/venue/components/VideoSection/VideoSection.tsx

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions src/features/venue/constants.ts

This file was deleted.

20 changes: 0 additions & 20 deletions src/features/venue/helpers/getFakeVideoBackground.test.ts

This file was deleted.

34 changes: 0 additions & 34 deletions src/features/venue/helpers/getFakeVideoBackground.ts

This file was deleted.

37 changes: 0 additions & 37 deletions src/features/venue/pages/Venue/Venue.native.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { venueDataTest } from 'features/venue/fixtures/venueDataTest'
import { Venue } from 'features/venue/pages/Venue/Venue'
import { analytics } from 'libs/analytics'
import { setFeatureFlags } from 'libs/firebase/firestore/featureFlags/__tests__/setFeatureFlags'
import { RemoteStoreFeatureFlags } from 'libs/firebase/firestore/types'
import { Offer } from 'shared/offer/types'
import { mockServer } from 'tests/mswServer'
import { reactQueryProviderHOC } from 'tests/reactQueryProviderHOC'
Expand Down Expand Up @@ -107,31 +106,6 @@ describe('<Venue />', () => {
expect(screen).toMatchSnapshot()
})

it('should display video section with FF on', async () => {
setFeatureFlags([RemoteStoreFeatureFlags.WIP_FAKEDOOR_VIDEO_VENUE])
renderVenue(venueId)

expect(await screen.findByText('Vidéo de ce lieu')).toBeOnTheScreen()
})

it('should not display video player if video has already been seen', async () => {
getItemSpy.mockResolvedValueOnce('true')
setFeatureFlags([RemoteStoreFeatureFlags.WIP_FAKEDOOR_VIDEO_VENUE])
renderVenue(venueId)

await waitFor(() => expect(screen.queryByText('Vidéo de ce lieu')).not.toBeOnTheScreen())
})

it('should hide video block once survey modal is closed', async () => {
setFeatureFlags([RemoteStoreFeatureFlags.WIP_FAKEDOOR_VIDEO_VENUE])
renderVenue(venueId)

fireEvent.press(await screen.findByLabelText('Faux lecteur vidéo'))
fireEvent.press(await screen.findByLabelText('Fermer la modale'))

await waitFor(() => expect(screen.queryByText('Vidéo de ce lieu')).not.toBeOnTheScreen())
})

describe('analytics', () => {
it.each([['deeplink'], ['venueMap']])(
'should log consult venue when URL from param equal to %s',
Expand Down Expand Up @@ -162,17 +136,6 @@ describe('<Venue />', () => {

expect(analytics.logConsultVenue).not.toHaveBeenCalled()
})

it('should log ConsultVenueVideoFakeDoor when fake video is pressed', async () => {
setFeatureFlags([RemoteStoreFeatureFlags.WIP_FAKEDOOR_VIDEO_VENUE])
renderVenue(venueId)

fireEvent.press(await screen.findByLabelText('Faux lecteur vidéo'))

expect(analytics.logConsultVenueVideoFakeDoor).toHaveBeenCalledWith({
venueType: 'BOOKSTORE',
})
})
})
})

Expand Down
Loading

0 comments on commit 733c023

Please sign in to comment.