2022-07-20 04:32:05 -04:00
|
|
|
import getMeta from '../../../utils/meta'
|
|
|
|
|
2022-07-28 05:21:46 -04:00
|
|
|
const hasTextEncoder = typeof TextEncoder !== 'undefined'
|
|
|
|
if (!hasTextEncoder) {
|
|
|
|
console.warn('TextEncoder is not available. Disabling pdf-caching.')
|
|
|
|
}
|
|
|
|
|
2022-07-20 04:32:05 -04:00
|
|
|
function isFlagEnabled(flag) {
|
2022-07-28 05:21:46 -04:00
|
|
|
if (!hasTextEncoder) return false
|
2022-07-20 04:32:05 -04:00
|
|
|
return getMeta('ol-splitTestVariants')?.[flag] === 'enabled'
|
|
|
|
}
|
|
|
|
|
2022-08-01 07:31:05 -04:00
|
|
|
export const cachedUrlLookupEnabled = isFlagEnabled(
|
|
|
|
'pdf-caching-cached-url-lookup'
|
|
|
|
)
|
|
|
|
export const prefetchingEnabled = isFlagEnabled('pdf-caching-prefetching')
|
|
|
|
export const prefetchLargeEnabled = isFlagEnabled('pdf-caching-prefetch-large')
|
2022-07-20 04:32:05 -04:00
|
|
|
export const enablePdfCaching = isFlagEnabled('pdf-caching-mode')
|
|
|
|
export const trackPdfDownloadEnabled = isFlagEnabled('track-pdf-download')
|