DocSpace-client/packages/common/store/SettingsStore.js

701 lines
17 KiB
JavaScript
Raw Normal View History

2021-04-02 12:36:40 +00:00
import { makeAutoObservable } from "mobx";
import api from "../api";
import { combineUrl, setCookie, getCookie } from "../utils";
import FirebaseHelper from "../utils/firebase";
import {
AppServerConfig,
ThemeKeys,
COOKIE_EXPIRATION_YEAR,
LANGUAGE,
TenantStatus,
} from "../constants";
import { version } from "../package.json";
import SocketIOHelper from "../utils/socket";
import { Dark, Base } from "@docspace/components/themes";
import { initPluginStore } from "../../client/src/helpers/plugins";
2021-12-14 07:52:49 +00:00
const { proxyURL } = AppServerConfig;
const themes = {
Dark: Dark,
Base: Base,
};
const isDesktopEditors = window["AscDesktopEditor"] !== undefined;
class SettingsStore {
2021-02-03 12:42:47 +00:00
isLoading = false;
isLoaded = false;
isBurgerLoading = false;
2021-02-03 12:42:47 +00:00
checkedMaintenance = false;
maintenanceExist = false;
2022-02-28 13:17:09 +00:00
snackbarExist = false;
2021-02-02 09:55:14 +00:00
currentProductId = "";
culture = "en";
2021-02-02 09:55:14 +00:00
cultures = [];
theme = isDesktopEditors
? window.RendererProcessVariable?.theme?.type === "dark"
? Dark
: Base
2022-10-20 12:43:11 +00:00
: window.matchMedia &&
window.matchMedia("(prefers-color-scheme: dark)").matches
? Dark
: Base;
2021-02-02 09:55:14 +00:00
trustedDomains = [];
trustedDomainsType = 0;
ipRestrictionEnable = false;
ipRestrictions = [];
2022-04-07 14:55:44 +00:00
sessionLifetime = "1440";
2021-02-02 09:55:14 +00:00
timezone = "UTC";
timezones = [];
tenantAlias = "";
2021-02-02 09:55:14 +00:00
utcOffset = "00:00:00";
utcHoursOffset = 0;
2021-06-03 12:48:19 +00:00
defaultPage = "/";
homepage = "";
2021-02-02 09:55:14 +00:00
datePattern = "M/d/yyyy";
datePatternJQ = "00/00/0000";
dateTimePattern = "dddd, MMMM d, yyyy h:mm:ss tt";
datepicker = {
datePattern: "mm/dd/yy",
dateTimePattern: "DD, mm dd, yy h:mm:ss tt",
2021-02-02 09:55:14 +00:00
timePattern: "h:mm tt",
};
2021-02-02 09:55:14 +00:00
organizationName = "ONLYOFFICE";
greetingSettings = "Web Office Applications";
enableAdmMess = false;
2021-04-19 15:39:00 +00:00
enabledJoin = false;
2021-02-02 09:55:14 +00:00
urlLicense = "https://gnu.org/licenses/gpl-3.0.html";
urlSupport = "https://helpdesk.onlyoffice.com/";
2022-08-29 08:27:13 +00:00
urlOforms = "https://cmsoforms.onlyoffice.com/api/oforms";
2022-04-21 10:57:04 +00:00
2022-10-31 08:29:40 +00:00
logoUrl = "";
2021-02-02 09:55:14 +00:00
customNames = {
id: "Common",
userCaption: "User",
usersCaption: "Users",
groupCaption: "Group",
groupsCaption: "Groups",
userPostCaption: "Title",
regDateCaption: "Registration Date",
groupHeadCaption: "Head",
guestCaption: "Guest",
guestsCaption: "Guests",
};
isDesktopClient = isDesktopEditors;
2021-02-02 09:55:14 +00:00
//isDesktopEncryption: desktopEncryption;
isEncryptionSupport = false;
encryptionKeys = null;
Merge branch 'develop' into feature/mobx # Conflicts: # products/ASC.Files/Client/src/App.js # products/ASC.Files/Client/src/components/Article/Body/ThirdPartyList.js # products/ASC.Files/Client/src/components/pages/Home/Section/Body/index.js # products/ASC.Files/Client/src/components/pages/Home/Section/Header/index.js # products/ASC.Files/Client/src/components/pages/Home/index.js # products/ASC.Files/Client/src/store/files/selectors.js # products/ASC.People/Client/src/App.js # products/ASC.People/Client/src/components/pages/GroupAction/Section/Body/index.js # products/ASC.People/Client/src/components/pages/Home/Section/Body/index.js # products/ASC.People/Client/src/components/pages/Home/Section/Header/index.js # products/ASC.People/Client/src/components/pages/Home/index.js # products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js # products/ASC.People/Client/src/components/pages/Profile/index.js # products/ASC.People/Client/src/components/pages/ProfileAction/index.js # products/ASC.People/Client/src/store/group/actions.js # products/ASC.People/Client/src/store/people/actions.js # products/ASC.People/Client/src/store/people/selectors.js # products/ASC.People/Client/yarn.lock # web/ASC.Web.Client/src/App.js # web/ASC.Web.Client/src/components/pages/About/index.js # web/ASC.Web.Client/src/components/pages/Home/index.js # web/ASC.Web.Client/src/store/settings/actions.js # web/ASC.Web.Common/src/components/Layout/index.js # web/ASC.Web.Common/src/components/NavMenu/index.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/header-nav.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/header-unauth.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/header.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/nav-item.js # web/ASC.Web.Common/src/components/PageLayout/index.js # web/ASC.Web.Common/src/store/auth/actions.js # web/ASC.Web.Common/src/store/auth/reducer.js # web/ASC.Web.Common/src/store/auth/selectors.js # web/ASC.Web.Components/src/components/loader/types/rombs.js
2021-02-20 14:31:58 +00:00
2021-06-03 07:32:33 +00:00
personal = false;
docSpace = true;
2021-06-02 13:42:59 +00:00
2022-02-02 22:38:35 +00:00
roomsMode = false;
Merge branch 'develop' into feature/mobx # Conflicts: # products/ASC.Files/Client/src/App.js # products/ASC.Files/Client/src/components/Article/Body/ThirdPartyList.js # products/ASC.Files/Client/src/components/pages/Home/Section/Body/index.js # products/ASC.Files/Client/src/components/pages/Home/Section/Header/index.js # products/ASC.Files/Client/src/components/pages/Home/index.js # products/ASC.Files/Client/src/store/files/selectors.js # products/ASC.People/Client/src/App.js # products/ASC.People/Client/src/components/pages/GroupAction/Section/Body/index.js # products/ASC.People/Client/src/components/pages/Home/Section/Body/index.js # products/ASC.People/Client/src/components/pages/Home/Section/Header/index.js # products/ASC.People/Client/src/components/pages/Home/index.js # products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js # products/ASC.People/Client/src/components/pages/Profile/index.js # products/ASC.People/Client/src/components/pages/ProfileAction/index.js # products/ASC.People/Client/src/store/group/actions.js # products/ASC.People/Client/src/store/people/actions.js # products/ASC.People/Client/src/store/people/selectors.js # products/ASC.People/Client/yarn.lock # web/ASC.Web.Client/src/App.js # web/ASC.Web.Client/src/components/pages/About/index.js # web/ASC.Web.Client/src/components/pages/Home/index.js # web/ASC.Web.Client/src/store/settings/actions.js # web/ASC.Web.Common/src/components/Layout/index.js # web/ASC.Web.Common/src/components/NavMenu/index.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/header-nav.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/header-unauth.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/header.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/nav-item.js # web/ASC.Web.Common/src/components/PageLayout/index.js # web/ASC.Web.Common/src/store/auth/actions.js # web/ASC.Web.Common/src/store/auth/reducer.js # web/ASC.Web.Common/src/store/auth/selectors.js # web/ASC.Web.Components/src/components/loader/types/rombs.js
2021-02-20 14:31:58 +00:00
isHeaderVisible = false;
2021-02-02 09:55:14 +00:00
isTabletView = false;
Merge branch 'develop' into feature/mobx # Conflicts: # products/ASC.Files/Client/src/App.js # products/ASC.Files/Client/src/components/Article/Body/ThirdPartyList.js # products/ASC.Files/Client/src/components/pages/Home/Section/Body/index.js # products/ASC.Files/Client/src/components/pages/Home/Section/Header/index.js # products/ASC.Files/Client/src/components/pages/Home/index.js # products/ASC.Files/Client/src/store/files/selectors.js # products/ASC.People/Client/src/App.js # products/ASC.People/Client/src/components/pages/GroupAction/Section/Body/index.js # products/ASC.People/Client/src/components/pages/Home/Section/Body/index.js # products/ASC.People/Client/src/components/pages/Home/Section/Header/index.js # products/ASC.People/Client/src/components/pages/Home/index.js # products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js # products/ASC.People/Client/src/components/pages/Profile/index.js # products/ASC.People/Client/src/components/pages/ProfileAction/index.js # products/ASC.People/Client/src/store/group/actions.js # products/ASC.People/Client/src/store/people/actions.js # products/ASC.People/Client/src/store/people/selectors.js # products/ASC.People/Client/yarn.lock # web/ASC.Web.Client/src/App.js # web/ASC.Web.Client/src/components/pages/About/index.js # web/ASC.Web.Client/src/components/pages/Home/index.js # web/ASC.Web.Client/src/store/settings/actions.js # web/ASC.Web.Common/src/components/Layout/index.js # web/ASC.Web.Common/src/components/NavMenu/index.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/header-nav.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/header-unauth.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/header.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/nav-item.js # web/ASC.Web.Common/src/components/PageLayout/index.js # web/ASC.Web.Common/src/store/auth/actions.js # web/ASC.Web.Common/src/store/auth/reducer.js # web/ASC.Web.Common/src/store/auth/selectors.js # web/ASC.Web.Components/src/components/loader/types/rombs.js
2021-02-20 14:31:58 +00:00
showText = false;
2022-03-17 07:55:30 +00:00
articleOpen = false;
isMobileArticle = false;
2022-03-24 17:56:51 +00:00
folderPath = [];
2021-02-02 09:55:14 +00:00
hashSettings = null;
2021-02-03 12:42:47 +00:00
title = "";
2021-02-03 14:34:26 +00:00
ownerId = null;
nameSchemaId = null;
2021-02-15 19:43:07 +00:00
owner = {};
2021-03-18 18:54:03 +00:00
wizardToken = null;
2021-02-15 19:43:07 +00:00
passwordSettings = null;
2021-03-19 16:02:43 +00:00
hasShortenService = false;
withPaging = false;
2021-04-16 14:10:37 +00:00
customSchemaList = [];
firebase = {
apiKey: "",
authDomain: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: "",
measurementId: "",
};
version = "";
buildVersionInfo = {
appServer: version,
documentServer: "6.4.1",
};
debugInfo = false;
socketUrl = "";
2021-10-06 08:04:29 +00:00
userFormValidation = /^[\p{L}\p{M}'\-]+$/gu;
2021-10-06 08:22:00 +00:00
folderFormValidation = new RegExp('[*+:"<>?|\\\\/]', "gim");
2022-03-24 17:56:51 +00:00
tenantStatus = null;
helpLink = null;
hotkeyPanelVisible = false;
frameConfig = null;
2022-03-24 17:56:51 +00:00
appearanceTheme = [];
selectedThemeId = null;
currentColorScheme = null;
enablePlugins = false;
pluginOptions = [];
additionalResourcesData = null;
additionalResourcesIsDefault = true;
companyInfoSettingsData = null;
companyInfoSettingsIsDefault = true;
2022-09-14 14:25:31 +00:00
whiteLabelLogoUrls = [];
docSpaceLogo = "";
2022-09-14 10:59:17 +00:00
constructor() {
makeAutoObservable(this);
}
2022-03-24 17:56:51 +00:00
setTenantStatus = (tenantStatus) => {
this.tenantStatus = tenantStatus;
};
2021-02-02 09:55:14 +00:00
get urlAuthKeys() {
return `${this.helpLink}/installation/groups-authorization-keys.aspx`;
}
2021-03-18 18:54:03 +00:00
get wizardCompleted() {
return this.isLoaded && !this.wizardToken;
}
get helpUrlCommonSettings() {
return `${this.helpLink}/administration/configuration.aspx#CustomizingPortal_block`;
}
2022-03-24 17:56:51 +00:00
get helpUrlCreatingBackup() {
return `${this.helpLink}/administration/configuration.aspx#CreatingBackup_block`;
2022-03-24 17:56:51 +00:00
}
setValue = (key, value) => {
this[key] = value;
};
2021-03-18 18:54:03 +00:00
setCheckedMaintenance = (checkedMaintenance) => {
this.checkedMaintenance = checkedMaintenance;
};
setMaintenanceExist = (maintenanceExist) => {
this.maintenanceExist = maintenanceExist;
};
2022-02-28 13:17:09 +00:00
setSnackbarExist = (snackbar) => {
this.snackbarExist = snackbar;
};
2021-06-03 12:48:19 +00:00
setDefaultPage = (defaultPage) => {
this.defaultPage = defaultPage;
};
setGreetingSettings = (greetingSettings) => {
this.greetingSettings = greetingSettings;
};
2021-02-02 09:55:14 +00:00
getSettings = async () => {
let newSettings = null;
if (window?.__ASC_INITIAL_EDITOR_STATE__?.portalSettings)
newSettings = window.__ASC_INITIAL_EDITOR_STATE__.portalSettings;
else newSettings = await api.settings.getSettings();
2021-06-03 12:52:07 +00:00
if (window["AscDesktopEditor"] !== undefined || this.personal) {
const dp = combineUrl(proxyURL, "/products/files/");
this.setDefaultPage(dp);
}
2021-02-02 09:55:14 +00:00
Object.keys(newSettings).map((key) => {
2021-02-03 14:06:47 +00:00
if (key in this) {
this.setValue(
key,
key === "defaultPage"
? combineUrl(proxyURL, newSettings[key])
: newSettings[key]
);
2021-04-07 13:33:00 +00:00
if (key === "culture") {
const language = getCookie(LANGUAGE);
2021-04-07 13:33:00 +00:00
if (!language || language == "undefined") {
setCookie(LANGUAGE, newSettings[key], {
"max-age": COOKIE_EXPIRATION_YEAR,
});
2021-04-07 13:33:00 +00:00
}
2021-02-02 09:55:14 +00:00
}
2022-07-31 10:52:35 +00:00
// if (key === "personal") {
// window.AppServer = {
// ...window.AppServer,
// personal: newSettings[key],
// };
// }
2021-02-02 09:55:14 +00:00
} else if (key === "passwordHash") {
this.setValue("hashSettings", newSettings[key]);
2021-02-02 09:55:14 +00:00
}
});
this.setGreetingSettings(newSettings.greetingSettings);
2021-02-02 09:55:14 +00:00
return newSettings;
};
2022-03-24 17:56:51 +00:00
getFolderPath = async (id) => {
this.folderPath = await api.files.getFolderPath(id);
};
2021-02-02 09:55:14 +00:00
getCurrentCustomSchema = async (id) => {
let customNames = null;
if (window?.__ASC_INITIAL_EDITOR_STATE__?.customNames) {
customNames = window.__ASC_INITIAL_EDITOR_STATE__.customNames;
window.__ASC_INITIAL_EDITOR_STATE__.customNames = null;
} else customNames = await api.settings.getCurrentCustomSchema(id);
this.customNames = customNames;
2021-02-02 09:55:14 +00:00
};
2021-04-16 12:35:02 +00:00
getCustomSchemaList = async () => {
2021-04-16 14:10:37 +00:00
this.customSchemaList = await api.settings.getCustomSchemaList();
};
2021-02-02 09:55:14 +00:00
getPortalSettings = async () => {
const origSettings = await this.getSettings();
if (origSettings?.plugins?.enabled) {
initPluginStore();
this.enablePlugins = origSettings.plugins.enabled;
this.pluginOptions = origSettings.plugins.allow;
}
2022-03-24 17:56:51 +00:00
if (
origSettings.nameSchemaId &&
this.tenantStatus !== TenantStatus.PortalRestore
) {
2021-02-02 09:55:14 +00:00
this.getCurrentCustomSchema(origSettings.nameSchemaId);
}
if (origSettings.tenantAlias) {
this.setTenantAlias(origSettings.tenantAlias);
}
2021-02-02 09:55:14 +00:00
};
2021-02-03 12:42:47 +00:00
init = async () => {
this.setIsLoading(true);
2022-03-24 17:56:51 +00:00
const requests = [];
requests.push(this.getPortalSettings(), this.getAppearanceTheme());
2022-03-24 17:56:51 +00:00
this.tenantStatus !== TenantStatus.PortalRestore &&
requests.push(this.getBuildVersionInfo());
2021-02-03 12:42:47 +00:00
2022-03-24 17:56:51 +00:00
await Promise.all(requests);
2021-02-03 12:42:47 +00:00
this.setIsLoading(false);
this.setIsLoaded(true);
};
2022-02-06 19:55:15 +00:00
setRoomsMode = (mode) => {
this.roomsMode = mode;
};
2021-02-03 12:42:47 +00:00
setIsLoading = (isLoading) => {
this.isLoading = isLoading;
};
setIsLoaded = (isLoaded) => {
this.isLoaded = isLoaded;
};
setCultures = (cultures) => {
this.cultures = cultures;
};
setAdditionalResourcesData = (data) => {
this.additionalResourcesData = data;
};
setAdditionalResourcesIsDefault = (additionalResourcesIsDefault) => {
this.additionalResourcesIsDefault = additionalResourcesIsDefault;
};
setAdditionalResources = async (
feedbackAndSupportEnabled,
videoGuidesEnabled,
helpCenterEnabled
) => {
2022-09-14 15:29:03 +00:00
return await api.settings.setAdditionalResources(
feedbackAndSupportEnabled,
videoGuidesEnabled,
helpCenterEnabled
);
};
getAdditionalResources = async () => {
const res = await api.settings.getAdditionalResources();
this.setAdditionalResourcesData(res);
this.setAdditionalResourcesIsDefault(res.isDefault);
};
restoreAdditionalResources = async () => {
2022-09-14 15:29:03 +00:00
return await api.settings.restoreAdditionalResources();
};
getPortalCultures = async () => {
const cultures = await api.settings.getPortalCultures();
this.setCultures(cultures);
};
setIsEncryptionSupport = (isEncryptionSupport) => {
this.isEncryptionSupport = isEncryptionSupport;
};
getIsEncryptionSupport = async () => {
const isEncryptionSupport = await api.files.getIsEncryptionSupport();
this.setIsEncryptionSupport(isEncryptionSupport);
};
updateEncryptionKeys = (encryptionKeys) => {
this.encryptionKeys = encryptionKeys ?? {};
};
setEncryptionKeys = async (keys) => {
await api.files.setEncryptionKeys(keys);
this.updateEncryptionKeys(keys);
};
setCompanyInfoSettingsData = (data) => {
this.companyInfoSettingsData = data;
};
setCompanyInfoSettingsIsDefault = (companyInfoSettingsIsDefault) => {
this.companyInfoSettingsIsDefault = companyInfoSettingsIsDefault;
};
setCompanyInfoSettings = async (address, companyName, email, phone, site) => {
2022-09-14 15:29:03 +00:00
return api.settings.setCompanyInfoSettings(
address,
companyName,
email,
phone,
site
);
};
setDocSpaceLogo = (urls) => {
2022-10-26 19:29:44 +00:00
this.docSpaceLogo = urls[6];
};
2022-10-31 08:29:40 +00:00
setLogoUrl = (url) => {
this.logoUrl = url[0];
};
2022-09-14 10:59:17 +00:00
setLogoUrls = (urls) => {
2022-09-14 14:25:31 +00:00
this.whiteLabelLogoUrls = urls;
2022-09-14 10:59:17 +00:00
};
getCompanyInfoSettings = async () => {
const res = await api.settings.getCompanyInfoSettings();
this.setCompanyInfoSettingsData(res);
this.setCompanyInfoSettingsIsDefault(res.isDefault);
};
2022-09-14 10:59:17 +00:00
getWhiteLabelLogoUrls = async () => {
const res = await api.settings.getLogoUrls();
2022-09-14 10:59:17 +00:00
this.setLogoUrls(Object.values(res));
this.setDocSpaceLogo(Object.values(res));
2022-10-31 08:29:40 +00:00
this.setLogoUrl(Object.values(res));
2022-09-14 10:59:17 +00:00
};
restoreCompanyInfoSettings = async () => {
2022-09-14 15:29:03 +00:00
return await api.settings.restoreCompanyInfoSettings();
};
getEncryptionKeys = async () => {
const encryptionKeys = await api.files.getEncryptionKeys();
this.updateEncryptionKeys(encryptionKeys);
};
getOAuthToken = (tokenGetterWin) => {
return new Promise((resolve, reject) => {
2021-03-24 13:49:42 +00:00
localStorage.removeItem("code");
let interval = null;
interval = setInterval(() => {
2021-03-24 13:49:42 +00:00
try {
const code = localStorage.getItem("code");
if (code) {
localStorage.removeItem("code");
clearInterval(interval);
resolve(code);
} else if (tokenGetterWin && tokenGetterWin.closed) {
clearInterval(interval);
reject();
2021-03-24 13:49:42 +00:00
}
} catch (e) {
clearInterval(interval);
reject(e);
2021-03-24 13:49:42 +00:00
}
}, 500);
});
};
2021-04-21 13:31:18 +00:00
getLoginLink = (token, code) => {
return combineUrl(proxyURL, `/login.ashx?p=${token}&code=${code}`);
2021-04-21 13:31:18 +00:00
};
setModuleInfo = (homepage, productId) => {
2021-05-20 08:27:50 +00:00
if (this.homepage === homepage || this.currentProductId === productId)
return;
console.log(`setModuleInfo('${homepage}', '${productId}')`);
this.homepage = homepage;
2021-02-15 19:43:07 +00:00
this.setCurrentProductId(productId);
2021-03-22 14:35:33 +00:00
const baseElm = document.getElementsByTagName("base");
if (baseElm && baseElm.length === 1) {
const baseUrl = homepage
? homepage[homepage.length - 1] === "/"
? homepage
: `${homepage}/`
: "/";
2021-05-20 08:27:50 +00:00
baseElm[0].setAttribute("href", baseUrl);
}
2021-02-15 19:43:07 +00:00
};
setCurrentProductId = (currentProductId) => {
this.currentProductId = currentProductId;
};
getPortalOwner = async () => {
const owner = await api.people.getUserById(this.ownerId);
this.owner = owner;
return owner;
};
setWizardComplete = () => {
2021-03-18 18:54:03 +00:00
this.wizardToken = null;
2021-02-15 19:43:07 +00:00
};
setPasswordSettings = (passwordSettings) => {
this.passwordSettings = passwordSettings;
};
getPortalPasswordSettings = async (confirmKey = null) => {
const settings = await api.settings.getPortalPasswordSettings(confirmKey);
this.setPasswordSettings(settings);
};
setPortalPasswordSettings = async (
minLength,
upperCase,
digits,
specSymbols
) => {
const settings = await api.settings.setPortalPasswordSettings(
minLength,
upperCase,
digits,
specSymbols
);
2022-04-05 08:09:50 +00:00
this.setPasswordSettings(settings);
};
2021-02-15 19:43:07 +00:00
setTimezones = (timezones) => {
this.timezones = timezones;
};
getPortalTimezones = async (token = undefined) => {
const timezones = await api.settings.getPortalTimezones(token);
this.setTimezones(timezones);
};
Merge branch 'develop' into feature/mobx # Conflicts: # products/ASC.Files/Client/src/App.js # products/ASC.Files/Client/src/components/Article/Body/ThirdPartyList.js # products/ASC.Files/Client/src/components/pages/Home/Section/Body/index.js # products/ASC.Files/Client/src/components/pages/Home/Section/Header/index.js # products/ASC.Files/Client/src/components/pages/Home/index.js # products/ASC.Files/Client/src/store/files/selectors.js # products/ASC.People/Client/src/App.js # products/ASC.People/Client/src/components/pages/GroupAction/Section/Body/index.js # products/ASC.People/Client/src/components/pages/Home/Section/Body/index.js # products/ASC.People/Client/src/components/pages/Home/Section/Header/index.js # products/ASC.People/Client/src/components/pages/Home/index.js # products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js # products/ASC.People/Client/src/components/pages/Profile/index.js # products/ASC.People/Client/src/components/pages/ProfileAction/index.js # products/ASC.People/Client/src/store/group/actions.js # products/ASC.People/Client/src/store/people/actions.js # products/ASC.People/Client/src/store/people/selectors.js # products/ASC.People/Client/yarn.lock # web/ASC.Web.Client/src/App.js # web/ASC.Web.Client/src/components/pages/About/index.js # web/ASC.Web.Client/src/components/pages/Home/index.js # web/ASC.Web.Client/src/store/settings/actions.js # web/ASC.Web.Common/src/components/Layout/index.js # web/ASC.Web.Common/src/components/NavMenu/index.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/header-nav.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/header-unauth.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/header.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/nav-item.js # web/ASC.Web.Common/src/components/PageLayout/index.js # web/ASC.Web.Common/src/store/auth/actions.js # web/ASC.Web.Common/src/store/auth/reducer.js # web/ASC.Web.Common/src/store/auth/selectors.js # web/ASC.Web.Components/src/components/loader/types/rombs.js
2021-02-20 14:31:58 +00:00
setHeaderVisible = (isHeaderVisible) => {
this.isHeaderVisible = isHeaderVisible;
};
setIsTabletView = (isTabletView) => {
this.isTabletView = isTabletView;
};
setShowText = (showText) => {
this.showText = showText;
Merge branch 'develop' into feature/mobx # Conflicts: # products/ASC.Files/Client/src/App.js # products/ASC.Files/Client/src/components/Article/Body/ThirdPartyList.js # products/ASC.Files/Client/src/components/pages/Home/Section/Body/index.js # products/ASC.Files/Client/src/components/pages/Home/Section/Header/index.js # products/ASC.Files/Client/src/components/pages/Home/index.js # products/ASC.Files/Client/src/store/files/selectors.js # products/ASC.People/Client/src/App.js # products/ASC.People/Client/src/components/pages/GroupAction/Section/Body/index.js # products/ASC.People/Client/src/components/pages/Home/Section/Body/index.js # products/ASC.People/Client/src/components/pages/Home/Section/Header/index.js # products/ASC.People/Client/src/components/pages/Home/index.js # products/ASC.People/Client/src/components/pages/Profile/Section/Body/index.js # products/ASC.People/Client/src/components/pages/Profile/index.js # products/ASC.People/Client/src/components/pages/ProfileAction/index.js # products/ASC.People/Client/src/store/group/actions.js # products/ASC.People/Client/src/store/people/actions.js # products/ASC.People/Client/src/store/people/selectors.js # products/ASC.People/Client/yarn.lock # web/ASC.Web.Client/src/App.js # web/ASC.Web.Client/src/components/pages/About/index.js # web/ASC.Web.Client/src/components/pages/Home/index.js # web/ASC.Web.Client/src/store/settings/actions.js # web/ASC.Web.Common/src/components/Layout/index.js # web/ASC.Web.Common/src/components/NavMenu/index.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/header-nav.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/header-unauth.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/header.js # web/ASC.Web.Common/src/components/NavMenu/sub-components/nav-item.js # web/ASC.Web.Common/src/components/PageLayout/index.js # web/ASC.Web.Common/src/store/auth/actions.js # web/ASC.Web.Common/src/store/auth/reducer.js # web/ASC.Web.Common/src/store/auth/selectors.js # web/ASC.Web.Components/src/components/loader/types/rombs.js
2021-02-20 14:31:58 +00:00
};
toggleShowText = () => {
this.showText = !this.showText;
};
2022-03-17 07:55:30 +00:00
setArticleOpen = (articleOpen) => {
this.articleOpen = articleOpen;
};
toggleArticleOpen = () => {
this.articleOpen = !this.articleOpen;
};
setIsMobileArticle = (isMobileArticle) => {
this.isMobileArticle = isMobileArticle;
};
get firebaseHelper() {
2021-09-07 15:34:30 +00:00
window.firebaseHelper = new FirebaseHelper(this.firebase);
return window.firebaseHelper;
}
get socketHelper() {
return new SocketIOHelper(this.socketUrl);
}
getBuildVersionInfo = async () => {
let versionInfo = null;
if (window?.__ASC_INITIAL_EDITOR_STATE__?.versionInfo)
versionInfo = window.__ASC_INITIAL_EDITOR_STATE__.versionInfo;
else versionInfo = await api.settings.getBuildVersion();
this.setBuildVersionInfo(versionInfo);
};
setBuildVersionInfo = (versionInfo) => {
this.buildVersionInfo = {
...this.buildVersionInfo,
appServer: version,
...versionInfo,
};
if (!this.buildVersionInfo.documentServer)
this.buildVersionInfo.documentServer = "6.4.1";
};
setTheme = (key) => {
let theme = null;
switch (key) {
case ThemeKeys.Base:
case ThemeKeys.BaseStr:
theme = ThemeKeys.BaseStr;
break;
case ThemeKeys.Dark:
case ThemeKeys.DarkStr:
theme = ThemeKeys.DarkStr;
break;
case ThemeKeys.System:
case ThemeKeys.SystemStr:
default:
theme =
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: dark)").matches
? ThemeKeys.DarkStr
: ThemeKeys.BaseStr;
}
this.theme = themes[theme];
};
setMailDomainSettings = async (data) => {
const res = await api.settings.setMailDomainSettings(data);
this.trustedDomainsType = data.type;
this.trustedDomains = data.domains;
return res;
};
setTenantAlias = (tenantAlias) => {
this.tenantAlias = tenantAlias;
};
getIpRestrictions = async () => {
const res = await api.settings.getIpRestrictions();
2022-04-11 14:05:55 +00:00
this.ipRestrictions = res?.map((el) => el.ip);
};
setIpRestrictions = async (ips) => {
const data = {
ips: ips,
};
const res = await api.settings.setIpRestrictions(data);
2022-04-11 14:05:55 +00:00
this.ipRestrictions = res;
};
getIpRestrictionsEnable = async () => {
const res = await api.settings.getIpRestrictionsEnable();
this.ipRestrictionEnable = res.enable;
};
setIpRestrictionsEnable = async (enable) => {
const data = {
enable: enable,
};
const res = await api.settings.setIpRestrictionsEnable(data);
2022-04-11 14:05:55 +00:00
this.ipRestrictionEnable = res.enable;
};
setMessageSettings = async (turnOn) => {
await api.settings.setMessageSettings(turnOn);
this.enableAdmMess = turnOn;
};
2022-04-07 14:55:44 +00:00
getSessionLifetime = async () => {
2022-04-12 10:36:40 +00:00
const res = await api.settings.getCookieSettings();
2022-04-07 14:55:44 +00:00
this.sessionLifetime = res;
};
setSessionLifetimeSettings = async (lifeTime) => {
const res = await api.settings.setCookieSettings(lifeTime);
this.sessionLifetime = lifeTime;
};
setIsBurgerLoading = (isBurgerLoading) => {
this.isBurgerLoading = isBurgerLoading;
};
setHotkeyPanelVisible = (hotkeyPanelVisible) => {
this.hotkeyPanelVisible = hotkeyPanelVisible;
};
setFrameConfig = (frameConfig) => {
this.frameConfig = frameConfig;
return frameConfig;
};
get isFrame() {
return this.frameConfig?.name === window.name;
}
setAppearanceTheme = (theme) => {
this.appearanceTheme = theme;
};
setSelectThemeId = (selected) => {
this.selectedThemeId = selected;
};
setCurrentColorScheme = (currentColorScheme) => {
this.currentColorScheme = currentColorScheme;
};
getAppearanceTheme = async () => {
const res = await api.settings.getAppearanceTheme();
const currentColorScheme = res.themes.find((theme) => {
return res.selected === theme.id;
});
this.setAppearanceTheme(res.themes);
this.setSelectThemeId(res.selected);
this.setCurrentColorScheme(currentColorScheme);
};
sendAppearanceTheme = async (data) => {
2022-09-14 15:29:03 +00:00
return api.settings.sendAppearanceTheme(data);
};
}
export default SettingsStore;