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);
|
||||
}
|
||||
@@ -27,9 +27,18 @@ export interface Auth {
|
||||
pixelIds?: string[];
|
||||
linkId?: string;
|
||||
linkIds?: string[];
|
||||
parameters?: ShareParameters;
|
||||
};
|
||||
}
|
||||
|
||||
export type ShareTheme = 'light' | 'dark';
|
||||
|
||||
export interface ShareParameters {
|
||||
allowFilter?: boolean;
|
||||
theme?: ShareTheme;
|
||||
[key: string]: boolean | ShareTheme | undefined;
|
||||
}
|
||||
|
||||
export interface PropertyFilter {
|
||||
propertyName: string;
|
||||
dataType: number;
|
||||
|
||||
Reference in new issue
Block a user