overleaf/services/web/frontend/js/features/onboarding/controllers/onboarding-video-tour-modal-controller.js
M Fahru f7131b720b Implement onboarding video tour split test (#11889)
* Implement onboarding video tour split test:

- Add split test infrastructure
- Create new `OnboardingVideoTourModal` component
- Place the component inside the editor pug template with a split test

* add event segmentation for `onboarding-video-tour-close-button-click` event:

1. video: `first` | `second`
2. firstVideoWatchingTimeInSecond: total time watching first video
2. secondVideoWatchingTimeInSecond: total time watching second video (0 if skipped)

* add event segmentation for:

1.  `onboarding-video-tour-dismiss-button-click`
2. `onboarding-video-tour-next-button-click`
3. `onboarding-video-tour-done-button-click`

with these key/value:

1. firstVideoWatchingTimeInSecond: total time watching first video
2. secondVideoWatchingTimeInSecond: total time watching second video (0 if skipped/not watched yet)

* Use contentful to host video assets

GitOrigin-RevId: 27a6f38d15d7a03b07455e216dda63d99983ca80
2023-03-02 09:05:43 +00:00

32 lines
954 B
JavaScript

import { react2angular } from 'react2angular'
import { rootContext } from '../../../../../frontend/js/shared/context/root-context'
import App from '../../../../../frontend/js/base'
import getMeta from '../../../utils/meta'
import OnboardingVideoTourModal from '../components/onboarding-video-tour-modal'
export default App.controller(
'OnboardingVideoTourModalController',
function ($scope, localStorage) {
const hasDismissedOnboardingVideoTourModal = localStorage(
'has_dismissed_onboarding_video_tour_modal'
)
const showOnboardingVideoTour = getMeta('ol-showOnboardingVideoTour')
$scope.show =
!hasDismissedOnboardingVideoTourModal && showOnboardingVideoTour
$scope.closeModal = () => {
$scope.$applyAsync(() => {
$scope.show = false
})
}
}
)
App.component(
'onboardingVideoTourModal',
react2angular(rootContext.use(OnboardingVideoTourModal), [
'show',
'closeModal',
])
)