mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
f7131b720b
* 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
23 lines
770 B
TypeScript
23 lines
770 B
TypeScript
import type { Nullable } from '../../../../../types/utils'
|
|
|
|
export function calculateWatchingTimeInSecond(
|
|
startTimeWatchedFirstVideo: number,
|
|
startTimeWatchedSecondVideo: Nullable<number>
|
|
) {
|
|
let firstVideoWatchingTimeInSecond = 0
|
|
let secondVideoWatchingTimeInSecond = 0
|
|
if (startTimeWatchedSecondVideo === null) {
|
|
firstVideoWatchingTimeInSecond = Math.floor(
|
|
(Date.now() - startTimeWatchedFirstVideo) / 1000
|
|
)
|
|
} else {
|
|
firstVideoWatchingTimeInSecond = Math.floor(
|
|
(startTimeWatchedSecondVideo - startTimeWatchedFirstVideo) / 1000
|
|
)
|
|
secondVideoWatchingTimeInSecond = Math.floor(
|
|
(Date.now() - startTimeWatchedSecondVideo) / 1000
|
|
)
|
|
}
|
|
|
|
return { firstVideoWatchingTimeInSecond, secondVideoWatchingTimeInSecond }
|
|
}
|