aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Markus Hatvan <markus_hatvan@aon.at>2021-10-14 13:24:58 +0200
committerLibravatar GitHub <noreply@github.com>2021-10-14 13:24:58 +0200
commitfe1ba2ad6affeb6c0e97c73171d8fa3f31dde73e (patch)
tree10caa332d957421e982c7ddd0c94623d5d62314d /src
parentchore: convert various JS to TS (#2062) (diff)
downloadferdium-app-fe1ba2ad6affeb6c0e97c73171d8fa3f31dde73e.tar.gz
ferdium-app-fe1ba2ad6affeb6c0e97c73171d8fa3f31dde73e.tar.zst
ferdium-app-fe1ba2ad6affeb6c0e97c73171d8fa3f31dde73e.zip
chore: convert files to TS (#2066)
Diffstat (limited to 'src')
-rw-r--r--src/components/ui/AppLoader/index.tsx (renamed from src/components/ui/AppLoader/index.js)23
-rw-r--r--src/components/ui/Button.js95
-rw-r--r--src/components/ui/Button.tsx73
-rw-r--r--src/components/ui/FullscreenLoader/styles.ts (renamed from src/components/ui/FullscreenLoader/styles.js)0
-rw-r--r--src/components/ui/Modal/index.tsx (renamed from src/components/ui/Modal/index.js)27
-rw-r--r--src/components/ui/Modal/styles.ts (renamed from src/components/ui/Modal/styles.js)0
-rw-r--r--src/electron-util.ts21
-rw-r--r--src/electron/ipc-api/localServer.ts4
-rw-r--r--src/environment.ts8
-rw-r--r--src/features/quickSwitch/index.ts (renamed from src/features/quickSwitch/index.js)2
-rw-r--r--src/helpers/password-helpers.ts6
-rw-r--r--src/helpers/userAgent-helpers.ts11
-rw-r--r--src/i18n/apply-branding.ts16
-rw-r--r--src/internal-server/start.ts18
-rw-r--r--src/internal-server/test.ts8
-rw-r--r--src/stores.types.ts378
16 files changed, 527 insertions, 163 deletions
diff --git a/src/components/ui/AppLoader/index.js b/src/components/ui/AppLoader/index.tsx
index e00960200..c7c290a57 100644
--- a/src/components/ui/AppLoader/index.js
+++ b/src/components/ui/AppLoader/index.tsx
@@ -1,5 +1,4 @@
1import { Component } from 'react'; 1import { Component } from 'react';
2import PropTypes from 'prop-types';
3import injectSheet, { withTheme } from 'react-jss'; 2import injectSheet, { withTheme } from 'react-jss';
4import classnames from 'classnames'; 3import classnames from 'classnames';
5 4
@@ -19,15 +18,15 @@ const textList = shuffleArray([
19 'Fixing bugs', 18 'Fixing bugs',
20]); 19]);
21 20
21type Props = {
22 classes: typeof styles;
23 theme: any;
24 texts: string[];
25};
26
22@injectSheet(styles) 27@injectSheet(styles)
23@withTheme 28@withTheme
24class AppLoader extends Component { 29class AppLoader extends Component<Props> {
25 static propTypes = {
26 classes: PropTypes.object.isRequired,
27 theme: PropTypes.object.isRequired,
28 texts: PropTypes.array,
29 };
30
31 static defaultProps = { 30 static defaultProps = {
32 texts: textList, 31 texts: textList,
33 }; 32 };
@@ -36,18 +35,20 @@ class AppLoader extends Component {
36 step: 0, 35 step: 0,
37 }; 36 };
38 37
39 interval = null; 38 interval: NodeJS.Timeout | null = null;
40 39
41 componentDidMount() { 40 componentDidMount() {
42 this.interval = setInterval(() => { 41 this.interval = setInterval(() => {
43 this.setState(prevState => ({ 42 this.setState((prevState: { step: number }) => ({
44 step: prevState.step === textList.length - 1 ? 0 : prevState.step + 1, 43 step: prevState.step === textList.length - 1 ? 0 : prevState.step + 1,
45 })); 44 }));
46 }, 2500); 45 }, 2500);
47 } 46 }
48 47
49 componentWillUnmount() { 48 componentWillUnmount() {
50 clearInterval(this.interval); 49 if (this.interval) {
50 clearInterval(this.interval);
51 }
51 } 52 }
52 53
53 render() { 54 render() {
diff --git a/src/components/ui/Button.js b/src/components/ui/Button.js
deleted file mode 100644
index 67c801d98..000000000
--- a/src/components/ui/Button.js
+++ /dev/null
@@ -1,95 +0,0 @@
1import { Component } from 'react';
2import PropTypes from 'prop-types';
3import { observer, inject } from 'mobx-react';
4import Loader from 'react-loader';
5import classnames from 'classnames';
6
7@inject('stores')
8@observer
9class Button extends Component {
10 static propTypes = {
11 className: PropTypes.string,
12 label: PropTypes.string.isRequired,
13 disabled: PropTypes.bool,
14 onClick: PropTypes.func,
15 type: PropTypes.string,
16 buttonType: PropTypes.string,
17 loaded: PropTypes.bool,
18 htmlForm: PropTypes.string,
19 stores: PropTypes.shape({
20 settings: PropTypes.shape({
21 app: PropTypes.shape({
22 accentColor: PropTypes.string.isRequired,
23 }).isRequired,
24 }).isRequired,
25 }).isRequired,
26 };
27
28 static defaultProps = {
29 className: null,
30 disabled: false,
31 onClick: () => {},
32 type: 'button',
33 buttonType: '',
34 loaded: true,
35 htmlForm: '',
36 };
37
38 element = null;
39
40 render() {
41 const {
42 label,
43 className,
44 disabled,
45 onClick,
46 type,
47 buttonType,
48 loaded,
49 htmlForm,
50 } = this.props;
51
52 const buttonProps = {
53 className: classnames({
54 'franz-form__button': true,
55 [`franz-form__button--${buttonType}`]: buttonType,
56 [`${className}`]: className,
57 }),
58 type,
59 };
60
61 if (disabled) {
62 buttonProps.disabled = true;
63 }
64
65 if (onClick) {
66 buttonProps.onClick = onClick;
67 }
68
69 if (htmlForm) {
70 buttonProps.form = htmlForm;
71 }
72
73 return (
74 // disabling rule as button has type defined in `buttonProps`
75 /* eslint-disable react/button-has-type */
76 <button {...buttonProps}>
77 <Loader
78 loaded={loaded}
79 lines={10}
80 scale={0.4}
81 color={
82 buttonType !== 'secondary'
83 ? '#FFF'
84 : this.props.stores.settings.app.accentColor
85 }
86 component="span"
87 />
88 {label}
89 </button>
90 /* eslint-enable react/button-has-type */
91 );
92 }
93}
94
95export default Button;
diff --git a/src/components/ui/Button.tsx b/src/components/ui/Button.tsx
new file mode 100644
index 000000000..aac080fda
--- /dev/null
+++ b/src/components/ui/Button.tsx
@@ -0,0 +1,73 @@
1import { Component } from 'react';
2import { observer, inject } from 'mobx-react';
3import Loader from 'react-loader';
4import classnames from 'classnames';
5import { FerdiStores } from '../../stores.types';
6
7type Props = {
8 className: string;
9 label: string;
10 disabled: boolean;
11 onClick: () => void;
12 type: 'button' | 'submit' | 'reset';
13 buttonType: string;
14 loaded: boolean;
15 htmlForm: string;
16 stores: FerdiStores;
17};
18
19@inject('stores')
20@observer
21class Button extends Component<Props> {
22 static defaultProps = {
23 className: null,
24 disabled: false,
25 onClick: () => {},
26 type: 'button',
27 buttonType: '',
28 loaded: true,
29 htmlForm: '',
30 };
31
32 render() {
33 const {
34 label,
35 className,
36 disabled,
37 onClick,
38 type,
39 buttonType,
40 loaded,
41 htmlForm,
42 } = this.props;
43
44 return (
45 <button
46 className={classnames({
47 'franz-form__button': true,
48 [`franz-form__button--${buttonType}`]: buttonType,
49 [`${className}`]: className,
50 })}
51 disabled={disabled}
52 type={type}
53 onClick={onClick}
54 form={htmlForm}
55 >
56 <Loader
57 loaded={loaded}
58 lines={10}
59 scale={0.4}
60 color={
61 buttonType !== 'secondary'
62 ? '#FFF'
63 : this.props.stores.settings.app.accentColor
64 }
65 component="span"
66 />
67 {label}
68 </button>
69 );
70 }
71}
72
73export default Button;
diff --git a/src/components/ui/FullscreenLoader/styles.js b/src/components/ui/FullscreenLoader/styles.ts
index 64d24e4ce..64d24e4ce 100644
--- a/src/components/ui/FullscreenLoader/styles.js
+++ b/src/components/ui/FullscreenLoader/styles.ts
diff --git a/src/components/ui/Modal/index.js b/src/components/ui/Modal/index.tsx
index c4e47748a..0bb0aaa61 100644
--- a/src/components/ui/Modal/index.js
+++ b/src/components/ui/Modal/index.tsx
@@ -1,6 +1,5 @@
1import { Component } from 'react'; 1import { Component, ReactChildren } from 'react';
2import ReactModal from 'react-modal'; 2import ReactModal from 'react-modal';
3import PropTypes from 'prop-types';
4import classnames from 'classnames'; 3import classnames from 'classnames';
5import injectCSS from 'react-jss'; 4import injectCSS from 'react-jss';
6import { Icon } from '@meetfranz/ui'; 5import { Icon } from '@meetfranz/ui';
@@ -8,21 +7,19 @@ import { Icon } from '@meetfranz/ui';
8import { mdiClose } from '@mdi/js'; 7import { mdiClose } from '@mdi/js';
9import styles from './styles'; 8import styles from './styles';
10 9
11// ReactModal.setAppElement('#root'); 10type Props = {
11 children: ReactChildren;
12 className: string;
13 classes: any;
14 isOpen: boolean;
15 portal: string;
16 close: () => void;
17 shouldCloseOnOverlayClick: boolean;
18 showClose: boolean;
19};
12 20
13@injectCSS(styles) 21@injectCSS(styles)
14class Modal extends Component { 22class Modal extends Component<Props> {
15 static propTypes = {
16 children: PropTypes.node.isRequired,
17 className: PropTypes.string,
18 classes: PropTypes.object.isRequired,
19 isOpen: PropTypes.bool.isRequired,
20 portal: PropTypes.string,
21 close: PropTypes.func.isRequired,
22 shouldCloseOnOverlayClick: PropTypes.bool,
23 showClose: PropTypes.bool,
24 };
25
26 static defaultProps = { 23 static defaultProps = {
27 className: null, 24 className: null,
28 portal: 'modal-portal', 25 portal: 'modal-portal',
diff --git a/src/components/ui/Modal/styles.js b/src/components/ui/Modal/styles.ts
index f32c075ce..f32c075ce 100644
--- a/src/components/ui/Modal/styles.js
+++ b/src/components/ui/Modal/styles.ts
diff --git a/src/electron-util.ts b/src/electron-util.ts
index f4b26cb10..3c395ab10 100644
--- a/src/electron-util.ts
+++ b/src/electron-util.ts
@@ -1,23 +1,28 @@
1// Enhanced from: https://github.com/dertieran/electron-util/blob/replace-remote/source/api.js 1// Enhanced from: https://github.com/dertieran/electron-util/blob/replace-remote/source/api.js
2 2
3import electron from 'electron'; 3import * as electron from 'electron';
4import { initialize } from '@electron/remote/main'; 4import { initialize } from '@electron/remote/main';
5 5
6export const initializeRemote = () => { 6export const initializeRemote = () => {
7 if (process.type !== 'browser') { 7 if (process.type !== 'browser') {
8 throw new Error('The remote api must be initialized from the main process.'); 8 throw new Error(
9 'The remote api must be initialized from the main process.',
10 );
9 } 11 }
10 12
11 initialize(); 13 initialize();
12}; 14};
13 15
14export const remote = new Proxy({}, { 16export const remote = new Proxy(
15 get: (_target, property) => { 17 {},
16 // eslint-disable-next-line global-require 18 {
17 const remote = require('@electron/remote'); 19 get: (_target, property) => {
18 return remote[property]; 20 // eslint-disable-next-line global-require
21 const remote = require('@electron/remote');
22 return remote[property];
23 },
19 }, 24 },
20}); 25);
21 26
22export const api = new Proxy(electron, { 27export const api = new Proxy(electron, {
23 get: (target, property) => { 28 get: (target, property) => {
diff --git a/src/electron/ipc-api/localServer.ts b/src/electron/ipc-api/localServer.ts
index 7ee642101..04ddc976a 100644
--- a/src/electron/ipc-api/localServer.ts
+++ b/src/electron/ipc-api/localServer.ts
@@ -1,12 +1,12 @@
1import { ipcMain, BrowserWindow } from 'electron'; 1import { ipcMain, BrowserWindow } from 'electron';
2import net from 'net'; 2import { createServer } from 'net';
3import { LOCAL_HOSTNAME, LOCAL_PORT } from '../../config'; 3import { LOCAL_HOSTNAME, LOCAL_PORT } from '../../config';
4import { userDataPath } from '../../environment-remote'; 4import { userDataPath } from '../../environment-remote';
5import { server } from '../../internal-server/start'; 5import { server } from '../../internal-server/start';
6 6
7const portInUse = (port: number): Promise<boolean> => 7const portInUse = (port: number): Promise<boolean> =>
8 new Promise(resolve => { 8 new Promise(resolve => {
9 const server = net.createServer(socket => { 9 const server = createServer(socket => {
10 socket.write('Echo server\r\n'); 10 socket.write('Echo server\r\n');
11 socket.pipe(socket); 11 socket.pipe(socket);
12 }); 12 });
diff --git a/src/environment.ts b/src/environment.ts
index ce2a77e7a..6b68ef432 100644
--- a/src/environment.ts
+++ b/src/environment.ts
@@ -1,6 +1,6 @@
1// Note: This file has now become devoid of all references to values deduced from the remote process - all those now live in the `environment-remote.js` file 1// Note: This file has now become devoid of all references to values deduced from the remote process - all those now live in the `environment-remote.js` file
2 2
3import os from 'os'; 3import { platform, arch, release } from 'os';
4 4
5export const isMac = process.platform === 'darwin'; 5export const isMac = process.platform === 'darwin';
6export const isWindows = process.platform === 'win32'; 6export const isWindows = process.platform === 'win32';
@@ -10,9 +10,9 @@ export const electronVersion = process.versions.electron;
10export const chromeVersion = process.versions.chrome; 10export const chromeVersion = process.versions.chrome;
11export const nodeVersion = process.versions.node; 11export const nodeVersion = process.versions.node;
12 12
13export const osPlatform = os.platform(); 13export const osPlatform = platform();
14export const osArch = os.arch(); 14export const osArch = arch();
15export const osRelease = os.release(); 15export const osRelease = release();
16export const is64Bit = osArch.match(/64/); 16export const is64Bit = osArch.match(/64/);
17 17
18// for accelerator, show the shortform that electron/OS understands 18// for accelerator, show the shortform that electron/OS understands
diff --git a/src/features/quickSwitch/index.js b/src/features/quickSwitch/index.ts
index a16017219..e9cc36b2a 100644
--- a/src/features/quickSwitch/index.js
+++ b/src/features/quickSwitch/index.ts
@@ -12,7 +12,7 @@ export default function initialize() {
12 state.isModalVisible = true; 12 state.isModalVisible = true;
13 } 13 }
14 14
15 window.ferdi.features.quickSwitch = { 15 window['ferdi'].features.quickSwitch = {
16 state, 16 state,
17 showModal, 17 showModal,
18 }; 18 };
diff --git a/src/helpers/password-helpers.ts b/src/helpers/password-helpers.ts
index e5d9a4a25..053321bbf 100644
--- a/src/helpers/password-helpers.ts
+++ b/src/helpers/password-helpers.ts
@@ -1,7 +1,7 @@
1import crypto from 'crypto'; 1import { createHash, BinaryLike } from 'crypto';
2 2
3export function hash(password: crypto.BinaryLike) { 3export function hash(password: BinaryLike) {
4 return crypto.createHash('sha256').update(password).digest('base64'); 4 return createHash('sha256').update(password).digest('base64');
5} 5}
6 6
7export function scorePassword(password: string) { 7export function scorePassword(password: string) {
diff --git a/src/helpers/userAgent-helpers.ts b/src/helpers/userAgent-helpers.ts
index 091a76400..c1e8e02da 100644
--- a/src/helpers/userAgent-helpers.ts
+++ b/src/helpers/userAgent-helpers.ts
@@ -1,13 +1,18 @@
1import os from 'os'; 1import { cpus } from 'os';
2import macosVersion from 'macos-version'; 2import macosVersion from 'macos-version';
3import { chrome } from 'useragent-generator'; 3import { chrome } from 'useragent-generator';
4import { 4import {
5 chromeVersion, isMac, isWindows, is64Bit, osArch, osRelease, 5 chromeVersion,
6 isMac,
7 isWindows,
8 is64Bit,
9 osArch,
10 osRelease,
6} from '../environment'; 11} from '../environment';
7 12
8function macOS() { 13function macOS() {
9 const version = macosVersion() || ''; 14 const version = macosVersion() || '';
10 let cpuName = os.cpus()[0].model.split(' ')[0]; 15 let cpuName = cpus()[0].model.split(' ')[0];
11 if (cpuName && /\(/.test(cpuName)) { 16 if (cpuName && /\(/.test(cpuName)) {
12 cpuName = cpuName.split('(')[0]; 17 cpuName = cpuName.split('(')[0];
13 } 18 }
diff --git a/src/i18n/apply-branding.ts b/src/i18n/apply-branding.ts
index 801a4a525..7943c099d 100644
--- a/src/i18n/apply-branding.ts
+++ b/src/i18n/apply-branding.ts
@@ -1,8 +1,8 @@
1/** 1/**
2 * Apply Ferdi branding to i18n translations 2 * Apply Ferdi branding to i18n translations
3 */ 3 */
4import fs from 'fs-extra'; 4import { readdirSync, readJson, writeJson } from 'fs-extra';
5import path from 'path'; 5import { join } from 'path';
6 6
7console.log('Applying Ferdi branding to translations...'); 7console.log('Applying Ferdi branding to translations...');
8 8
@@ -31,13 +31,13 @@ const replace = {
31 '!!!': '', 31 '!!!': '',
32}; 32};
33 33
34const locales = path.join(__dirname, 'locales'); 34const locales = join(__dirname, 'locales');
35const files = fs.readdirSync(locales); 35const files = readdirSync(locales);
36 36
37const replaceFind = Object.keys(replace); 37const replaceFind = Object.keys(replace);
38const replaceReplaceWith = Object.values(replace); 38const replaceReplaceWith = Object.values(replace);
39 39
40const replaceStr = (str, find, replaceWith) => { 40const replaceStr = (str: string, find: any[], replaceWith: string[]) => {
41 for (const [i, element] of find.entries()) { 41 for (const [i, element] of find.entries()) {
42 str = str.replace(new RegExp(element, 'gi'), replaceWith[i]); 42 str = str.replace(new RegExp(element, 'gi'), replaceWith[i]);
43 } 43 }
@@ -49,8 +49,8 @@ files.forEach(async file => {
49 if (ignoreFiles.has(file)) return; 49 if (ignoreFiles.has(file)) return;
50 50
51 // Read locale data 51 // Read locale data
52 const filePath = path.join(locales, file); 52 const filePath = join(locales, file);
53 const locale = await fs.readJson(filePath); 53 const locale = await readJson(filePath);
54 54
55 // Replace branding 55 // Replace branding
56 for (const key in locale) { 56 for (const key in locale) {
@@ -59,7 +59,7 @@ files.forEach(async file => {
59 } 59 }
60 } 60 }
61 61
62 await fs.writeJson(filePath, locale, { 62 await writeJson(filePath, locale, {
63 spaces: 2, 63 spaces: 2,
64 EOL: '\n', 64 EOL: '\n',
65 }); 65 });
diff --git a/src/internal-server/start.ts b/src/internal-server/start.ts
index 392f7cf41..62311b21e 100644
--- a/src/internal-server/start.ts
+++ b/src/internal-server/start.ts
@@ -17,27 +17,27 @@
17 17
18import fold from '@adonisjs/fold'; 18import fold from '@adonisjs/fold';
19import { Ignitor } from '@adonisjs/ignitor'; 19import { Ignitor } from '@adonisjs/ignitor';
20import fs from 'fs-extra'; 20import { existsSync, readFile, statSync, chmodSync, writeFile } from 'fs-extra';
21import path from 'path'; 21import { join } from 'path';
22import { LOCAL_HOSTNAME } from '../config'; 22import { LOCAL_HOSTNAME } from '../config';
23import { isWindows } from '../environment'; 23import { isWindows } from '../environment';
24 24
25process.env.ENV_PATH = path.join(__dirname, 'env.ini'); 25process.env.ENV_PATH = join(__dirname, 'env.ini');
26 26
27export const server = async (userPath: string, port: number) => { 27export const server = async (userPath: string, port: number) => {
28 const dbPath = path.join(userPath, 'server.sqlite'); 28 const dbPath = join(userPath, 'server.sqlite');
29 const dbTemplatePath = path.join(__dirname, 'database', 'template.sqlite'); 29 const dbTemplatePath = join(__dirname, 'database', 'template.sqlite');
30 30
31 if (!fs.existsSync(dbPath)) { 31 if (!existsSync(dbPath)) {
32 // Manually copy file 32 // Manually copy file
33 // We can't use copyFile here as it will cause the file to be readonly on Windows 33 // We can't use copyFile here as it will cause the file to be readonly on Windows
34 const dbTemplate = await fs.readFile(dbTemplatePath); 34 const dbTemplate = await readFile(dbTemplatePath);
35 await fs.writeFile(dbPath, dbTemplate); 35 await writeFile(dbPath, dbTemplate);
36 36
37 // Change permissions to ensure to file is not read-only 37 // Change permissions to ensure to file is not read-only
38 if (isWindows) { 38 if (isWindows) {
39 // eslint-disable-next-line no-bitwise 39 // eslint-disable-next-line no-bitwise
40 fs.chmodSync(dbPath, fs.statSync(dbPath).mode | 146); 40 chmodSync(dbPath, statSync(dbPath).mode | 146);
41 } 41 }
42 } 42 }
43 43
diff --git a/src/internal-server/test.ts b/src/internal-server/test.ts
index 437a2813b..46d1b1e4a 100644
--- a/src/internal-server/test.ts
+++ b/src/internal-server/test.ts
@@ -1,9 +1,9 @@
1import path from 'path'; 1import { join } from 'path';
2import fs from 'fs-extra'; 2import { ensureDirSync } from 'fs-extra';
3import { server } from './start'; 3import { server } from './start';
4 4
5const dummyUserFolder = path.join(__dirname, 'user_data'); 5const dummyUserFolder = join(__dirname, 'user_data');
6 6
7fs.ensureDirSync(dummyUserFolder); 7ensureDirSync(dummyUserFolder);
8 8
9server(dummyUserFolder, 45_568); 9server(dummyUserFolder, 45_568);
diff --git a/src/stores.types.ts b/src/stores.types.ts
new file mode 100644
index 000000000..66c8e9b85
--- /dev/null
+++ b/src/stores.types.ts
@@ -0,0 +1,378 @@
1export interface FerdiStores {
2 app: AppStore;
3 communityRecipes: CommunityRecipesStore;
4 features: FeaturesStore;
5 globalError: GlobalErrorStore;
6 news: NewsStore;
7 recipePreviews: RecipePreviewsStore;
8 recipes: RecipeStore;
9 requests: RequestsStore;
10 router: RouterStore;
11 services: ServicesStore;
12 settings: SettingsStore;
13 todos: TodosStore;
14 ui: UIStore;
15 user: UserStore;
16 workspaces: WorkspacesStore;
17}
18
19interface Stores {
20 app: AppStore;
21 communityRecipes: CommunityRecipesStore;
22 features: FeaturesStore;
23 globalError: GlobalErrorStore;
24 news: NewsStore;
25 recipePreviews: RecipePreviewsStore;
26 recipes: RecipeStore;
27 requests: RequestsStore;
28 router: RouterStore;
29 services: ServicesStore;
30 settings: SettingsStore;
31 todos: TodosStore;
32 ui: UIStore;
33 user: UserStore;
34 workspaces: WorkspacesStore;
35}
36
37interface Actions {
38 app: AppStore;
39 news: NewsStore;
40 recipePreviews: RecipePreviewsStore;
41 recipes: RecipeStore;
42 requests: RequestsStore;
43 services: ServicesStore;
44 settings: SettingsStore;
45 todos: TodosStore;
46 ui: UIStore;
47 user: UserStore;
48 workspaces: WorkspacesStore;
49}
50
51interface Api {
52 app: AppStore;
53 features: FeaturesStore;
54 local: {};
55 news: NewsStore;
56 recipePreviews: RecipePreviewsStore;
57 recipes: RecipeStore;
58 services: ServicesStore;
59 user: UserStore;
60}
61
62interface AppStore {
63 actions: Actions;
64 accentColor: string;
65 api: Api;
66 authRequestFailed: () => void;
67 autoLaunchOnStart: () => void;
68 clearAppCacheRequest: () => void;
69 dictionaries: [];
70 fetchDataInterval: 4;
71 getAppCacheSizeRequest: () => void;
72 healthCheckRequest: () => void;
73 isClearingAllCache: () => void;
74 isFocused: () => void;
75 isFullScreen: () => void;
76 isOnline: () => void;
77 isSystemDarkModeEnabled: () => void;
78 isSystemMuteOverridden: () => void;
79 locale: () => void;
80 stores: Stores;
81 timeOfflineStart: () => void;
82 timeSuspensionStart: () => void;
83 updateStatus: () => void;
84 updateStatusTypes: {
85 CHECKING: 'CHECKING';
86 AVAILABLE: 'AVAILABLE';
87 NOT_AVAILABLE: 'NOT_AVAILABLE';
88 DOWNLOADED: 'DOWNLOADED';
89 FAILED: 'FAILED';
90 };
91 _reactions: any[];
92 _status: () => void;
93 actionStatus: () => void;
94 cacheSize: () => void;
95 debugInfo: () => void;
96}
97
98interface CommunityRecipesStore {
99 actions: Actions;
100 stores: Stores;
101 _actions: [];
102 _reactions: [];
103 communityRecipes: () => void;
104}
105
106interface FeaturesStore {
107 actions: Actions;
108 api: Api;
109 defaultFeaturesRequest: () => void;
110 features: () => void;
111 featuresRequest: () => void;
112 stores: Stores;
113 _reactions: any[];
114 _status: () => void;
115 _updateFeatures: () => void;
116 actionStatus: () => void;
117 anonymousFeatures: () => void;
118}
119
120interface GlobalErrorStore {
121 actions: Actions;
122 api: Api;
123 error: () => void;
124 messages: () => void;
125 response: () => void;
126 stores: Stores;
127 _handleRequests: () => void;
128 _reactions: [];
129 _status: () => void;
130 actionStatus: () => void;
131}
132
133interface NewsStore {
134 actions: Actions;
135 api: Api;
136 hideNewsRequest: () => void;
137 latestNewsRequest: () => void;
138 stores: Stores;
139 _reactions: [];
140 _status: () => void;
141 actionStatus: () => void;
142 latest: () => void;
143}
144
145interface RecipePreviewsStore {
146 actions: Actions;
147 allRecipePreviewsRequest: () => void;
148 api: Api;
149 searchRecipePreviewsRequest: () => void;
150 stores: Stores;
151 _reactions: [];
152 _status: () => void;
153 actionStatus: () => void;
154 all: () => void;
155 dev: () => void;
156 searchResults: () => void;
157}
158
159interface RecipeStore {
160 actions: Actions;
161 allRecipesRequest: () => void;
162 api: Api;
163 getRecipeUpdatesRequest: () => void;
164 installRecipeRequest: () => void;
165 stores: Stores;
166 _reactions: any[];
167 _status: () => void;
168 actionStatus: () => void;
169 active: () => void;
170 all: () => void;
171 recipeIdForServices: () => void;
172}
173
174interface RequestsStore {
175 actions: Actions;
176 api: Api;
177 localServerPort: () => void;
178 retries: number;
179 retryDelay: number;
180 servicesRequest: () => void;
181 showRequiredRequestsError: () => void;
182 stores: Stores;
183 userInfoRequest: () => void;
184 _reactions: any[];
185 _status: () => void;
186 actionStatus: () => void;
187 areRequiredRequestsLoading: () => void;
188 areRequiredRequestsSuccessful: () => void;
189}
190
191interface RouterStore {
192 go: () => void;
193 goBack: () => void;
194 goForward: () => void;
195 history: () => void;
196 location: () => void;
197 push: () => void;
198 replace: () => void;
199}
200
201interface ServicesStore {
202 actions: Actions;
203 api: Api;
204 clearCacheRequest: () => void;
205 createServiceRequest: () => void;
206 deleteServiceRequest: () => void;
207 filterNeedle: () => void;
208 lastUsedServices: () => void;
209 reorderServicesRequest: () => void;
210 serviceMaintenanceTick: () => void;
211 stores: Stores;
212 updateServiceRequest: () => void;
213 _reactions: any[];
214 _status: () => void;
215 actionStatus: () => void;
216 active: () => void;
217 activeSettings: () => void;
218 all: () => void;
219 allDisplayed: () => void;
220 allDisplayedUnordered: () => void;
221 enabled: () => void;
222 filtered: () => void;
223 isTodosServiceActive: () => void;
224 isTodosServiceAdded: () => void;
225}
226
227interface SettingsStore {
228 actions: Actions;
229 api: Api;
230 fileSystemSettingsTypes: any[];
231 startup: boolean;
232 stores: Stores;
233 updateAppSettingsRequest: () => void;
234 _fileSystemSettingsCache: () => void;
235 _reactions: [];
236 _status: () => void;
237 actionStatus: () => void;
238 all: () => void;
239 app: AppStore;
240 migration: () => void;
241 proxy: () => void;
242 service: ServicesStore;
243 stats: () => void;
244}
245
246interface TodosStore {
247 actions: Actions;
248 api: Api;
249 isFeatureActive: () => void;
250 isFeatureEnabled: () => void;
251 isInitialized: true;
252 stores: Stores;
253 userAgentModel: () => void;
254 webview: () => void;
255 _actions: any[];
256 _allReactions: any[];
257 _firstLaunchReaction: () => void;
258 _goToService: () => void;
259 _handleNewWindowEvent: () => void;
260 _onTodosClientInitialized: () => void;
261 _openDevTools: () => void;
262 _reactions: any[];
263 _reload: () => void;
264 _routeCheckReaction: () => void;
265 _setFeatureEnabledReaction: () => void;
266 _updateSettings: () => void;
267 _updateTodosConfig: () => void;
268 isFeatureEnabledByUser: () => void;
269 isTodoUrlValid: () => void;
270 isTodosPanelForceHidden: () => void;
271 isTodosPanelVisible: () => void;
272 isUsingPredefinedTodoServer: () => void;
273 settings: () => void;
274 todoRecipeId: () => void;
275 todoUrl: () => void;
276 userAgent: () => void;
277 width: () => void;
278 _handleClientMessage: () => void;
279 _handleHostMessage: () => void;
280 _resize: () => void;
281 _setTodosWebview: () => void;
282 _toggleTodosFeatureVisibility: () => void;
283 _toggleTodosPanel: () => void;
284}
285
286interface UIStore {
287 actions: Actions;
288 api: Api;
289 isOsDarkThemeActive: () => void;
290 showServicesUpdatedInfoBar: () => void;
291 stores: Stores;
292 _reactions: [];
293 _status: () => void;
294 actionStatus: () => void;
295 isDarkThemeActive: () => void;
296 isSplitModeActive: () => void;
297 showMessageBadgesEvenWhenMuted: () => void;
298 theme: () => void;
299}
300
301interface UserStore {
302 BASE_ROUTE: '/auth';
303 CHANGE_SERVER_ROUTE: '/auth/server';
304 IMPORT_ROUTE: '/auth/signup/import';
305 INVITE_ROUTE: '/auth/signup/invite';
306 LOGIN_ROUTE: '/auth/login';
307 LOGOUT_ROUTE: '/auth/logout';
308 PASSWORD_ROUTE: '/auth/password';
309 SETUP_ROUTE: '/auth/signup/setup';
310 SIGNUP_ROUTE: '/auth/signup';
311 WELCOME_ROUTE: '/auth/welcome';
312 accountType: () => void;
313 actionStatus: () => void;
314 actions: Actions;
315 api: Api;
316 authToken: () => void;
317 deleteAccountRequest: () => void;
318 fetchUserInfoInterval: null;
319 getLegacyServicesRequest: () => void;
320 getUserInfoRequest: () => void;
321 hasCompletedSignup: () => void;
322 id: () => void;
323 inviteRequest: () => void;
324 isImportLegacyServicesCompleted: () => void;
325 isImportLegacyServicesExecuting: () => void;
326 isLoggingOut: () => void;
327 loginRequest: () => void;
328 logoutReason: () => void;
329 logoutReasonTypes: { SERVER: 'SERVER' };
330 passwordRequest: () => void;
331 signupRequest: () => void;
332 stores: Stores;
333 updateUserInfoRequest: () => void;
334 userData: () => void;
335 _reactions: any[];
336 _requireAuthenticatedUser: () => void;
337 _status: () => void;
338 changeServerRoute: () => void;
339 data: () => void;
340 importRoute: () => void;
341 inviteRoute: () => void;
342 isLoggedIn: () => void;
343 isTokenExpired: () => void;
344 legacyServices: () => void;
345 loginRoute: () => void;
346 logoutRoute: () => void;
347 passwordRoute: () => void;
348 setupRoute: () => void;
349 signupRoute: () => void;
350 team: () => void;
351}
352
353interface WorkspacesStore {
354 activeWorkspace: () => void;
355 filterServicesByActiveWorkspace: () => void;
356 isFeatureActive: () => void;
357 isFeatureEnabled: () => void;
358 isSettingsRouteActive: () => void;
359 isSwitchingWorkspace: () => void;
360 isWorkspaceDrawerOpen: () => void;
361 nextWorkspace: () => void;
362 stores: Stores;
363 workspaceBeingEdited: () => void;
364 _actions: any[];
365 _activateLastUsedWorkspaceReaction: () => void;
366 _allActions: any[];
367 _allReactions: any[];
368 _cleanupInvalidServiceReferences: () => void;
369 _getWorkspaceById: () => void;
370 _openDrawerWithSettingsReaction: () => void;
371 _reactions: any[];
372 _setActiveServiceOnWorkspaceSwitchReaction: () => void;
373 _setFeatureEnabledReaction: () => void;
374 _setWorkspaceBeingEditedReaction: () => void;
375 _toggleKeepAllWorkspacesLoadedSetting: () => void;
376 _updateSettings: () => void;
377 _wasDrawerOpenBeforeSettingsRoute: null;
378}