add share page options enable filtering and enforce theme
This commit is contained in:
1 parent
5ccfb6d0a5
commit
9b099408c2
75 files changed
+450
-172
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { FILTER_COLUMNS } from './constants';
|
||||
import type { ShareParameters, ShareTheme } from './types';
|
||||
|
||||
const FILTER_QUERY_PARAMS = new Set(['cohort', 'excludeBounce', 'match', 'segment']);
|
||||
|
||||
export function allowShareFilter(parameters?: ShareParameters | null) {
|
||||
return parameters?.allowFilter !== false;
|
||||
}
|
||||
|
||||
export function getShareTheme(parameters?: ShareParameters | null): ShareTheme | undefined {
|
||||
return parameters?.theme === 'light' || parameters?.theme === 'dark'
|
||||
? parameters.theme
|
||||
: undefined;
|
||||
}
|
||||
|
||||
export function excludeShareFilterParam(key: string) {
|
||||
const baseName = key.replace(/\d+$/, '');
|
||||
|
||||
return baseName in FILTER_COLUMNS || FILTER_QUERY_PARAMS.has(key);
|
||||
}
|
||||
Reference in new issue
Block a user