mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
a424450cbe
Summary: A new widget type Forms. For now hidden behind GRIST_EXPERIMENTAL_PLUGINS(). This diff contains all the core moving parts as a serves as a base to extend this functionality further. Test Plan: New test added Reviewers: georgegevoian Reviewed By: georgegevoian Subscribers: paulfitz Differential Revision: https://phab.getgrist.com/D4130
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import {getGristConfig} from 'app/common/urlUtils';
|
|
import {get as getBrowserGlobals} from 'app/client/lib/browserGlobals';
|
|
import {localStorageBoolObs, localStorageJsonObs} from 'app/client/lib/localStorageObs';
|
|
import {Observable} from 'grainjs';
|
|
|
|
/**
|
|
* Are comments enabled by feature flag.
|
|
*/
|
|
export function COMMENTS(): Observable<boolean> {
|
|
const G = getBrowserGlobals('document', 'window');
|
|
if (!G.window.COMMENTS) {
|
|
G.window.COMMENTS = localStorageBoolObs('feature-comments', Boolean(getGristConfig().featureComments));
|
|
}
|
|
return G.window.COMMENTS;
|
|
}
|
|
|
|
/**
|
|
* Does backend supports AI assistant.
|
|
*/
|
|
export function HAS_FORMULA_ASSISTANT() {
|
|
return Boolean(getGristConfig().featureFormulaAssistant);
|
|
}
|
|
|
|
export function WHICH_FORMULA_ASSISTANT() {
|
|
return getGristConfig().assistantService;
|
|
}
|
|
|
|
export function PERMITTED_CUSTOM_WIDGETS(): Observable<string[]> {
|
|
const G = getBrowserGlobals('document', 'window');
|
|
if (!G.window.PERMITTED_CUSTOM_WIDGETS) {
|
|
G.window.PERMITTED_CUSTOM_WIDGETS =
|
|
localStorageJsonObs('PERMITTED_CUSTOM_WIDGETS', getGristConfig().permittedCustomWidgets || []);
|
|
}
|
|
return G.window.PERMITTED_CUSTOM_WIDGETS;
|
|
}
|
|
|
|
export function GRIST_FORMS_FEATURE() {
|
|
return Boolean(getGristConfig().experimentalPlugins);
|
|
}
|