2022-10-17 11:47:16 +02:00
|
|
|
import {getGristConfig} from 'app/common/urlUtils';
|
|
|
|
|
import {get as getBrowserGlobals} from 'app/client/lib/browserGlobals';
|
2023-08-29 16:50:42 +02:00
|
|
|
import {localStorageBoolObs, localStorageJsonObs} from 'app/client/lib/localStorageObs';
|
2022-10-17 11:47:16 +02:00
|
|
|
import {Observable} from 'grainjs';
|
|
|
|
|
|
2023-08-08 11:36:02 +02:00
|
|
|
/**
|
|
|
|
|
* Are comments enabled by feature flag.
|
|
|
|
|
*/
|
2022-10-17 11:47:16 +02:00
|
|
|
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;
|
|
|
|
|
}
|
2023-03-23 19:22:28 +01:00
|
|
|
|
2023-08-08 11:36:02 +02:00
|
|
|
/**
|
|
|
|
|
* Does backend supports AI assistant.
|
|
|
|
|
*/
|
|
|
|
|
export function HAS_FORMULA_ASSISTANT() {
|
|
|
|
|
return Boolean(getGristConfig().featureFormulaAssistant);
|
2023-03-23 19:22:28 +01:00
|
|
|
}
|
2023-08-18 16:14:42 -04:00
|
|
|
|
|
|
|
|
export function WHICH_FORMULA_ASSISTANT() {
|
|
|
|
|
return getGristConfig().assistantService;
|
|
|
|
|
}
|
2023-08-29 16:50:42 +02:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|