@todesktop/shared 7.189.25 → 7.191.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/.legacy-sync.json +6 -0
  2. package/.prettierignore +0 -2
  3. package/CHANGELOG.md +13 -0
  4. package/README.md +42 -15
  5. package/eslint.config.mjs +8 -55
  6. package/lib/base.d.ts +81 -75
  7. package/lib/base.js +9 -12
  8. package/lib/desktopify.d.ts +74 -74
  9. package/lib/desktopify.js +28 -35
  10. package/lib/desktopify2.d.ts +224 -220
  11. package/lib/desktopify2.js +2 -5
  12. package/lib/getSiteInfo.d.ts +6 -6
  13. package/lib/getSiteInfo.js +1 -2
  14. package/lib/hsm.d.ts +1 -1
  15. package/lib/hsm.js +5 -12
  16. package/lib/index.d.ts +12 -13
  17. package/lib/index.js +13 -31
  18. package/lib/invitePermissionLabels.d.ts +4 -2
  19. package/lib/invitePermissionLabels.js +14 -11
  20. package/lib/personalAccessTokens.d.ts +12 -12
  21. package/lib/personalAccessTokens.js +1 -2
  22. package/lib/plans.d.ts +27 -27
  23. package/lib/plans.js +181 -185
  24. package/lib/plugin.d.ts +23 -14
  25. package/lib/plugin.js +1 -2
  26. package/lib/toDesktop.d.ts +66 -66
  27. package/lib/toDesktop.js +1 -2
  28. package/lib/translation.d.ts +1 -1
  29. package/lib/translation.js +1 -2
  30. package/lib/validations.d.ts +66 -66
  31. package/lib/validations.js +54 -56
  32. package/package.json +11 -17
  33. package/src/base.ts +89 -82
  34. package/src/desktopify.ts +82 -80
  35. package/src/desktopify2.ts +241 -237
  36. package/src/getSiteInfo.ts +6 -6
  37. package/src/hsm.ts +7 -7
  38. package/src/index.ts +13 -14
  39. package/src/invitePermissionLabels.ts +20 -6
  40. package/src/personalAccessTokens.ts +12 -12
  41. package/src/plans.ts +191 -191
  42. package/src/plugin.ts +24 -14
  43. package/src/toDesktop.ts +70 -70
  44. package/src/translation.ts +2 -2
  45. package/src/validations.ts +51 -49
  46. package/tsconfig.json +6 -3
  47. package/.prettierrc +0 -5
package/lib/plugin.d.ts CHANGED
@@ -1,46 +1,55 @@
1
1
  type AjvJSONSchemaType = object;
2
2
  export interface DesktopAppPlugin {
3
- /**
4
- * Configuration gathered from the todesktop plugin.
5
- * Named `todesktop` to clarify that it maps to the `todesktop` key on the package.json
6
- */
7
- todesktop?: ToDesktopPlugin;
8
3
  /**
9
4
  * Package name, including version information.
10
5
  * e.g. "@todesktop/plugin-foo", "@todesktop/plugin-baz@1.0.0"
11
6
  */
12
7
  package: string;
8
+ /**
9
+ * Configuration gathered from the todesktop plugin.
10
+ * Named `todesktop` to clarify that it maps to the `todesktop` key on the package.json
11
+ */
12
+ todesktop?: ToDesktopPlugin;
13
+ }
14
+ export interface CustomPlugin {
15
+ addedAt: string;
16
+ description?: string;
17
+ displayName?: string;
18
+ lastLinkedAt?: string;
19
+ packageName: string;
20
+ sourcePath: string;
21
+ todesktop: ToDesktopPlugin;
13
22
  }
14
23
  export type ToDesktopPlugin = {
15
- namespace: string;
16
- version: number;
17
24
  main?: string;
18
- preload?: string;
25
+ namespace: string;
19
26
  preferences?: PluginPreferences;
27
+ preload?: string;
28
+ version: number;
20
29
  };
21
30
  export type PluginPreferences = {
22
31
  [id: string]: PluginPreference;
23
32
  };
24
- export type PluginPreference = NumberSpec | TextSpec | CheckboxSpec;
33
+ export type PluginPreference = CheckboxSpec | NumberSpec | TextSpec;
25
34
  export type TextSpec = PreferenceSpec<'text', {
35
+ placeholder?: string;
26
36
  validator?: AjvJSONSchemaType;
27
37
  value?: string;
28
- placeholder?: string;
29
38
  }>;
30
39
  export type NumberSpec = PreferenceSpec<'number', {
40
+ placeholder?: number;
31
41
  validator?: AjvJSONSchemaType;
32
42
  value?: number;
33
- placeholder?: number;
34
43
  }>;
35
44
  export type CheckboxSpec = PreferenceSpec<'checkbox', {
36
45
  validator?: AjvJSONSchemaType;
37
46
  value?: boolean;
38
47
  }>;
39
48
  interface PreferenceSpec<T, V> {
40
- name: string;
41
49
  description: string;
42
- type: T;
43
- spec: V;
50
+ name: string;
44
51
  order?: number;
52
+ spec: V;
53
+ type: T;
45
54
  }
46
55
  export {};
package/lib/plugin.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,23 +1,23 @@
1
1
  import { BaseApp, Schemable } from './base';
2
2
  import { IAppBuilderLib } from './desktopify';
3
3
  import { PatSummary } from './personalAccessTokens';
4
- export type IUploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed';
4
+ export type IUploadFileStatus = 'done' | 'error' | 'removed' | 'success' | 'uploading';
5
5
  export interface IUploadFile {
6
- uid: string;
7
- size: number;
8
- name: string;
6
+ error?: any;
9
7
  fileName?: string;
10
8
  lastModified?: number;
11
9
  lastModifiedDate?: Date;
12
- url?: string;
13
- status?: IUploadFileStatus;
14
- percent?: number;
15
- thumbUrl?: string;
10
+ linkProps?: any;
11
+ name: string;
16
12
  originFileObj?: File;
13
+ percent?: number;
17
14
  response?: any;
18
- error?: any;
19
- linkProps?: any;
15
+ size: number;
16
+ status?: IUploadFileStatus;
17
+ thumbUrl?: string;
20
18
  type: string;
19
+ uid: string;
20
+ url?: string;
21
21
  }
22
22
  export interface IHueIcon extends IUploadFile {
23
23
  hueAdjustment?: number;
@@ -28,44 +28,44 @@ export interface IAppIcon {
28
28
  }
29
29
  export type IAppIcons = IAppIcon[];
30
30
  export interface IAppWindowOptions {
31
- startInFullscreenMode: boolean;
32
- isResizable: boolean;
33
- width: number;
34
- height: number;
35
- hasMinWidth: boolean;
36
- hasMinHeight: boolean;
37
- hasMaxWidth: boolean;
31
+ alwaysOnTop: boolean;
32
+ autoHideMenuBar: boolean;
38
33
  hasMaxHeight: boolean;
39
- minWidth: number;
40
- minHeight: number;
41
- maxWidth: number;
42
- maxHeight: number;
34
+ hasMaxWidth: boolean;
35
+ hasMinHeight: boolean;
36
+ hasMinWidth: boolean;
37
+ height: number;
43
38
  isMaximizable: boolean;
44
39
  isMinimizable: boolean;
45
- transparentTitlebar: boolean;
46
- alwaysOnTop: boolean;
40
+ isResizable: boolean;
41
+ maxHeight: number;
42
+ maxWidth: number;
43
+ minHeight: number;
44
+ minWidth: number;
45
+ startInFullscreenMode: boolean;
47
46
  transparentInsetTitlebar: boolean;
48
- autoHideMenuBar: boolean;
47
+ transparentTitlebar: boolean;
48
+ width: number;
49
49
  }
50
50
  export interface IWindowOptions {
51
+ height: number;
51
52
  isAlwaysOnTop?: boolean;
52
53
  isAutoHideMenuBar?: boolean;
54
+ isFullScreenStartEnabled?: boolean;
55
+ isInsetTitlebarTransparent?: boolean;
53
56
  isMaximizable: boolean;
54
57
  isMinimizable: boolean;
55
58
  isResizable: boolean;
56
- isInsetTitlebarTransparent?: boolean;
57
59
  isTitlebarTransparent?: boolean;
58
- isFullScreenStartEnabled?: boolean;
59
- width: number;
60
- height: number;
61
60
  maxHeight?: ISwitchableValue<number>;
62
- minHeight?: ISwitchableValue<number>;
63
61
  maxWidth?: ISwitchableValue<number>;
62
+ minHeight?: ISwitchableValue<number>;
64
63
  minWidth?: ISwitchableValue<number>;
64
+ width: number;
65
65
  }
66
66
  export interface IAppPublishedVersions {
67
- electron?: string;
68
67
  desktopify?: string;
68
+ electron?: string;
69
69
  version?: string;
70
70
  }
71
71
  export interface ISwitchableValue<T> {
@@ -73,10 +73,10 @@ export interface ISwitchableValue<T> {
73
73
  value: T;
74
74
  }
75
75
  export interface IIcon {
76
- url: string;
77
- width: number;
78
76
  height: number;
79
77
  type: string;
78
+ url: string;
79
+ width: number;
80
80
  }
81
81
  export interface IApp extends BaseApp {
82
82
  appModelId: string;
@@ -88,104 +88,104 @@ export interface IApp extends BaseApp {
88
88
  customDomain?: string;
89
89
  customUserAgent?: ISwitchableValue<string>;
90
90
  disableContextMenu?: boolean;
91
+ enablePushNotifications?: boolean;
91
92
  environmentVariables?: {
92
- [propertyName: string]: string | {
93
+ [propertyName: string]: {
93
94
  secret: string;
94
- };
95
+ } | string;
95
96
  };
97
+ extraBrowserWindowOptions?: string;
96
98
  icon?: string;
97
99
  icons?: IIcon[];
98
100
  internalUrls?: ISwitchableValue<string>;
101
+ isBackgroundThrottlingPrevented?: boolean;
99
102
  isContextMenuDisabled: boolean;
100
103
  isDevToolsDisabled: boolean;
101
104
  isFindInPageEnabled?: boolean;
105
+ isGoogleOAuthExternal?: boolean;
102
106
  isNativeWindowOpenDisabled?: boolean;
103
107
  isSingleInstance?: boolean;
104
- isWebSecurityDisabled?: boolean;
105
- isBackgroundThrottlingPrevented?: boolean;
106
- isGoogleOAuthExternal?: boolean;
107
108
  isTitleStatic?: boolean;
108
- shouldMakeSameDomainAnExternalLink?: boolean;
109
- shouldUseRealUserAgent?: boolean;
110
- extraBrowserWindowOptions?: string;
111
- enablePushNotifications?: boolean;
112
109
  isTransitioningFromSquirrelWindows?: boolean;
110
+ isWebSecurityDisabled?: boolean;
113
111
  jsToInject?: string;
114
112
  menubarIcon?: string;
115
113
  name: string;
116
114
  nsisConfig?: Partial<IAppBuilderLib['config']['nsis']>;
115
+ pollForAppUpdatesEveryXMinutes?: number;
117
116
  runtimeEnvs?: string;
118
117
  secret?: string;
119
118
  shouldLaunchAtStartupByDefault?: boolean;
119
+ shouldMakeSameDomainAnExternalLink?: boolean;
120
120
  shouldOnlySendAbsolutelyNecessaryRequests?: boolean;
121
121
  shouldReuseRendererProcess?: boolean;
122
- themeSource?: 'system' | 'light' | 'dark';
123
- themeSourceMac?: 'system' | 'light' | 'dark';
122
+ shouldUseRealUserAgent?: boolean;
123
+ themeSource?: 'dark' | 'light' | 'system';
124
+ themeSourceMac?: 'dark' | 'light' | 'system';
124
125
  toggleVisibilityKeyboardShortcut?: ISwitchableValue<string>;
125
126
  trayIcon?: string;
126
127
  url: string;
127
- windowOptions: IWindowOptions;
128
- pollForAppUpdatesEveryXMinutes?: number;
129
128
  useSafeInternalUrlMatcher?: boolean;
129
+ windowOptions: IWindowOptions;
130
130
  }
131
131
  export interface IUser extends Schemable {
132
- id: string;
132
+ accessToken?: string;
133
+ allowedIPs?: string[];
133
134
  authInfo?: object;
134
135
  avatar?: string;
136
+ cliAccessTokens?: PatSummary[];
135
137
  currentApplication?: string;
136
138
  customerId?: string;
139
+ disableShouldCodeSign?: boolean;
137
140
  email?: string;
141
+ featureFlags?: FeatureFlags;
138
142
  firstName?: string;
139
- lastName?: string;
140
- stripeCustomerId?: string;
141
- isOldAccountThatNeedsNewPassword?: boolean;
142
- accessToken?: string;
143
- cliAccessTokens?: PatSummary[];
143
+ id: string;
144
144
  isAdmin?: boolean;
145
145
  isImpersonator?: boolean;
146
- featureFlags?: FeatureFlags;
147
- disableShouldCodeSign?: boolean;
148
- allowedIPs?: string[];
149
- seenReleaseTutorial?: boolean;
146
+ isOldAccountThatNeedsNewPassword?: boolean;
147
+ lastName?: string;
150
148
  seenApplicationGroupsTutorial?: boolean;
149
+ seenReleaseTutorial?: boolean;
150
+ stripeCustomerId?: string;
151
151
  }
152
152
  export interface FeatureFlags {
153
+ aboutBlankWindowOpenHandler: boolean;
153
154
  desktopAppPlugins: boolean;
154
155
  macAppStore: boolean;
155
- aboutBlankWindowOpenHandler: boolean;
156
156
  }
157
157
  export interface InvitePermissions {
158
158
  canBuild: boolean;
159
- canRelease: boolean;
160
159
  canManageBilling?: boolean;
161
160
  canManageUsers?: boolean;
161
+ canRelease: boolean;
162
162
  }
163
- export type InviteActorRole = 'owner' | 'delegate';
163
+ export type InviteActorRole = 'delegate' | 'owner';
164
164
  export interface InviteActorCapabilities {
165
- actorId: string;
166
165
  actorEmail: string;
167
- actorRole: InviteActorRole;
166
+ actorId: string;
168
167
  actorPermissions: InvitePermissions;
168
+ actorRole: InviteActorRole;
169
169
  }
170
170
  export interface UserIHaveSentInviteTo {
171
171
  email: string;
172
- permissions?: InvitePermissions;
172
+ inviterCapabilities?: InviteActorCapabilities;
173
173
  name: string;
174
+ permissions?: InvitePermissions;
174
175
  sender: UserIHaveAcceptedInviteFrom;
175
- inviterCapabilities?: InviteActorCapabilities;
176
176
  }
177
177
  export interface UserIHaveAcceptedInviteFrom {
178
- id: string;
179
178
  email: string;
180
179
  firstName: string;
180
+ id: string;
181
181
  lastName: string;
182
- receiver?: Pick<IUser, 'id' | 'email'>;
183
182
  permissions?: InvitePermissions;
183
+ receiver?: Pick<IUser, 'email' | 'id'>;
184
184
  }
185
185
  export interface CiInput {
186
+ accessToken: string;
186
187
  appData: IApp;
187
188
  buildId?: string;
188
- userId: string;
189
189
  contextUserId: string;
190
- accessToken: string;
190
+ userId: string;
191
191
  }
package/lib/toDesktop.js CHANGED
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,2 +1,2 @@
1
- export type ValidTranslationKeys = 'updateNotification.title' | 'updateNotification.body';
1
+ export type ValidTranslationKeys = 'updateNotification.body' | 'updateNotification.title';
2
2
  export type ValidTranslationLanguages = 'default';
@@ -1,5 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  /* TODO - Support more languages here */
4
3
  // | "en"
5
4
  // | "es"
@@ -15,88 +15,88 @@ export declare const widthValidation: yup.NumberSchema<number, yup.AnyObject, un
15
15
  export declare const internalAppRegexValidation: yup.StringSchema<string, yup.AnyObject, undefined, "">;
16
16
  export declare const appProtocolValidation: yup.StringSchema<string, yup.AnyObject, undefined, "">;
17
17
  export declare const appConfigValidation: yup.ObjectSchema<{
18
- id: string;
19
- name: string;
20
- url: string;
21
- isFrameBlocked: boolean;
22
- iconUrl: string;
23
- disableDevTools: boolean;
24
- singleInstance: boolean;
25
18
  customUserAgent: string;
19
+ disableDevTools: NonNullable<boolean | undefined>;
20
+ iconUrl: string;
21
+ id: string;
26
22
  internalURLs: string;
23
+ isFrameBlocked: NonNullable<boolean | undefined>;
24
+ meta: {
25
+ schemaVersion: number;
26
+ appIterations: number;
27
+ hasAppChanged: NonNullable<boolean | undefined>;
28
+ publishedVersions: {
29
+ electron?: yup.Maybe<string | undefined>;
30
+ version?: yup.Maybe<string | undefined>;
31
+ desktopify?: yup.Maybe<string | undefined>;
32
+ };
33
+ };
34
+ name: string;
27
35
  secret: string;
36
+ singleInstance: NonNullable<boolean | undefined>;
37
+ url: string;
28
38
  windowOptions: {
29
- alwaysOnTop?: boolean;
30
- autoHideMenuBar?: boolean;
31
- height?: number;
32
- maxHeight?: number;
33
- maxWidth?: number;
34
- minHeight?: number;
35
- minWidth?: number;
36
- width?: number;
37
- startInFullscreenMode?: boolean;
38
- isResizable?: boolean;
39
- hasMinWidth?: boolean;
40
- hasMinHeight?: boolean;
41
- hasMaxWidth?: boolean;
42
- hasMaxHeight?: boolean;
43
- isMaximizable?: boolean;
44
- isMinimizable?: boolean;
45
- isFullscreenable?: boolean;
46
- transparentTitlebar?: boolean;
47
- transparentInsetTitlebar?: boolean;
39
+ alwaysOnTop: NonNullable<boolean | undefined>;
40
+ autoHideMenuBar: NonNullable<boolean | undefined>;
41
+ height: number;
42
+ maxHeight: number;
43
+ maxWidth: number;
44
+ minHeight: number;
45
+ minWidth: number;
46
+ width: number;
47
+ hasMaxHeight: NonNullable<boolean | undefined>;
48
+ hasMaxWidth: NonNullable<boolean | undefined>;
49
+ hasMinHeight: NonNullable<boolean | undefined>;
50
+ hasMinWidth: NonNullable<boolean | undefined>;
51
+ isFullscreenable: NonNullable<boolean | undefined>;
52
+ isMaximizable: NonNullable<boolean | undefined>;
53
+ isMinimizable: NonNullable<boolean | undefined>;
54
+ isResizable: NonNullable<boolean | undefined>;
55
+ startInFullscreenMode: NonNullable<boolean | undefined>;
56
+ transparentInsetTitlebar: NonNullable<boolean | undefined>;
57
+ transparentTitlebar: NonNullable<boolean | undefined>;
48
58
  };
59
+ }, yup.AnyObject, {
60
+ customUserAgent: undefined;
61
+ disableDevTools: undefined;
62
+ iconUrl: undefined;
63
+ id: undefined;
64
+ internalURLs: undefined;
65
+ isFrameBlocked: undefined;
49
66
  meta: {
50
- schemaVersion?: number;
51
- hasAppChanged?: boolean;
52
- appIterations?: number;
53
- publishedVersions?: {
54
- electron?: string;
55
- desktopify?: string;
56
- version?: string;
67
+ appIterations: undefined;
68
+ hasAppChanged: undefined;
69
+ publishedVersions: {
70
+ desktopify: undefined;
71
+ electron: undefined;
72
+ version: undefined;
57
73
  };
74
+ schemaVersion: undefined;
58
75
  };
59
- }, yup.AnyObject, {
60
- id: undefined;
61
76
  name: undefined;
62
- url: undefined;
63
- isFrameBlocked: undefined;
64
- iconUrl: undefined;
65
- disableDevTools: undefined;
66
- singleInstance: undefined;
67
- customUserAgent: undefined;
68
- internalURLs: undefined;
69
77
  secret: undefined;
78
+ singleInstance: undefined;
79
+ url: undefined;
70
80
  windowOptions: {
71
- startInFullscreenMode: undefined;
72
- isResizable: undefined;
73
- width: undefined;
74
- height: undefined;
75
- hasMinWidth: undefined;
76
- hasMinHeight: undefined;
77
- hasMaxWidth: undefined;
78
81
  hasMaxHeight: undefined;
79
- minWidth: undefined;
80
- minHeight: undefined;
81
- maxWidth: undefined;
82
- maxHeight: undefined;
82
+ hasMaxWidth: undefined;
83
+ hasMinHeight: undefined;
84
+ hasMinWidth: undefined;
85
+ height: undefined;
86
+ isFullscreenable: undefined;
83
87
  isMaximizable: undefined;
84
88
  isMinimizable: undefined;
85
- isFullscreenable: undefined;
86
- transparentTitlebar: undefined;
89
+ isResizable: undefined;
90
+ maxHeight: undefined;
91
+ maxWidth: undefined;
92
+ minHeight: undefined;
93
+ minWidth: undefined;
94
+ startInFullscreenMode: undefined;
95
+ width: undefined;
87
96
  alwaysOnTop: undefined;
88
- transparentInsetTitlebar: undefined;
89
97
  autoHideMenuBar: undefined;
90
- };
91
- meta: {
92
- schemaVersion: undefined;
93
- hasAppChanged: undefined;
94
- appIterations: undefined;
95
- publishedVersions: {
96
- electron: undefined;
97
- desktopify: undefined;
98
- version: undefined;
99
- };
98
+ transparentInsetTitlebar: undefined;
99
+ transparentTitlebar: undefined;
100
100
  };
101
101
  }, "">;
102
102
  export declare const shouldMinimizeToTrayIsActive: <Plugin = DesktopAppPlugin>(desktopApp: DesktopifyApp2<Plugin>) => boolean;
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shouldMinimizeToTrayIsActive = exports.appConfigValidation = exports.appProtocolValidation = exports.internalAppRegexValidation = exports.widthValidation = exports.heightValidation = exports.urlValidationForm = exports.urlValidation = exports.iconValidation = exports.forceVersionValidation = exports.appTitleValidation = void 0;
4
- const yup = require("yup");
5
- const semver = require("semver");
6
- const isRegex = require("is-regex");
7
- exports.appTitleValidation = yup
1
+ import isRegex from 'is-regex';
2
+ import semver from 'semver';
3
+ import * as yup from 'yup';
4
+ export const appTitleValidation = yup
8
5
  .string()
9
6
  .label('App title')
10
7
  .max(26)
@@ -12,9 +9,9 @@ exports.appTitleValidation = yup
12
9
  .matches(/^[^\s]+(\s+[^\s]+)*$/, 'App title may not begin or end with space')
13
10
  .required();
14
11
  function isNumeric(str) {
15
- if (typeof str != 'string')
12
+ if (typeof str !== 'string')
16
13
  return false;
17
- return !isNaN(Number(str)) && !isNaN(parseFloat(str));
14
+ return !Number.isNaN(Number(str)) && !Number.isNaN(parseFloat(str));
18
15
  }
19
16
  function isNumericSemver(value) {
20
17
  // check if valid semver
@@ -25,7 +22,7 @@ function isNumericSemver(value) {
25
22
  return false;
26
23
  return true;
27
24
  }
28
- exports.forceVersionValidation = yup
25
+ export const forceVersionValidation = yup
29
26
  .string()
30
27
  .label('App version')
31
28
  .required()
@@ -34,35 +31,35 @@ exports.forceVersionValidation = yup
34
31
  return (isNumericSemver(forceVersion) &&
35
32
  semver.gt(forceVersion, currentVersion));
36
33
  }));
37
- exports.iconValidation = yup
34
+ export const iconValidation = yup
38
35
  .string()
39
36
  .label('Icon')
40
37
  .url()
41
38
  .required('You must upload an icon for your app');
42
- exports.urlValidation = yup
39
+ export const urlValidation = yup
43
40
  .string()
44
41
  .matches(/^(?:([a-z0-9+.-]+):\/\/)(?:\S+(?::\S*)?@)?(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*\.?)(?::\d{2,5})?(?:[/?#]\S*)?$/, {
45
- message: "Invalid URL. Don't forget to include the protocol (e.g.. https://).",
46
42
  excludeEmptyString: true,
43
+ message: "Invalid URL. Don't forget to include the protocol (e.g.. https://).",
47
44
  })
48
45
  .label('Website URL')
49
46
  .required();
50
- exports.urlValidationForm = yup.object().shape({
51
- url: exports.urlValidation,
47
+ export const urlValidationForm = yup.object().shape({
48
+ url: urlValidation,
52
49
  });
53
- exports.heightValidation = yup
50
+ export const heightValidation = yup
54
51
  .number()
55
52
  .label('Height')
56
53
  .moreThan(1)
57
54
  .lessThan(2000)
58
55
  .required();
59
- exports.widthValidation = yup
56
+ export const widthValidation = yup
60
57
  .number()
61
58
  .label('Width')
62
59
  .moreThan(1)
63
60
  .lessThan(3000)
64
61
  .required();
65
- exports.internalAppRegexValidation = yup
62
+ export const internalAppRegexValidation = yup
66
63
  .string()
67
64
  .required()
68
65
  .label('Internal URLs')
@@ -78,8 +75,10 @@ exports.internalAppRegexValidation = yup
78
75
  }
79
76
  return true;
80
77
  })
81
- .test('is-regex', '${path} must be valid regular expression', (value) => isRegex(RegExp(value)));
82
- exports.appProtocolValidation = yup
78
+ .test('is-regex',
79
+ // eslint-disable-next-line no-template-curly-in-string
80
+ '${path} must be valid regular expression', (value) => isRegex(RegExp(value)));
81
+ export const appProtocolValidation = yup
83
82
  .string()
84
83
  .required()
85
84
  .label('App Protocol')
@@ -87,54 +86,53 @@ exports.appProtocolValidation = yup
87
86
  .test('is-lowercase', 'Protocols must be lowercase', (value) => value === value.toLowerCase())
88
87
  .matches(/^[a-zA-Z-.]+:\/\/$/, 'Protocols contain letters, dots (.) and dashes (-) only')
89
88
  .min(5);
90
- exports.appConfigValidation = yup.object({
91
- id: yup.string().required(),
92
- name: exports.appTitleValidation,
93
- url: exports.urlValidation,
94
- isFrameBlocked: yup.boolean().required(),
95
- iconUrl: exports.iconValidation,
96
- disableDevTools: yup.boolean().required(),
97
- singleInstance: yup.boolean().required(),
89
+ export const appConfigValidation = yup.object({
98
90
  customUserAgent: yup.string().required(),
91
+ disableDevTools: yup.boolean().required(),
92
+ iconUrl: iconValidation,
93
+ id: yup.string().required(),
99
94
  internalURLs: yup.string().required(),
95
+ isFrameBlocked: yup.boolean().required(),
96
+ meta: yup
97
+ .object({
98
+ appIterations: yup.number().required(),
99
+ hasAppChanged: yup.boolean().required(),
100
+ publishedVersions: yup.object({
101
+ desktopify: yup.string().notRequired(),
102
+ electron: yup.string().notRequired(),
103
+ version: yup.string().notRequired(),
104
+ }),
105
+ schemaVersion: yup.number().required(),
106
+ })
107
+ .required(),
108
+ name: appTitleValidation,
100
109
  secret: yup.string().required(),
110
+ singleInstance: yup.boolean().required(),
111
+ url: urlValidation,
101
112
  windowOptions: yup
102
113
  .object({
103
- startInFullscreenMode: yup.boolean().required(),
104
- isResizable: yup.boolean().required(),
105
- width: yup.number().required(),
106
- height: yup.number().required(),
107
- hasMinWidth: yup.boolean().required(),
108
- hasMinHeight: yup.boolean().required(),
109
- hasMaxWidth: yup.boolean().required(),
110
114
  hasMaxHeight: yup.boolean().required(),
111
- minWidth: yup.number().required(),
112
- minHeight: yup.number().required(),
113
- maxWidth: yup.number().required(),
114
- maxHeight: yup.number().required(),
115
+ hasMaxWidth: yup.boolean().required(),
116
+ hasMinHeight: yup.boolean().required(),
117
+ hasMinWidth: yup.boolean().required(),
118
+ height: yup.number().required(),
119
+ isFullscreenable: yup.boolean().required(),
115
120
  isMaximizable: yup.boolean().required(),
116
121
  isMinimizable: yup.boolean().required(),
117
- isFullscreenable: yup.boolean().required(),
118
- transparentTitlebar: yup.boolean().required(),
122
+ isResizable: yup.boolean().required(),
123
+ maxHeight: yup.number().required(),
124
+ maxWidth: yup.number().required(),
125
+ minHeight: yup.number().required(),
126
+ minWidth: yup.number().required(),
127
+ startInFullscreenMode: yup.boolean().required(),
128
+ width: yup.number().required(),
119
129
  alwaysOnTop: yup.boolean().required(),
120
- transparentInsetTitlebar: yup.boolean().required(),
121
130
  autoHideMenuBar: yup.boolean().required(),
122
- })
123
- .required(),
124
- meta: yup
125
- .object({
126
- schemaVersion: yup.number().required(),
127
- hasAppChanged: yup.boolean().required(),
128
- appIterations: yup.number().required(),
129
- publishedVersions: yup.object({
130
- electron: yup.string().notRequired(),
131
- desktopify: yup.string().notRequired(),
132
- version: yup.string().notRequired(),
133
- }),
131
+ transparentInsetTitlebar: yup.boolean().required(),
132
+ transparentTitlebar: yup.boolean().required(),
134
133
  })
135
134
  .required(),
136
135
  });
137
- const shouldMinimizeToTrayIsActive = (desktopApp) => {
136
+ export const shouldMinimizeToTrayIsActive = (desktopApp) => {
138
137
  return desktopApp.trays.some((t) => t.leftClick.role === 'toggleMenu' || t.rightClick.role === 'toggleMenu');
139
138
  };
140
- exports.shouldMinimizeToTrayIsActive = shouldMinimizeToTrayIsActive;