Skip to content

Commit b74c341

Browse files
committed
feat: Init flags depending on host
1 parent 6860381 commit b74c341

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

app/flags/flag.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,29 @@ const initFromSearchParams = (locationSearch: string) => {
7474
}
7575
};
7676

77+
const isVercelPreviewHost = (host: string) => {
78+
return !!/visualization\-tool.*ixt1\.vercel\.app/.exec(host);
79+
};
80+
81+
const initFromHost = (host: string) => {
82+
if (
83+
host.includes("localhost") ||
84+
host.includes("test.visualize.admin.ch") ||
85+
isVercelPreviewHost(host)
86+
) {
87+
flag("configurator.add-dataset.new", true);
88+
flag("configurator.add-dataset.shared", true);
89+
flag("layoutor.dashboard.free-canvas", true);
90+
flag("layoutor.dashboard.shared-filters", true);
91+
flag("search.termsets", true);
92+
}
93+
};
94+
7795
if (isRunningInBrowser()) {
7896
// @ts-ignore
7997
window.flag = flag;
8098
initFromSearchParams(window.location.search);
99+
initFromHost(window.location.host);
81100
}
82101

83102
export { flag };

0 commit comments

Comments
 (0)