@todesktop/shared 7.184.17 → 7.184.19
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/.eslintrc.js +33 -0
- package/.github/workflows/main.yml +19 -19
- package/.github/workflows/test.yml +14 -0
- package/.prettierignore +3 -0
- package/.prettierrc +5 -0
- package/lib/base.d.ts +23 -23
- package/lib/desktopify.d.ts +16 -16
- package/lib/desktopify.js +8 -8
- package/lib/desktopify2.d.ts +21 -21
- package/lib/desktopify2.js +61 -59
- package/lib/getSiteInfo.d.ts +1 -1
- package/lib/index.d.ts +6 -6
- package/lib/plans.d.ts +11 -11
- package/lib/plans.js +42 -42
- package/lib/plugin.d.ts +3 -3
- package/lib/toDesktop.d.ts +8 -8
- package/lib/translation.d.ts +2 -2
- package/lib/validations.d.ts +2 -2
- package/lib/validations.js +26 -26
- package/package.json +10 -6
- package/src/base.ts +25 -25
- package/src/desktopify.ts +53 -52
- package/src/desktopify2.ts +99 -97
- package/src/getSiteInfo.ts +1 -1
- package/src/index.ts +7 -7
- package/src/json.d.ts +2 -2
- package/src/plans.ts +61 -61
- package/src/plugin.ts +3 -3
- package/src/toDesktop.ts +12 -12
- package/src/translation.ts +3 -3
- package/src/validations.ts +36 -39
package/lib/plans.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare const prodPlanIds: {
|
|
|
34
34
|
enterprise: string;
|
|
35
35
|
};
|
|
36
36
|
export declare type PlanIds = typeof prodPlanIds;
|
|
37
|
-
export declare const getPlanEnvironment: (stage:
|
|
37
|
+
export declare const getPlanEnvironment: (stage: 'dev' | 'prod') => {
|
|
38
38
|
startup: string;
|
|
39
39
|
business: string;
|
|
40
40
|
essential: string;
|
|
@@ -51,7 +51,7 @@ export declare const getPlanEnvironment: (stage: "dev" | "prod") => {
|
|
|
51
51
|
builder_professional: string;
|
|
52
52
|
enterprise: string;
|
|
53
53
|
};
|
|
54
|
-
export declare const getCLIPlanIds: (stage:
|
|
54
|
+
export declare const getCLIPlanIds: (stage: 'dev' | 'prod') => Pick<{
|
|
55
55
|
startup: string;
|
|
56
56
|
business: string;
|
|
57
57
|
essential: string;
|
|
@@ -68,7 +68,7 @@ export declare const getCLIPlanIds: (stage: "dev" | "prod") => Pick<{
|
|
|
68
68
|
builder_professional: string;
|
|
69
69
|
enterprise: string;
|
|
70
70
|
}, "cli_founder" | "cli_founder_30" | "cli_founder_50" | "cli_performance" | "cli_scale">;
|
|
71
|
-
export declare const getCLIFounderPlanIds: (stage:
|
|
71
|
+
export declare const getCLIFounderPlanIds: (stage: 'dev' | 'prod') => Pick<{
|
|
72
72
|
startup: string;
|
|
73
73
|
business: string;
|
|
74
74
|
essential: string;
|
|
@@ -85,7 +85,7 @@ export declare const getCLIFounderPlanIds: (stage: "dev" | "prod") => Pick<{
|
|
|
85
85
|
builder_professional: string;
|
|
86
86
|
enterprise: string;
|
|
87
87
|
}, "cli_founder" | "cli_founder_30" | "cli_founder_50">;
|
|
88
|
-
export declare const getCLIPerformancePlanIds: (stage:
|
|
88
|
+
export declare const getCLIPerformancePlanIds: (stage: 'dev' | 'prod') => Pick<{
|
|
89
89
|
startup: string;
|
|
90
90
|
business: string;
|
|
91
91
|
essential: string;
|
|
@@ -102,7 +102,7 @@ export declare const getCLIPerformancePlanIds: (stage: "dev" | "prod") => Pick<{
|
|
|
102
102
|
builder_professional: string;
|
|
103
103
|
enterprise: string;
|
|
104
104
|
}, "cli_performance">;
|
|
105
|
-
export declare const getCLIScalePlanIds: (stage:
|
|
105
|
+
export declare const getCLIScalePlanIds: (stage: 'dev' | 'prod') => Pick<{
|
|
106
106
|
startup: string;
|
|
107
107
|
business: string;
|
|
108
108
|
essential: string;
|
|
@@ -119,7 +119,7 @@ export declare const getCLIScalePlanIds: (stage: "dev" | "prod") => Pick<{
|
|
|
119
119
|
builder_professional: string;
|
|
120
120
|
enterprise: string;
|
|
121
121
|
}, "cli_scale">;
|
|
122
|
-
export declare const getBuilderPlanIds: (stage:
|
|
122
|
+
export declare const getBuilderPlanIds: (stage: 'dev' | 'prod') => Pick<{
|
|
123
123
|
startup: string;
|
|
124
124
|
business: string;
|
|
125
125
|
essential: string;
|
|
@@ -136,7 +136,7 @@ export declare const getBuilderPlanIds: (stage: "dev" | "prod") => Pick<{
|
|
|
136
136
|
builder_professional: string;
|
|
137
137
|
enterprise: string;
|
|
138
138
|
}, "builder_essential" | "builder_professional">;
|
|
139
|
-
export declare const getBuilderEssentialPlanIds: (stage:
|
|
139
|
+
export declare const getBuilderEssentialPlanIds: (stage: 'dev' | 'prod') => Pick<{
|
|
140
140
|
startup: string;
|
|
141
141
|
business: string;
|
|
142
142
|
essential: string;
|
|
@@ -153,7 +153,7 @@ export declare const getBuilderEssentialPlanIds: (stage: "dev" | "prod") => Pick
|
|
|
153
153
|
builder_professional: string;
|
|
154
154
|
enterprise: string;
|
|
155
155
|
}, "builder_essential">;
|
|
156
|
-
export declare const getBuilderProfessionalPlanIds: (stage:
|
|
156
|
+
export declare const getBuilderProfessionalPlanIds: (stage: 'dev' | 'prod') => Pick<{
|
|
157
157
|
startup: string;
|
|
158
158
|
business: string;
|
|
159
159
|
essential: string;
|
|
@@ -170,7 +170,7 @@ export declare const getBuilderProfessionalPlanIds: (stage: "dev" | "prod") => P
|
|
|
170
170
|
builder_professional: string;
|
|
171
171
|
enterprise: string;
|
|
172
172
|
}, "builder_professional">;
|
|
173
|
-
export declare const getEssentialPlanIds: (stage:
|
|
173
|
+
export declare const getEssentialPlanIds: (stage: 'dev' | 'prod') => Pick<{
|
|
174
174
|
startup: string;
|
|
175
175
|
business: string;
|
|
176
176
|
essential: string;
|
|
@@ -187,7 +187,7 @@ export declare const getEssentialPlanIds: (stage: "dev" | "prod") => Pick<{
|
|
|
187
187
|
builder_professional: string;
|
|
188
188
|
enterprise: string;
|
|
189
189
|
}, "startup" | "essential" | "essential_new">;
|
|
190
|
-
export declare const getProfessionalPlanIds: (stage:
|
|
190
|
+
export declare const getProfessionalPlanIds: (stage: 'dev' | 'prod') => Pick<{
|
|
191
191
|
startup: string;
|
|
192
192
|
business: string;
|
|
193
193
|
essential: string;
|
|
@@ -204,7 +204,7 @@ export declare const getProfessionalPlanIds: (stage: "dev" | "prod") => Pick<{
|
|
|
204
204
|
builder_professional: string;
|
|
205
205
|
enterprise: string;
|
|
206
206
|
}, "business" | "growth" | "professional" | "professional_annual">;
|
|
207
|
-
export declare const getEnterprisePlanIds: (stage:
|
|
207
|
+
export declare const getEnterprisePlanIds: (stage: 'dev' | 'prod') => Pick<{
|
|
208
208
|
startup: string;
|
|
209
209
|
business: string;
|
|
210
210
|
essential: string;
|
package/lib/plans.js
CHANGED
|
@@ -9,81 +9,81 @@ function pick(objectInput, ...keys) {
|
|
|
9
9
|
return objectOutput;
|
|
10
10
|
}
|
|
11
11
|
exports.devPlanIds = {
|
|
12
|
-
startup:
|
|
13
|
-
business:
|
|
14
|
-
essential:
|
|
15
|
-
growth:
|
|
16
|
-
essential_new:
|
|
17
|
-
professional:
|
|
18
|
-
professional_annual:
|
|
19
|
-
cli_founder:
|
|
20
|
-
cli_founder_30:
|
|
21
|
-
cli_founder_50:
|
|
22
|
-
cli_performance:
|
|
23
|
-
cli_scale:
|
|
24
|
-
builder_essential:
|
|
25
|
-
builder_professional:
|
|
26
|
-
enterprise:
|
|
12
|
+
startup: 'plan_Fe8BzLp7k71eGD',
|
|
13
|
+
business: 'plan_Fe8CUkZfXasFtB',
|
|
14
|
+
essential: 'plan_FpljxNuZtNFFbm',
|
|
15
|
+
growth: 'plan_FplOshrr1w3Mvu',
|
|
16
|
+
essential_new: 'plan_GYXmTA3EdfCv4q',
|
|
17
|
+
professional: 'plan_GYXoIkvwVKyfF2',
|
|
18
|
+
professional_annual: 'price_1KHU70IewCKA2h0IR87yXOQ2',
|
|
19
|
+
cli_founder: 'plan_Gq0FzdmoTJshQL',
|
|
20
|
+
cli_founder_30: 'plan_GsL7NZskOY0TC9',
|
|
21
|
+
cli_founder_50: 'plan_GsL6VYAshfh7c4',
|
|
22
|
+
cli_performance: 'price_1L821UIewCKA2h0IUwRhicyo',
|
|
23
|
+
cli_scale: 'price_1L821wIewCKA2h0IMLUmjulL',
|
|
24
|
+
builder_essential: 'price_1M4o9XIewCKA2h0IVfGrid8E',
|
|
25
|
+
builder_professional: 'price_1M4o9vIewCKA2h0IHREokdD8',
|
|
26
|
+
enterprise: 'price_1H2v6JIewCKA2h0IgUwsuctb',
|
|
27
27
|
};
|
|
28
28
|
exports.prodPlanIds = {
|
|
29
|
-
startup:
|
|
30
|
-
business:
|
|
31
|
-
essential:
|
|
32
|
-
growth:
|
|
33
|
-
essential_new:
|
|
34
|
-
professional:
|
|
35
|
-
professional_annual:
|
|
36
|
-
professional_annual_full_price:
|
|
37
|
-
cli_founder:
|
|
38
|
-
cli_founder_30:
|
|
39
|
-
cli_founder_50:
|
|
40
|
-
cli_performance:
|
|
41
|
-
cli_scale:
|
|
42
|
-
builder_essential:
|
|
43
|
-
builder_professional:
|
|
44
|
-
enterprise:
|
|
29
|
+
startup: 'plan_FdmDAUN7JGD8pR',
|
|
30
|
+
business: 'plan_FdmE8akq9ukxiY',
|
|
31
|
+
essential: 'plan_FohJzCujA6vvt4',
|
|
32
|
+
growth: 'plan_FohKGuWis5ocsi',
|
|
33
|
+
essential_new: 'plan_GYXn2cnPl5dy7j',
|
|
34
|
+
professional: 'plan_GYXoKsa2j0yURg',
|
|
35
|
+
professional_annual: 'price_1KHTgaIewCKA2h0I81TVg85r',
|
|
36
|
+
professional_annual_full_price: 'price_1KLT32IewCKA2h0IFeJOAgG5',
|
|
37
|
+
cli_founder: 'plan_GpzWZLfsOzjrvI',
|
|
38
|
+
cli_founder_30: 'plan_GsL1IRUwpj5CIF',
|
|
39
|
+
cli_founder_50: 'plan_GsL1IRUwpj5CIF',
|
|
40
|
+
cli_performance: 'price_1L822LIewCKA2h0I5JYyOG1p',
|
|
41
|
+
cli_scale: 'price_1L822RIewCKA2h0IPt9f2nZM',
|
|
42
|
+
builder_essential: 'price_1M4oA4IewCKA2h0IWgfbSJBe',
|
|
43
|
+
builder_professional: 'price_1MIDxtIewCKA2h0IvWi5weJL',
|
|
44
|
+
enterprise: 'plan_GuGICX6nRtDthN',
|
|
45
45
|
};
|
|
46
|
-
exports.getPlanEnvironment = (stage) => stage ===
|
|
46
|
+
exports.getPlanEnvironment = (stage) => stage === 'prod' ? exports.prodPlanIds : exports.devPlanIds;
|
|
47
47
|
/* ToDesktop CLI Plans */
|
|
48
48
|
exports.getCLIPlanIds = (stage) => {
|
|
49
49
|
const planIds = exports.getPlanEnvironment(stage);
|
|
50
|
-
return pick(planIds,
|
|
50
|
+
return pick(planIds, 'cli_founder', 'cli_founder_30', 'cli_founder_50', 'cli_performance', 'cli_scale');
|
|
51
51
|
};
|
|
52
52
|
exports.getCLIFounderPlanIds = (stage) => {
|
|
53
53
|
const planIds = exports.getPlanEnvironment(stage);
|
|
54
|
-
return pick(planIds,
|
|
54
|
+
return pick(planIds, 'cli_founder', 'cli_founder_30', 'cli_founder_50');
|
|
55
55
|
};
|
|
56
56
|
exports.getCLIPerformancePlanIds = (stage) => {
|
|
57
57
|
const planIds = exports.getPlanEnvironment(stage);
|
|
58
|
-
return pick(planIds,
|
|
58
|
+
return pick(planIds, 'cli_performance');
|
|
59
59
|
};
|
|
60
60
|
exports.getCLIScalePlanIds = (stage) => {
|
|
61
61
|
const planIds = exports.getPlanEnvironment(stage);
|
|
62
|
-
return pick(planIds,
|
|
62
|
+
return pick(planIds, 'cli_scale');
|
|
63
63
|
};
|
|
64
64
|
/* ToDesktop Builder Plans */
|
|
65
65
|
exports.getBuilderPlanIds = (stage) => {
|
|
66
66
|
const planIds = exports.getPlanEnvironment(stage);
|
|
67
|
-
return pick(planIds,
|
|
67
|
+
return pick(planIds, 'builder_essential', 'builder_professional');
|
|
68
68
|
};
|
|
69
69
|
exports.getBuilderEssentialPlanIds = (stage) => {
|
|
70
70
|
const planIds = exports.getPlanEnvironment(stage);
|
|
71
|
-
return pick(planIds,
|
|
71
|
+
return pick(planIds, 'builder_essential');
|
|
72
72
|
};
|
|
73
73
|
exports.getBuilderProfessionalPlanIds = (stage) => {
|
|
74
74
|
const planIds = exports.getPlanEnvironment(stage);
|
|
75
|
-
return pick(planIds,
|
|
75
|
+
return pick(planIds, 'builder_professional');
|
|
76
76
|
};
|
|
77
77
|
/* ToDesktop Web Plans */
|
|
78
78
|
exports.getEssentialPlanIds = (stage) => {
|
|
79
79
|
const planIds = exports.getPlanEnvironment(stage);
|
|
80
|
-
return pick(planIds,
|
|
80
|
+
return pick(planIds, 'startup', 'essential', 'essential_new');
|
|
81
81
|
};
|
|
82
82
|
exports.getProfessionalPlanIds = (stage) => {
|
|
83
83
|
const planIds = exports.getPlanEnvironment(stage);
|
|
84
|
-
return pick(planIds,
|
|
84
|
+
return pick(planIds, 'business', 'growth', 'professional', 'professional_annual');
|
|
85
85
|
};
|
|
86
86
|
exports.getEnterprisePlanIds = (stage) => {
|
|
87
87
|
const planIds = exports.getPlanEnvironment(stage);
|
|
88
|
-
return pick(planIds,
|
|
88
|
+
return pick(planIds, 'enterprise');
|
|
89
89
|
};
|
package/lib/plugin.d.ts
CHANGED
|
@@ -22,17 +22,17 @@ export declare type PluginPreferences = {
|
|
|
22
22
|
[id: string]: PluginPreference;
|
|
23
23
|
};
|
|
24
24
|
export declare type PluginPreference = NumberSpec | TextSpec | CheckboxSpec;
|
|
25
|
-
export declare type TextSpec = PreferenceSpec<
|
|
25
|
+
export declare type TextSpec = PreferenceSpec<'text', {
|
|
26
26
|
validator?: AjvJSONSchemaType;
|
|
27
27
|
value?: string;
|
|
28
28
|
placeholder?: string;
|
|
29
29
|
}>;
|
|
30
|
-
export declare type NumberSpec = PreferenceSpec<
|
|
30
|
+
export declare type NumberSpec = PreferenceSpec<'number', {
|
|
31
31
|
validator?: AjvJSONSchemaType;
|
|
32
32
|
value?: number;
|
|
33
33
|
placeholder?: number;
|
|
34
34
|
}>;
|
|
35
|
-
export declare type CheckboxSpec = PreferenceSpec<
|
|
35
|
+
export declare type CheckboxSpec = PreferenceSpec<'checkbox', {
|
|
36
36
|
validator?: AjvJSONSchemaType;
|
|
37
37
|
value?: boolean;
|
|
38
38
|
}>;
|
package/lib/toDesktop.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseApp, Schemable } from
|
|
2
|
-
import { IAppBuilderLib } from
|
|
3
|
-
export declare type IUploadFileStatus =
|
|
1
|
+
import { BaseApp, Schemable } from './base';
|
|
2
|
+
import { IAppBuilderLib } from './desktopify';
|
|
3
|
+
export declare type IUploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed';
|
|
4
4
|
export interface IUploadFile {
|
|
5
5
|
uid: string;
|
|
6
6
|
size: number;
|
|
@@ -88,7 +88,7 @@ export interface IApp extends BaseApp {
|
|
|
88
88
|
appPkgName?: string;
|
|
89
89
|
appProtocol?: ISwitchableValue<string>;
|
|
90
90
|
appType?: string;
|
|
91
|
-
appxConfig?: Partial<IAppBuilderLib[
|
|
91
|
+
appxConfig?: Partial<IAppBuilderLib['config']['appx']>;
|
|
92
92
|
cssToInject?: string;
|
|
93
93
|
customDomain?: string;
|
|
94
94
|
customUserAgent?: ISwitchableValue<string>;
|
|
@@ -116,14 +116,14 @@ export interface IApp extends BaseApp {
|
|
|
116
116
|
jsToInject?: string;
|
|
117
117
|
menubarIcon?: string;
|
|
118
118
|
name: string;
|
|
119
|
-
nsisConfig?: Partial<IAppBuilderLib[
|
|
119
|
+
nsisConfig?: Partial<IAppBuilderLib['config']['nsis']>;
|
|
120
120
|
runtimeEnvs?: string;
|
|
121
121
|
secret?: string;
|
|
122
122
|
shouldLaunchAtStartupByDefault?: boolean;
|
|
123
123
|
shouldOnlySendAbsolutelyNecessaryRequests?: boolean;
|
|
124
124
|
shouldReuseRendererProcess?: boolean;
|
|
125
|
-
themeSource?:
|
|
126
|
-
themeSourceMac?:
|
|
125
|
+
themeSource?: 'system' | 'light' | 'dark';
|
|
126
|
+
themeSourceMac?: 'system' | 'light' | 'dark';
|
|
127
127
|
toggleVisibilityKeyboardShortcut?: ISwitchableValue<string>;
|
|
128
128
|
trayIcon?: string;
|
|
129
129
|
url: string;
|
|
@@ -133,7 +133,7 @@ export interface IApp extends BaseApp {
|
|
|
133
133
|
}
|
|
134
134
|
export interface IUser extends Schemable {
|
|
135
135
|
id: string;
|
|
136
|
-
authInfo?:
|
|
136
|
+
authInfo?: object;
|
|
137
137
|
avatar?: string;
|
|
138
138
|
currentApplication?: string;
|
|
139
139
|
customerId?: string;
|
package/lib/translation.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare type ValidTranslationKeys =
|
|
2
|
-
export declare type ValidTranslationLanguages =
|
|
1
|
+
export declare type ValidTranslationKeys = 'updateNotification.title' | 'updateNotification.body';
|
|
2
|
+
export declare type ValidTranslationLanguages = 'default';
|
package/lib/validations.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as yup from
|
|
2
|
-
import { DesktopifyApp2 } from
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
import { DesktopifyApp2 } from '.';
|
|
3
3
|
export declare const appTitleValidation: yup.StringSchema;
|
|
4
4
|
export declare const forceVersionValidation: yup.StringSchema;
|
|
5
5
|
export declare const iconValidation: yup.StringSchema;
|
package/lib/validations.js
CHANGED
|
@@ -6,85 +6,85 @@ const semver = require("semver");
|
|
|
6
6
|
const isRegex = require("is-regex");
|
|
7
7
|
exports.appTitleValidation = yup
|
|
8
8
|
.string()
|
|
9
|
-
.label(
|
|
9
|
+
.label('App title')
|
|
10
10
|
.max(26)
|
|
11
|
-
.matches(/^[\w\-\s]+$/,
|
|
12
|
-
.matches(/^[^\s]+(\s+[^\s]+)*$/,
|
|
11
|
+
.matches(/^[\w\-\s]+$/, 'App title may contain letters, numbers, spaces and dashes only')
|
|
12
|
+
.matches(/^[^\s]+(\s+[^\s]+)*$/, 'App title may not begin or end with space')
|
|
13
13
|
.required();
|
|
14
14
|
function isNumeric(str) {
|
|
15
|
-
if (typeof str !=
|
|
15
|
+
if (typeof str != 'string')
|
|
16
16
|
return false;
|
|
17
|
-
return !isNaN(str) && !isNaN(parseFloat(str));
|
|
17
|
+
return !isNaN(Number(str)) && !isNaN(parseFloat(str));
|
|
18
18
|
}
|
|
19
19
|
function isNumericSemver(value) {
|
|
20
20
|
// check if valid semver
|
|
21
21
|
if (!semver.valid(value))
|
|
22
22
|
return false;
|
|
23
23
|
// ensure that all values are numbers
|
|
24
|
-
if (!value.split(
|
|
24
|
+
if (!value.split('.').every((num) => isNumeric(num)))
|
|
25
25
|
return false;
|
|
26
26
|
return true;
|
|
27
27
|
}
|
|
28
28
|
exports.forceVersionValidation = yup
|
|
29
29
|
.string()
|
|
30
|
-
.label(
|
|
30
|
+
.label('App version')
|
|
31
31
|
.required()
|
|
32
|
-
.when(
|
|
32
|
+
.when('$currentVersion', (currentVersion, schema) => schema.test('semantic-version', 'App version must follow a numeric SemVer versioning scheme (e.g. 1.0.0) and be greater than prior version.', (forceVersion) => {
|
|
33
33
|
return (isNumericSemver(forceVersion) &&
|
|
34
34
|
semver.gt(forceVersion, currentVersion));
|
|
35
35
|
}));
|
|
36
36
|
exports.iconValidation = yup
|
|
37
37
|
.string()
|
|
38
|
-
.label(
|
|
38
|
+
.label('Icon')
|
|
39
39
|
.url()
|
|
40
|
-
.required(
|
|
40
|
+
.required('You must upload an icon for your app');
|
|
41
41
|
exports.urlValidation = yup
|
|
42
42
|
.string()
|
|
43
43
|
.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*)?$/, {
|
|
44
44
|
message: "Invalid URL. Don't forget to include the protocol (e.g.. https://).",
|
|
45
45
|
excludeEmptyString: true,
|
|
46
46
|
})
|
|
47
|
-
.label(
|
|
47
|
+
.label('Website URL')
|
|
48
48
|
.required();
|
|
49
49
|
exports.urlValidationForm = yup.object().shape({
|
|
50
50
|
url: exports.urlValidation,
|
|
51
51
|
});
|
|
52
52
|
exports.heightValidation = yup
|
|
53
53
|
.number()
|
|
54
|
-
.label(
|
|
54
|
+
.label('Height')
|
|
55
55
|
.moreThan(1)
|
|
56
56
|
.lessThan(2000)
|
|
57
57
|
.required();
|
|
58
58
|
exports.widthValidation = yup
|
|
59
59
|
.number()
|
|
60
|
-
.label(
|
|
60
|
+
.label('Width')
|
|
61
61
|
.moreThan(1)
|
|
62
62
|
.lessThan(3000)
|
|
63
63
|
.required();
|
|
64
64
|
exports.internalAppRegexValidation = yup
|
|
65
65
|
.string()
|
|
66
66
|
.required()
|
|
67
|
-
.label(
|
|
68
|
-
.test(
|
|
69
|
-
if (value.includes(
|
|
70
|
-
|
|
71
|
-
.split(
|
|
72
|
-
.map((char) => char ===
|
|
67
|
+
.label('Internal URLs')
|
|
68
|
+
.test('escape-forward-slash', "a forward-slash ('/') must be escaped with a back-slash ('\\')", (value) => {
|
|
69
|
+
if (value.includes('/')) {
|
|
70
|
+
const forwardSlashCount = value
|
|
71
|
+
.split('')
|
|
72
|
+
.map((char) => char === '/')
|
|
73
73
|
.filter((isTrue) => isTrue).length;
|
|
74
|
-
|
|
74
|
+
const backSlashEscapeCount = ((value || '').match(/(?=\\\/)/g) || [])
|
|
75
75
|
.length;
|
|
76
76
|
return forwardSlashCount === backSlashEscapeCount;
|
|
77
77
|
}
|
|
78
78
|
return true;
|
|
79
79
|
})
|
|
80
|
-
.test(
|
|
80
|
+
.test('is-regex', '${path} must be valid regular expression', (value) => isRegex(RegExp(value)));
|
|
81
81
|
exports.appProtocolValidation = yup
|
|
82
82
|
.string()
|
|
83
83
|
.required()
|
|
84
|
-
.label(
|
|
85
|
-
.test(
|
|
86
|
-
.test(
|
|
87
|
-
.matches(/^[a-zA-Z
|
|
84
|
+
.label('App Protocol')
|
|
85
|
+
.test('ends-with-protocol', 'Protocols must end with `://`', (value) => value.endsWith('://'))
|
|
86
|
+
.test('is-lowercase', 'Protocols must be lowercase', (value) => value === value.toLowerCase())
|
|
87
|
+
.matches(/^[a-zA-Z-]+:\/\/$/, 'Protocols contain letters and dashes (-) only')
|
|
88
88
|
.min(5);
|
|
89
89
|
exports.appConfigValidation = yup.object({
|
|
90
90
|
id: yup.string().required(),
|
|
@@ -134,5 +134,5 @@ exports.appConfigValidation = yup.object({
|
|
|
134
134
|
.required(),
|
|
135
135
|
});
|
|
136
136
|
exports.shouldMinimizeToTrayIsActive = (desktopApp) => {
|
|
137
|
-
return desktopApp.trays.some((t) => t.leftClick.role ===
|
|
137
|
+
return desktopApp.trays.some((t) => t.leftClick.role === 'toggleMenu' || t.rightClick.role === 'toggleMenu');
|
|
138
138
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@todesktop/shared",
|
|
3
|
-
"version": "7.184.
|
|
3
|
+
"version": "7.184.19",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
9
|
"build": "rm -f ./lib/* && tsc",
|
|
10
|
+
"lint": "npm run lint:types && npm run lint:styles",
|
|
11
|
+
"lint:types": "tsc --noEmit",
|
|
12
|
+
"lint:styles": "prettier --check . && eslint src",
|
|
10
13
|
"prepublishOnly": "npm run build",
|
|
11
14
|
"bump": "npm version minor && git push && npm publish",
|
|
12
15
|
"dev": "tsc"
|
|
@@ -24,12 +27,13 @@
|
|
|
24
27
|
},
|
|
25
28
|
"devDependencies": {
|
|
26
29
|
"@types/semver": "^7.3.9",
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^5.60.1",
|
|
31
|
+
"@typescript-eslint/parser": "^5.60.1",
|
|
27
32
|
"app-builder-lib": "^22.10.4",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"tslint-react-hooks": "1.1.0",
|
|
33
|
+
"eslint": "^8.43.0",
|
|
34
|
+
"eslint-config-prettier": "^8.8.0",
|
|
35
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
36
|
+
"prettier": "^2.8.8",
|
|
33
37
|
"typescript": "^3.9.10"
|
|
34
38
|
}
|
|
35
39
|
}
|
package/src/base.ts
CHANGED
|
@@ -3,45 +3,45 @@ import {
|
|
|
3
3
|
FilePath,
|
|
4
4
|
IAppBuilderLib,
|
|
5
5
|
Release,
|
|
6
|
-
} from
|
|
6
|
+
} from './desktopify';
|
|
7
7
|
export interface Schemable {
|
|
8
8
|
schemaVersion?: number;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export type ProgressTypes =
|
|
11
|
+
export type ProgressTypes = 'progress' | 'done' | 'error';
|
|
12
12
|
|
|
13
13
|
export interface IChecklistItem {
|
|
14
14
|
[id: string]: boolean;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface IDownloadButtonOptions {
|
|
18
|
-
buttonSize:
|
|
19
|
-
fontFamily:
|
|
18
|
+
buttonSize: 'small' | 'medium' | 'large';
|
|
19
|
+
fontFamily: 'serif' | 'sans-serif';
|
|
20
20
|
bgColor: string;
|
|
21
21
|
fgColor: string;
|
|
22
22
|
borderRadius: number;
|
|
23
23
|
showAppIcon: {
|
|
24
24
|
enabled: boolean;
|
|
25
|
-
alignment:
|
|
25
|
+
alignment: 'right' | 'left';
|
|
26
26
|
};
|
|
27
27
|
showDownloadIcon: {
|
|
28
28
|
enabled: boolean;
|
|
29
|
-
alignment:
|
|
29
|
+
alignment: 'right' | 'left';
|
|
30
30
|
};
|
|
31
31
|
btnText: string;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export enum WindowsEVOnboardingSteps {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
'hasChosenProvider' = 'hasChosenProvider',
|
|
36
|
+
'hasOrderedCert' = 'hasOrderedCert',
|
|
37
|
+
'hasBeenVerified' = 'hasBeenVerified',
|
|
38
|
+
'hasGeneratedCert' = 'hasGeneratedCert',
|
|
39
|
+
'hasUploadedCert' = 'hasUploadedCert',
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export enum WindowsEVOnboardingProvider {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
'globalsign' = 'globalsign',
|
|
44
|
+
'other' = 'other',
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export interface IAppBuildProgress {
|
|
@@ -58,7 +58,7 @@ export interface IAppMeta {
|
|
|
58
58
|
currentBuildProgress?: {
|
|
59
59
|
channel?: string;
|
|
60
60
|
id?: string;
|
|
61
|
-
releaseId?: Release[
|
|
61
|
+
releaseId?: Release['id'];
|
|
62
62
|
linux?: IAppBuildProgress;
|
|
63
63
|
mac?: IAppBuildProgress;
|
|
64
64
|
projectConfig?: {
|
|
@@ -77,14 +77,14 @@ export interface IAppMeta {
|
|
|
77
77
|
iconSize?: number;
|
|
78
78
|
iconTextSize?: number;
|
|
79
79
|
title?: string;
|
|
80
|
-
contents?: IAppBuilderLib[
|
|
81
|
-
window?: IAppBuilderLib[
|
|
80
|
+
contents?: IAppBuilderLib['config']['dmg']['contents'];
|
|
81
|
+
window?: IAppBuilderLib['config']['dmg']['window'];
|
|
82
82
|
};
|
|
83
83
|
extraContentFiles?: ExtraFileReference[];
|
|
84
84
|
electronMirror?: string;
|
|
85
85
|
electronVersion?: string;
|
|
86
86
|
extraResources?: ExtraFileReference[];
|
|
87
|
-
fileAssociations?: IAppBuilderLib[
|
|
87
|
+
fileAssociations?: IAppBuilderLib['config']['fileAssociations'];
|
|
88
88
|
filesForDistribution?: string[];
|
|
89
89
|
icon: FilePath;
|
|
90
90
|
id: string;
|
|
@@ -98,14 +98,14 @@ export interface IAppMeta {
|
|
|
98
98
|
category?: string;
|
|
99
99
|
dmgBackground?: FilePath;
|
|
100
100
|
entitlements?: FilePath;
|
|
101
|
-
extendInfo?: IAppBuilderLib[
|
|
101
|
+
extendInfo?: IAppBuilderLib['config']['mac']['extendInfo'];
|
|
102
102
|
icon?: FilePath;
|
|
103
103
|
};
|
|
104
104
|
nodeVersion?: string;
|
|
105
|
-
packageManager?:
|
|
105
|
+
packageManager?: 'npm' | 'yarn' | 'pnpm';
|
|
106
106
|
productName?: string;
|
|
107
107
|
schemaVersion: number;
|
|
108
|
-
snap?: IAppBuilderLib[
|
|
108
|
+
snap?: IAppBuilderLib['config']['snap'];
|
|
109
109
|
windows?: {
|
|
110
110
|
icon?: FilePath;
|
|
111
111
|
nsisCustomBinary?: {
|
|
@@ -155,8 +155,8 @@ export interface IAppMeta {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
export enum WindowsHSMCertType {
|
|
158
|
-
ev =
|
|
159
|
-
file =
|
|
158
|
+
ev = 'ev',
|
|
159
|
+
file = 'file',
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
export interface CustomWindowsCodeSignFile {
|
|
@@ -169,7 +169,7 @@ export interface CustomWindowsCodeSignFile {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
export interface CustomWindowsCodeSignEV {
|
|
172
|
-
certType:
|
|
172
|
+
certType: 'hsm';
|
|
173
173
|
hsmCertType: WindowsHSMCertType.ev;
|
|
174
174
|
hsmCertName: string;
|
|
175
175
|
}
|
|
@@ -218,7 +218,7 @@ export interface BaseApp extends Schemable {
|
|
|
218
218
|
shouldCreateMacUniversalInstaller?: boolean;
|
|
219
219
|
|
|
220
220
|
// artifact configs
|
|
221
|
-
appxConfig?: Partial<IAppBuilderLib[
|
|
222
|
-
nsisConfig?: Partial<IAppBuilderLib[
|
|
221
|
+
appxConfig?: Partial<IAppBuilderLib['config']['appx']>;
|
|
222
|
+
nsisConfig?: Partial<IAppBuilderLib['config']['nsis']>;
|
|
223
223
|
snapStore?: { login?: string; description?: string };
|
|
224
224
|
}
|