@todesktop/shared 7.190.0 → 7.191.1
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.
- package/.prettierignore +0 -2
- package/CHANGELOG.md +19 -0
- package/README.md +42 -15
- package/eslint.config.mjs +8 -55
- package/lib/{base.d.ts → cjs/base.d.ts} +82 -75
- package/lib/{desktopify.d.ts → cjs/desktopify.d.ts} +74 -74
- package/lib/{desktopify.js → cjs/desktopify.js} +12 -11
- package/lib/{desktopify2.d.ts → cjs/desktopify2.d.ts} +223 -223
- package/lib/{getSiteInfo.d.ts → cjs/getSiteInfo.d.ts} +6 -6
- package/lib/{hsm.d.ts → cjs/hsm.d.ts} +1 -1
- package/lib/{hsm.js → cjs/hsm.js} +1 -1
- package/lib/{index.d.ts → cjs/index.d.ts} +7 -8
- package/lib/{index.js → cjs/index.js} +11 -9
- package/lib/{invitePermissionLabels.d.ts → cjs/invitePermissionLabels.d.ts} +4 -2
- package/lib/{invitePermissionLabels.js → cjs/invitePermissionLabels.js} +11 -3
- package/lib/{personalAccessTokens.d.ts → cjs/personalAccessTokens.d.ts} +12 -12
- package/lib/{plans.d.ts → cjs/plans.d.ts} +27 -27
- package/lib/{plans.js → cjs/plans.js} +165 -163
- package/lib/{plugin.d.ts → cjs/plugin.d.ts} +18 -18
- package/lib/{toDesktop.d.ts → cjs/toDesktop.d.ts} +66 -66
- package/lib/cjs/translation.d.ts +2 -0
- package/lib/{validations.d.ts → cjs/validations.d.ts} +66 -66
- package/lib/cjs/validations.js +178 -0
- package/lib/esm/base.d.ts +326 -0
- package/lib/esm/base.js +19 -0
- package/lib/esm/desktopify.d.ts +339 -0
- package/lib/esm/desktopify.js +71 -0
- package/lib/esm/desktopify2.d.ts +506 -0
- package/lib/esm/desktopify2.js +77 -0
- package/lib/esm/getSiteInfo.d.ts +24 -0
- package/lib/esm/getSiteInfo.js +1 -0
- package/lib/esm/hsm.d.ts +30 -0
- package/lib/esm/hsm.js +35 -0
- package/lib/esm/index.d.ts +12 -0
- package/lib/esm/index.js +14 -0
- package/lib/esm/invitePermissionLabels.d.ts +13 -0
- package/lib/esm/invitePermissionLabels.js +24 -0
- package/lib/esm/personalAccessTokens.d.ts +24 -0
- package/lib/esm/personalAccessTokens.js +1 -0
- package/lib/esm/plans.d.ts +130 -0
- package/lib/esm/plans.js +626 -0
- package/lib/esm/plugin.d.ts +55 -0
- package/lib/esm/plugin.js +1 -0
- package/lib/esm/toDesktop.d.ts +191 -0
- package/lib/esm/toDesktop.js +1 -0
- package/lib/esm/translation.d.ts +2 -0
- package/lib/esm/translation.js +13 -0
- package/lib/esm/validations.d.ts +102 -0
- package/lib/{validations.js → esm/validations.js} +54 -56
- package/package.json +29 -20
- package/src/base.ts +90 -82
- package/src/desktopify.ts +82 -80
- package/src/desktopify2.ts +240 -240
- package/src/getSiteInfo.ts +6 -6
- package/src/hsm.ts +7 -7
- package/src/index.cjs.ts +19 -0
- package/src/index.ts +14 -14
- package/src/invitePermissionLabels.ts +20 -6
- package/src/personalAccessTokens.ts +12 -12
- package/src/plans.ts +191 -191
- package/src/plugin.ts +19 -19
- package/src/toDesktop.ts +70 -70
- package/src/translation.ts +2 -2
- package/src/validations.ts +51 -49
- package/tsconfig.esm.json +15 -0
- package/tsconfig.json +6 -4
- package/.prettierrc +0 -5
- package/lib/translation.d.ts +0 -2
- package/lib/{base.js → cjs/base.js} +3 -3
- /package/lib/{desktopify2.js → cjs/desktopify2.js} +0 -0
- /package/lib/{getSiteInfo.js → cjs/getSiteInfo.js} +0 -0
- /package/lib/{personalAccessTokens.js → cjs/personalAccessTokens.js} +0 -0
- /package/lib/{plugin.js → cjs/plugin.js} +0 -0
- /package/lib/{toDesktop.js → cjs/toDesktop.js} +0 -0
- /package/lib/{translation.js → cjs/translation.js} +0 -0
package/src/plugin.ts
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
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
|
-
|
|
9
3
|
/**
|
|
10
4
|
* Package name, including version information.
|
|
11
5
|
* e.g. "@todesktop/plugin-foo", "@todesktop/plugin-baz@1.0.0"
|
|
12
6
|
*/
|
|
13
7
|
package: string;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Configuration gathered from the todesktop plugin.
|
|
11
|
+
* Named `todesktop` to clarify that it maps to the `todesktop` key on the package.json
|
|
12
|
+
*/
|
|
13
|
+
todesktop?: ToDesktopPlugin;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export interface CustomPlugin {
|
|
17
|
-
|
|
17
|
+
addedAt: string;
|
|
18
|
+
description?: string;
|
|
18
19
|
displayName?: string;
|
|
20
|
+
lastLinkedAt?: string;
|
|
21
|
+
packageName: string;
|
|
19
22
|
sourcePath: string;
|
|
20
23
|
todesktop: ToDesktopPlugin;
|
|
21
|
-
addedAt: string;
|
|
22
|
-
lastLinkedAt?: string;
|
|
23
|
-
description?: string;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export type ToDesktopPlugin = {
|
|
27
|
-
namespace: string;
|
|
28
|
-
version: number;
|
|
29
27
|
main?: string;
|
|
30
|
-
|
|
28
|
+
namespace: string;
|
|
31
29
|
preferences?: PluginPreferences;
|
|
30
|
+
preload?: string;
|
|
31
|
+
version: number;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
export type PluginPreferences = {
|
|
35
35
|
[id: string]: PluginPreference;
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
export type PluginPreference =
|
|
38
|
+
export type PluginPreference = CheckboxSpec | NumberSpec | TextSpec;
|
|
39
39
|
|
|
40
40
|
export type TextSpec = PreferenceSpec<
|
|
41
41
|
'text',
|
|
42
42
|
{
|
|
43
|
+
placeholder?: string;
|
|
43
44
|
validator?: AjvJSONSchemaType;
|
|
44
45
|
value?: string;
|
|
45
|
-
placeholder?: string;
|
|
46
46
|
}
|
|
47
47
|
>;
|
|
48
48
|
|
|
49
49
|
export type NumberSpec = PreferenceSpec<
|
|
50
50
|
'number',
|
|
51
51
|
{
|
|
52
|
+
placeholder?: number;
|
|
52
53
|
validator?: AjvJSONSchemaType;
|
|
53
54
|
value?: number;
|
|
54
|
-
placeholder?: number;
|
|
55
55
|
}
|
|
56
56
|
>;
|
|
57
57
|
|
|
@@ -64,9 +64,9 @@ export type CheckboxSpec = PreferenceSpec<
|
|
|
64
64
|
>;
|
|
65
65
|
|
|
66
66
|
interface PreferenceSpec<T, V> {
|
|
67
|
-
name: string;
|
|
68
67
|
description: string;
|
|
69
|
-
|
|
70
|
-
spec: V;
|
|
68
|
+
name: string;
|
|
71
69
|
order?: number;
|
|
70
|
+
spec: V;
|
|
71
|
+
type: T;
|
|
72
72
|
}
|
package/src/toDesktop.ts
CHANGED
|
@@ -3,28 +3,28 @@ import { IAppBuilderLib } from './desktopify';
|
|
|
3
3
|
import { PatSummary } from './personalAccessTokens';
|
|
4
4
|
|
|
5
5
|
export type IUploadFileStatus =
|
|
6
|
+
| 'done'
|
|
6
7
|
| 'error'
|
|
8
|
+
| 'removed'
|
|
7
9
|
| 'success'
|
|
8
|
-
| '
|
|
9
|
-
| 'uploading'
|
|
10
|
-
| 'removed';
|
|
10
|
+
| 'uploading';
|
|
11
11
|
|
|
12
12
|
export interface IUploadFile {
|
|
13
|
-
|
|
14
|
-
size: number;
|
|
15
|
-
name: string;
|
|
13
|
+
error?: any;
|
|
16
14
|
fileName?: string;
|
|
17
15
|
lastModified?: number;
|
|
18
16
|
lastModifiedDate?: Date;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
percent?: number;
|
|
22
|
-
thumbUrl?: string;
|
|
17
|
+
linkProps?: any;
|
|
18
|
+
name: string;
|
|
23
19
|
originFileObj?: File;
|
|
20
|
+
percent?: number;
|
|
24
21
|
response?: any;
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
size: number;
|
|
23
|
+
status?: IUploadFileStatus;
|
|
24
|
+
thumbUrl?: string;
|
|
27
25
|
type: string;
|
|
26
|
+
uid: string;
|
|
27
|
+
url?: string;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export interface IHueIcon extends IUploadFile {
|
|
@@ -38,47 +38,47 @@ export interface IAppIcon {
|
|
|
38
38
|
export type IAppIcons = IAppIcon[];
|
|
39
39
|
|
|
40
40
|
export interface IAppWindowOptions {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
width: number;
|
|
44
|
-
height: number;
|
|
45
|
-
hasMinWidth: boolean;
|
|
46
|
-
hasMinHeight: boolean;
|
|
47
|
-
hasMaxWidth: boolean;
|
|
41
|
+
alwaysOnTop: boolean;
|
|
42
|
+
autoHideMenuBar: boolean;
|
|
48
43
|
hasMaxHeight: boolean;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
hasMaxWidth: boolean;
|
|
45
|
+
hasMinHeight: boolean;
|
|
46
|
+
hasMinWidth: boolean;
|
|
47
|
+
height: number;
|
|
53
48
|
isMaximizable: boolean;
|
|
54
49
|
isMinimizable: boolean;
|
|
50
|
+
isResizable: boolean;
|
|
51
|
+
maxHeight: number;
|
|
52
|
+
maxWidth: number;
|
|
53
|
+
minHeight: number;
|
|
54
|
+
minWidth: number;
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
alwaysOnTop: boolean;
|
|
56
|
+
startInFullscreenMode: boolean;
|
|
58
57
|
transparentInsetTitlebar: boolean;
|
|
59
|
-
|
|
58
|
+
transparentTitlebar: boolean;
|
|
59
|
+
width: number;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export interface IWindowOptions {
|
|
63
|
+
height: number;
|
|
63
64
|
isAlwaysOnTop?: boolean;
|
|
64
65
|
isAutoHideMenuBar?: boolean;
|
|
66
|
+
isFullScreenStartEnabled?: boolean;
|
|
67
|
+
isInsetTitlebarTransparent?: boolean;
|
|
65
68
|
isMaximizable: boolean;
|
|
66
69
|
isMinimizable: boolean;
|
|
67
70
|
isResizable: boolean;
|
|
68
|
-
isInsetTitlebarTransparent?: boolean;
|
|
69
71
|
isTitlebarTransparent?: boolean;
|
|
70
|
-
isFullScreenStartEnabled?: boolean;
|
|
71
|
-
width: number;
|
|
72
|
-
height: number;
|
|
73
72
|
maxHeight?: ISwitchableValue<number>;
|
|
74
|
-
minHeight?: ISwitchableValue<number>;
|
|
75
73
|
maxWidth?: ISwitchableValue<number>;
|
|
74
|
+
minHeight?: ISwitchableValue<number>;
|
|
76
75
|
minWidth?: ISwitchableValue<number>;
|
|
76
|
+
width: number;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
export interface IAppPublishedVersions {
|
|
80
|
-
electron?: string;
|
|
81
80
|
desktopify?: string;
|
|
81
|
+
electron?: string;
|
|
82
82
|
version?: string;
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -88,10 +88,10 @@ export interface ISwitchableValue<T> {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
export interface IIcon {
|
|
91
|
-
url: string;
|
|
92
|
-
width: number;
|
|
93
91
|
height: number;
|
|
94
92
|
type: string;
|
|
93
|
+
url: string;
|
|
94
|
+
width: number;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
export interface IApp extends BaseApp {
|
|
@@ -104,120 +104,120 @@ export interface IApp extends BaseApp {
|
|
|
104
104
|
customDomain?: string;
|
|
105
105
|
customUserAgent?: ISwitchableValue<string>;
|
|
106
106
|
disableContextMenu?: boolean;
|
|
107
|
+
enablePushNotifications?: boolean;
|
|
107
108
|
environmentVariables?: {
|
|
108
109
|
// values that have been made secret need to be retrieved from azure key vault
|
|
109
|
-
[propertyName: string]:
|
|
110
|
+
[propertyName: string]: { secret: string } | string;
|
|
110
111
|
};
|
|
112
|
+
extraBrowserWindowOptions?: string;
|
|
111
113
|
icon?: string;
|
|
112
114
|
icons?: IIcon[];
|
|
113
115
|
internalUrls?: ISwitchableValue<string>;
|
|
116
|
+
isBackgroundThrottlingPrevented?: boolean;
|
|
114
117
|
isContextMenuDisabled: boolean;
|
|
115
118
|
isDevToolsDisabled: boolean;
|
|
116
119
|
isFindInPageEnabled?: boolean;
|
|
120
|
+
isGoogleOAuthExternal?: boolean;
|
|
117
121
|
isNativeWindowOpenDisabled?: boolean;
|
|
118
122
|
isSingleInstance?: boolean;
|
|
119
|
-
isWebSecurityDisabled?: boolean;
|
|
120
|
-
isBackgroundThrottlingPrevented?: boolean;
|
|
121
|
-
isGoogleOAuthExternal?: boolean;
|
|
122
123
|
isTitleStatic?: boolean;
|
|
123
|
-
shouldMakeSameDomainAnExternalLink?: boolean;
|
|
124
|
-
shouldUseRealUserAgent?: boolean;
|
|
125
|
-
extraBrowserWindowOptions?: string;
|
|
126
|
-
enablePushNotifications?: boolean;
|
|
127
124
|
isTransitioningFromSquirrelWindows?: boolean;
|
|
125
|
+
isWebSecurityDisabled?: boolean;
|
|
128
126
|
jsToInject?: string;
|
|
129
127
|
menubarIcon?: string;
|
|
130
128
|
name: string;
|
|
131
129
|
nsisConfig?: Partial<IAppBuilderLib['config']['nsis']>;
|
|
130
|
+
pollForAppUpdatesEveryXMinutes?: number;
|
|
132
131
|
runtimeEnvs?: string;
|
|
133
132
|
secret?: string; // support old schema versions
|
|
134
133
|
shouldLaunchAtStartupByDefault?: boolean;
|
|
134
|
+
shouldMakeSameDomainAnExternalLink?: boolean;
|
|
135
135
|
shouldOnlySendAbsolutelyNecessaryRequests?: boolean;
|
|
136
136
|
shouldReuseRendererProcess?: boolean;
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
shouldUseRealUserAgent?: boolean;
|
|
138
|
+
themeSource?: 'dark' | 'light' | 'system';
|
|
139
|
+
themeSourceMac?: 'dark' | 'light' | 'system';
|
|
139
140
|
toggleVisibilityKeyboardShortcut?: ISwitchableValue<string>;
|
|
140
141
|
trayIcon?: string;
|
|
141
142
|
url: string;
|
|
142
|
-
windowOptions: IWindowOptions;
|
|
143
|
-
pollForAppUpdatesEveryXMinutes?: number;
|
|
144
143
|
useSafeInternalUrlMatcher?: boolean;
|
|
144
|
+
windowOptions: IWindowOptions;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
export interface IUser extends Schemable {
|
|
148
|
-
|
|
148
|
+
accessToken?: string;
|
|
149
|
+
allowedIPs?: string[];
|
|
149
150
|
authInfo?: object;
|
|
150
151
|
avatar?: string;
|
|
152
|
+
cliAccessTokens?: PatSummary[];
|
|
151
153
|
currentApplication?: string;
|
|
152
154
|
customerId?: string;
|
|
155
|
+
disableShouldCodeSign?: boolean;
|
|
153
156
|
email?: string;
|
|
157
|
+
featureFlags?: FeatureFlags;
|
|
154
158
|
firstName?: string;
|
|
155
|
-
|
|
156
|
-
stripeCustomerId?: string;
|
|
157
|
-
isOldAccountThatNeedsNewPassword?: boolean;
|
|
158
|
-
accessToken?: string;
|
|
159
|
-
cliAccessTokens?: PatSummary[];
|
|
159
|
+
id: string;
|
|
160
160
|
isAdmin?: boolean;
|
|
161
161
|
isImpersonator?: boolean;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
allowedIPs?: string[];
|
|
165
|
-
seenReleaseTutorial?: boolean;
|
|
162
|
+
isOldAccountThatNeedsNewPassword?: boolean;
|
|
163
|
+
lastName?: string;
|
|
166
164
|
seenApplicationGroupsTutorial?: boolean;
|
|
165
|
+
seenReleaseTutorial?: boolean;
|
|
166
|
+
stripeCustomerId?: string;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
export interface FeatureFlags {
|
|
170
|
+
// Whether the user can see the toggle for allowing blank urls
|
|
171
|
+
aboutBlankWindowOpenHandler: boolean;
|
|
172
|
+
|
|
170
173
|
// Whether the user can install desktop app plugins using the ToDesktop Builder
|
|
171
174
|
desktopAppPlugins: boolean;
|
|
172
175
|
|
|
173
176
|
// Whether the user can create builds for the mac app store.
|
|
174
177
|
macAppStore: boolean;
|
|
175
|
-
|
|
176
|
-
// Whether the user can see the toggle for allowing blank urls
|
|
177
|
-
aboutBlankWindowOpenHandler: boolean;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
export interface InvitePermissions {
|
|
181
181
|
canBuild: boolean;
|
|
182
|
-
canRelease: boolean;
|
|
183
182
|
canManageBilling?: boolean;
|
|
184
183
|
canManageUsers?: boolean;
|
|
184
|
+
canRelease: boolean;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
export type InviteActorRole = '
|
|
187
|
+
export type InviteActorRole = 'delegate' | 'owner';
|
|
188
188
|
|
|
189
189
|
export interface InviteActorCapabilities {
|
|
190
|
-
actorId: string;
|
|
191
190
|
actorEmail: string;
|
|
192
|
-
|
|
191
|
+
actorId: string;
|
|
193
192
|
actorPermissions: InvitePermissions;
|
|
193
|
+
actorRole: InviteActorRole;
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
// uses an `email` identifier because an invited user may not have an account
|
|
197
197
|
export interface UserIHaveSentInviteTo {
|
|
198
198
|
email: string;
|
|
199
|
-
|
|
199
|
+
inviterCapabilities?: InviteActorCapabilities;
|
|
200
200
|
name: string;
|
|
201
|
+
permissions?: InvitePermissions;
|
|
201
202
|
// this allows us to encode information about the sender without loosening firebase privileges
|
|
202
203
|
sender: UserIHaveAcceptedInviteFrom;
|
|
203
|
-
inviterCapabilities?: InviteActorCapabilities;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
export interface UserIHaveAcceptedInviteFrom {
|
|
207
|
-
id: string;
|
|
208
207
|
email: string;
|
|
209
208
|
firstName: string;
|
|
209
|
+
id: string;
|
|
210
210
|
lastName: string;
|
|
211
211
|
|
|
212
|
-
// duplicated user details about the person who accepted the invite
|
|
213
|
-
receiver?: Pick<IUser, 'id' | 'email'>;
|
|
214
212
|
permissions?: InvitePermissions;
|
|
213
|
+
// duplicated user details about the person who accepted the invite
|
|
214
|
+
receiver?: Pick<IUser, 'email' | 'id'>;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
export interface CiInput {
|
|
218
|
+
accessToken: string;
|
|
218
219
|
appData: IApp;
|
|
219
220
|
buildId?: string;
|
|
220
|
-
userId: string;
|
|
221
221
|
contextUserId: string;
|
|
222
|
-
|
|
222
|
+
userId: string;
|
|
223
223
|
}
|
package/src/translation.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type ValidTranslationKeys =
|
|
2
|
-
| 'updateNotification.
|
|
3
|
-
| 'updateNotification.
|
|
2
|
+
| 'updateNotification.body'
|
|
3
|
+
| 'updateNotification.title';
|
|
4
4
|
export type ValidTranslationLanguages = 'default';
|
|
5
5
|
/* TODO - Support more languages here */
|
|
6
6
|
// | "en"
|
package/src/validations.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
+
import isRegex from 'is-regex';
|
|
2
|
+
import semver from 'semver';
|
|
1
3
|
import * as yup from 'yup';
|
|
2
|
-
import * as semver from 'semver';
|
|
3
|
-
import * as isRegex from 'is-regex';
|
|
4
4
|
import { DesktopifyApp2 } from './desktopify2';
|
|
5
5
|
import { DesktopAppPlugin } from './plugin';
|
|
6
|
+
|
|
6
7
|
export const appTitleValidation = yup
|
|
7
8
|
.string()
|
|
8
9
|
.label('App title')
|
|
9
10
|
.max(26)
|
|
10
11
|
.matches(
|
|
11
12
|
/^[\w\-\s]+$/,
|
|
12
|
-
'App title may contain letters, numbers, spaces and dashes only'
|
|
13
|
+
'App title may contain letters, numbers, spaces and dashes only',
|
|
13
14
|
)
|
|
14
15
|
.matches(/^[^\s]+(\s+[^\s]+)*$/, 'App title may not begin or end with space')
|
|
15
16
|
.required();
|
|
16
17
|
|
|
17
18
|
function isNumeric(str: string) {
|
|
18
|
-
if (typeof str
|
|
19
|
-
return !isNaN(Number(str)) && !isNaN(parseFloat(str));
|
|
19
|
+
if (typeof str !== 'string') return false;
|
|
20
|
+
return !Number.isNaN(Number(str)) && !Number.isNaN(parseFloat(str));
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
function isNumericSemver(value: string) {
|
|
@@ -43,8 +44,8 @@ export const forceVersionValidation = yup
|
|
|
43
44
|
isNumericSemver(forceVersion) &&
|
|
44
45
|
semver.gt(forceVersion, currentVersion)
|
|
45
46
|
);
|
|
46
|
-
}
|
|
47
|
-
)
|
|
47
|
+
},
|
|
48
|
+
),
|
|
48
49
|
);
|
|
49
50
|
|
|
50
51
|
export const iconValidation = yup
|
|
@@ -58,10 +59,10 @@ export const urlValidation = yup
|
|
|
58
59
|
.matches(
|
|
59
60
|
/^(?:([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*)?$/,
|
|
60
61
|
{
|
|
62
|
+
excludeEmptyString: true,
|
|
61
63
|
message:
|
|
62
64
|
"Invalid URL. Don't forget to include the protocol (e.g.. https://).",
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
+
},
|
|
65
66
|
)
|
|
66
67
|
.label('Website URL')
|
|
67
68
|
.required();
|
|
@@ -102,12 +103,13 @@ export const internalAppRegexValidation = yup
|
|
|
102
103
|
return forwardSlashCount === backSlashEscapeCount;
|
|
103
104
|
}
|
|
104
105
|
return true;
|
|
105
|
-
}
|
|
106
|
+
},
|
|
106
107
|
)
|
|
107
108
|
.test(
|
|
108
109
|
'is-regex',
|
|
110
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
109
111
|
'${path} must be valid regular expression',
|
|
110
|
-
(value: string) => isRegex(RegExp(value))
|
|
112
|
+
(value: string) => isRegex(RegExp(value)),
|
|
111
113
|
);
|
|
112
114
|
|
|
113
115
|
export const appProtocolValidation = yup
|
|
@@ -117,73 +119,73 @@ export const appProtocolValidation = yup
|
|
|
117
119
|
.test(
|
|
118
120
|
'ends-with-protocol',
|
|
119
121
|
'Protocols must end with `://`',
|
|
120
|
-
(value: string) => value.endsWith('://')
|
|
122
|
+
(value: string) => value.endsWith('://'),
|
|
121
123
|
)
|
|
122
124
|
.test(
|
|
123
125
|
'is-lowercase',
|
|
124
126
|
'Protocols must be lowercase',
|
|
125
|
-
(value) => value === value.toLowerCase()
|
|
127
|
+
(value) => value === value.toLowerCase(),
|
|
126
128
|
)
|
|
127
129
|
.matches(
|
|
128
130
|
/^[a-zA-Z-.]+:\/\/$/,
|
|
129
|
-
'Protocols contain letters, dots (.) and dashes (-) only'
|
|
131
|
+
'Protocols contain letters, dots (.) and dashes (-) only',
|
|
130
132
|
)
|
|
131
133
|
.min(5);
|
|
132
134
|
|
|
133
135
|
export const appConfigValidation = yup.object({
|
|
134
|
-
id: yup.string().required(),
|
|
135
|
-
name: appTitleValidation,
|
|
136
|
-
url: urlValidation,
|
|
137
|
-
isFrameBlocked: yup.boolean().required(),
|
|
138
|
-
iconUrl: iconValidation,
|
|
139
|
-
disableDevTools: yup.boolean().required(),
|
|
140
|
-
singleInstance: yup.boolean().required(),
|
|
141
136
|
customUserAgent: yup.string().required(),
|
|
137
|
+
disableDevTools: yup.boolean().required(),
|
|
138
|
+
iconUrl: iconValidation,
|
|
139
|
+
id: yup.string().required(),
|
|
142
140
|
internalURLs: yup.string().required(),
|
|
141
|
+
isFrameBlocked: yup.boolean().required(),
|
|
142
|
+
meta: yup
|
|
143
|
+
.object({
|
|
144
|
+
appIterations: yup.number().required(),
|
|
145
|
+
hasAppChanged: yup.boolean().required(),
|
|
146
|
+
publishedVersions: yup.object({
|
|
147
|
+
desktopify: yup.string().notRequired(),
|
|
148
|
+
electron: yup.string().notRequired(),
|
|
149
|
+
version: yup.string().notRequired(),
|
|
150
|
+
}),
|
|
151
|
+
schemaVersion: yup.number().required(),
|
|
152
|
+
})
|
|
153
|
+
.required(),
|
|
154
|
+
name: appTitleValidation,
|
|
143
155
|
secret: yup.string().required(),
|
|
156
|
+
singleInstance: yup.boolean().required(),
|
|
157
|
+
url: urlValidation,
|
|
144
158
|
windowOptions: yup
|
|
145
159
|
.object({
|
|
146
|
-
startInFullscreenMode: yup.boolean().required(),
|
|
147
|
-
isResizable: yup.boolean().required(),
|
|
148
|
-
width: yup.number().required(),
|
|
149
|
-
height: yup.number().required(),
|
|
150
|
-
hasMinWidth: yup.boolean().required(),
|
|
151
|
-
hasMinHeight: yup.boolean().required(),
|
|
152
|
-
hasMaxWidth: yup.boolean().required(),
|
|
153
160
|
hasMaxHeight: yup.boolean().required(),
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
161
|
+
hasMaxWidth: yup.boolean().required(),
|
|
162
|
+
hasMinHeight: yup.boolean().required(),
|
|
163
|
+
hasMinWidth: yup.boolean().required(),
|
|
164
|
+
height: yup.number().required(),
|
|
165
|
+
isFullscreenable: yup.boolean().required(),
|
|
158
166
|
isMaximizable: yup.boolean().required(),
|
|
159
167
|
isMinimizable: yup.boolean().required(),
|
|
160
|
-
|
|
168
|
+
isResizable: yup.boolean().required(),
|
|
169
|
+
maxHeight: yup.number().required(),
|
|
170
|
+
maxWidth: yup.number().required(),
|
|
171
|
+
minHeight: yup.number().required(),
|
|
172
|
+
minWidth: yup.number().required(),
|
|
173
|
+
startInFullscreenMode: yup.boolean().required(),
|
|
174
|
+
width: yup.number().required(),
|
|
161
175
|
|
|
162
|
-
transparentTitlebar: yup.boolean().required(),
|
|
163
176
|
alwaysOnTop: yup.boolean().required(),
|
|
164
|
-
transparentInsetTitlebar: yup.boolean().required(),
|
|
165
177
|
autoHideMenuBar: yup.boolean().required(),
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
meta: yup
|
|
169
|
-
.object({
|
|
170
|
-
schemaVersion: yup.number().required(),
|
|
171
|
-
hasAppChanged: yup.boolean().required(),
|
|
172
|
-
appIterations: yup.number().required(),
|
|
173
|
-
publishedVersions: yup.object({
|
|
174
|
-
electron: yup.string().notRequired(),
|
|
175
|
-
desktopify: yup.string().notRequired(),
|
|
176
|
-
version: yup.string().notRequired(),
|
|
177
|
-
}),
|
|
178
|
+
transparentInsetTitlebar: yup.boolean().required(),
|
|
179
|
+
transparentTitlebar: yup.boolean().required(),
|
|
178
180
|
})
|
|
179
181
|
.required(),
|
|
180
182
|
});
|
|
181
183
|
|
|
182
184
|
export const shouldMinimizeToTrayIsActive = <Plugin = DesktopAppPlugin>(
|
|
183
|
-
desktopApp: DesktopifyApp2<Plugin
|
|
185
|
+
desktopApp: DesktopifyApp2<Plugin>,
|
|
184
186
|
) => {
|
|
185
187
|
return desktopApp.trays.some(
|
|
186
188
|
(t) =>
|
|
187
|
-
t.leftClick.role === 'toggleMenu' || t.rightClick.role === 'toggleMenu'
|
|
189
|
+
t.leftClick.role === 'toggleMenu' || t.rightClick.role === 'toggleMenu',
|
|
188
190
|
);
|
|
189
191
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@todesktop/dev-config/tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "es2016",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"outDir": "./lib/esm",
|
|
9
|
+
"rootDir": "./src",
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"strict": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src/**/*"],
|
|
14
|
+
"exclude": ["node_modules", "lib", "src/index.cjs.ts"]
|
|
15
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
+
"extends": "@todesktop/dev-config/tsconfig.base.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
4
|
"target": "es2016",
|
|
4
5
|
"module": "commonjs",
|
|
5
6
|
"declaration": true,
|
|
6
|
-
"outDir": "./lib",
|
|
7
|
+
"outDir": "./lib/cjs",
|
|
7
8
|
"rootDir": "./src",
|
|
8
|
-
"
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"strict": true
|
|
9
11
|
},
|
|
10
|
-
|
|
11
|
-
"exclude": ["node_modules", "lib"]
|
|
12
|
+
"include": ["src/**/*"],
|
|
13
|
+
"exclude": ["node_modules", "lib", "src/index.ts"]
|
|
12
14
|
}
|
package/.prettierrc
DELETED
package/lib/translation.d.ts
DELETED
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WindowsHSMCertType = exports.WindowsEVOnboardingProvider = exports.WindowsEVOnboardingSteps = void 0;
|
|
4
4
|
var WindowsEVOnboardingSteps;
|
|
5
5
|
(function (WindowsEVOnboardingSteps) {
|
|
6
|
-
WindowsEVOnboardingSteps["hasChosenProvider"] = "hasChosenProvider";
|
|
7
|
-
WindowsEVOnboardingSteps["hasOrderedCert"] = "hasOrderedCert";
|
|
8
6
|
WindowsEVOnboardingSteps["hasBeenVerified"] = "hasBeenVerified";
|
|
7
|
+
WindowsEVOnboardingSteps["hasChosenProvider"] = "hasChosenProvider";
|
|
9
8
|
WindowsEVOnboardingSteps["hasGeneratedCert"] = "hasGeneratedCert";
|
|
9
|
+
WindowsEVOnboardingSteps["hasOrderedCert"] = "hasOrderedCert";
|
|
10
10
|
WindowsEVOnboardingSteps["hasUploadedCert"] = "hasUploadedCert";
|
|
11
11
|
})(WindowsEVOnboardingSteps || (exports.WindowsEVOnboardingSteps = WindowsEVOnboardingSteps = {}));
|
|
12
12
|
var WindowsEVOnboardingProvider;
|
|
@@ -16,7 +16,7 @@ var WindowsEVOnboardingProvider;
|
|
|
16
16
|
})(WindowsEVOnboardingProvider || (exports.WindowsEVOnboardingProvider = WindowsEVOnboardingProvider = {}));
|
|
17
17
|
var WindowsHSMCertType;
|
|
18
18
|
(function (WindowsHSMCertType) {
|
|
19
|
+
WindowsHSMCertType["azureTrustedSigning"] = "azureTrustedSigning";
|
|
19
20
|
WindowsHSMCertType["ev"] = "ev";
|
|
20
21
|
WindowsHSMCertType["file"] = "file";
|
|
21
|
-
WindowsHSMCertType["azureTrustedSigning"] = "azureTrustedSigning";
|
|
22
22
|
})(WindowsHSMCertType || (exports.WindowsHSMCertType = WindowsHSMCertType = {}));
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|