|
@@ -15,42 +15,32 @@ function CompileTimeWarningUpgradePrompt() {
|
|
|
const [dismissedUntilWarning, setDismissedUntilWarning] = usePersistedState<
|
|
const [dismissedUntilWarning, setDismissedUntilWarning] = usePersistedState<
|
|
|
Date | undefined
|
|
Date | undefined
|
|
|
>(`has-dismissed-10s-compile-time-warning-until`)
|
|
>(`has-dismissed-10s-compile-time-warning-until`)
|
|
|
- const { reducedTimeoutWarning } = getMeta('ol-compileSettings')
|
|
|
|
|
- const warningThreshold = reducedTimeoutWarning === 'enabled' ? 7 : 10
|
|
|
|
|
-
|
|
|
|
|
- const sharedSegmentation = useMemo(
|
|
|
|
|
- () => ({
|
|
|
|
|
- '10s-timeout-warning': reducedTimeoutWarning,
|
|
|
|
|
- 'is-owner': isProjectOwner,
|
|
|
|
|
- }),
|
|
|
|
|
- [isProjectOwner, reducedTimeoutWarning]
|
|
|
|
|
- )
|
|
|
|
|
|
|
|
|
|
const warningSegmentation = useMemo(
|
|
const warningSegmentation = useMemo(
|
|
|
() => ({
|
|
() => ({
|
|
|
content: 'warning',
|
|
content: 'warning',
|
|
|
- compileTime: warningThreshold,
|
|
|
|
|
- ...sharedSegmentation,
|
|
|
|
|
|
|
+ compileTime: 7,
|
|
|
|
|
+ isProjectOwner,
|
|
|
}),
|
|
}),
|
|
|
- [sharedSegmentation, warningThreshold]
|
|
|
|
|
|
|
+ [isProjectOwner]
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
const changingSoonSegmentation = useMemo(
|
|
const changingSoonSegmentation = useMemo(
|
|
|
() => ({
|
|
() => ({
|
|
|
content: 'changes',
|
|
content: 'changes',
|
|
|
compileTime: 10,
|
|
compileTime: 10,
|
|
|
- ...sharedSegmentation,
|
|
|
|
|
|
|
+ isProjectOwner,
|
|
|
}),
|
|
}),
|
|
|
- [sharedSegmentation]
|
|
|
|
|
|
|
+ [isProjectOwner]
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
const handleNewCompile = useCallback(
|
|
const handleNewCompile = useCallback(
|
|
|
(compileTime: number) => {
|
|
(compileTime: number) => {
|
|
|
setShowWarning(false)
|
|
setShowWarning(false)
|
|
|
setShowChangingSoon(false)
|
|
setShowChangingSoon(false)
|
|
|
- if (reducedTimeoutWarning === 'enabled' && compileTime > 10000) {
|
|
|
|
|
|
|
+ if (compileTime > 10000) {
|
|
|
setShowChangingSoon(true)
|
|
setShowChangingSoon(true)
|
|
|
- } else if (compileTime > warningThreshold * 1000) {
|
|
|
|
|
|
|
+ } else if (compileTime > 7000) {
|
|
|
if (isProjectOwner) {
|
|
if (isProjectOwner) {
|
|
|
if (
|
|
if (
|
|
|
!dismissedUntilWarning ||
|
|
!dismissedUntilWarning ||
|
|
@@ -58,52 +48,42 @@ function CompileTimeWarningUpgradePrompt() {
|
|
|
) {
|
|
) {
|
|
|
setShowWarning(true)
|
|
setShowWarning(true)
|
|
|
eventTracking.sendMB('compile-time-warning-displayed', {
|
|
eventTracking.sendMB('compile-time-warning-displayed', {
|
|
|
- compileTime: warningThreshold,
|
|
|
|
|
|
|
+ compileTime: 7,
|
|
|
isProjectOwner,
|
|
isProjectOwner,
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- [
|
|
|
|
|
- isProjectOwner,
|
|
|
|
|
- dismissedUntilWarning,
|
|
|
|
|
- reducedTimeoutWarning,
|
|
|
|
|
- warningThreshold,
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ [isProjectOwner, dismissedUntilWarning]
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
const handleDismissWarning = useCallback(() => {
|
|
const handleDismissWarning = useCallback(() => {
|
|
|
eventTracking.sendMB('compile-time-warning-dismissed', {
|
|
eventTracking.sendMB('compile-time-warning-dismissed', {
|
|
|
- compileTime: warningThreshold,
|
|
|
|
|
|
|
+ compileTime: 7,
|
|
|
isProjectOwner,
|
|
isProjectOwner,
|
|
|
})
|
|
})
|
|
|
eventTracking.sendMB('paywall-dismiss', {
|
|
eventTracking.sendMB('paywall-dismiss', {
|
|
|
'paywall-type': 'compile-time-warning',
|
|
'paywall-type': 'compile-time-warning',
|
|
|
content: 'warning',
|
|
content: 'warning',
|
|
|
- compileTime: warningThreshold,
|
|
|
|
|
- ...sharedSegmentation,
|
|
|
|
|
|
|
+ compileTime: 7,
|
|
|
|
|
+ isProjectOwner,
|
|
|
})
|
|
})
|
|
|
setShowWarning(false)
|
|
setShowWarning(false)
|
|
|
const until = new Date()
|
|
const until = new Date()
|
|
|
until.setDate(until.getDate() + 1) // 1 day
|
|
until.setDate(until.getDate() + 1) // 1 day
|
|
|
setDismissedUntilWarning(until)
|
|
setDismissedUntilWarning(until)
|
|
|
- }, [
|
|
|
|
|
- isProjectOwner,
|
|
|
|
|
- setDismissedUntilWarning,
|
|
|
|
|
- warningThreshold,
|
|
|
|
|
- sharedSegmentation,
|
|
|
|
|
- ])
|
|
|
|
|
|
|
+ }, [isProjectOwner, setDismissedUntilWarning])
|
|
|
|
|
|
|
|
const handleDismissChangingSoon = useCallback(() => {
|
|
const handleDismissChangingSoon = useCallback(() => {
|
|
|
eventTracking.sendMB('paywall-dismiss', {
|
|
eventTracking.sendMB('paywall-dismiss', {
|
|
|
'paywall-type': 'compile-time-warning',
|
|
'paywall-type': 'compile-time-warning',
|
|
|
compileTime: 10,
|
|
compileTime: 10,
|
|
|
content: 'changes',
|
|
content: 'changes',
|
|
|
- ...sharedSegmentation,
|
|
|
|
|
|
|
+ isProjectOwner,
|
|
|
})
|
|
})
|
|
|
setShowChangingSoon(false)
|
|
setShowChangingSoon(false)
|
|
|
- }, [sharedSegmentation])
|
|
|
|
|
|
|
+ }, [isProjectOwner])
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (compiling || error || showLogs) return
|
|
if (compiling || error || showLogs) return
|