@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/lib/esm/plans.js
ADDED
|
@@ -0,0 +1,626 @@
|
|
|
1
|
+
export var PortalConfigKey;
|
|
2
|
+
(function (PortalConfigKey) {
|
|
3
|
+
PortalConfigKey["BuilderUpdateDev"] = "builder_update_dev";
|
|
4
|
+
PortalConfigKey["BuilderUpdateProd"] = "builder_update_prod";
|
|
5
|
+
PortalConfigKey["BuilderUpgradeDev"] = "builder_upgrade_dev";
|
|
6
|
+
PortalConfigKey["BuilderUpgradeProd"] = "builder_upgrade_prod";
|
|
7
|
+
PortalConfigKey["CLIUpdateDev"] = "cli_update_dev";
|
|
8
|
+
PortalConfigKey["CLIUpdateProd"] = "cli_update_prod";
|
|
9
|
+
PortalConfigKey["CLIUpgradeDev"] = "cli_upgrade_dev";
|
|
10
|
+
PortalConfigKey["CLIUpgradeProd"] = "cli_upgrade_prod";
|
|
11
|
+
})(PortalConfigKey || (PortalConfigKey = {}));
|
|
12
|
+
// --- factory functions ---
|
|
13
|
+
const createPrice = (id, price) => {
|
|
14
|
+
return Object.assign({ id }, price);
|
|
15
|
+
};
|
|
16
|
+
const createProduct = (id, prices) => ({ id, prices });
|
|
17
|
+
const createPlan = (tier, products) => {
|
|
18
|
+
const record = {
|
|
19
|
+
basic: { label: 'Basic', tiers: ['basic', 'legacy_pro', 'pro', 'scale'] },
|
|
20
|
+
legacy_pro: { label: 'Pro', tiers: ['legacy_pro', 'pro', 'scale'] },
|
|
21
|
+
pro: { label: 'Pro', tiers: ['pro', 'scale'] },
|
|
22
|
+
scale: { label: 'Scale', tiers: ['scale'] },
|
|
23
|
+
};
|
|
24
|
+
const { label, tiers } = record[tier];
|
|
25
|
+
return {
|
|
26
|
+
eligiblePlanTiers: tiers,
|
|
27
|
+
label,
|
|
28
|
+
products: { dev: products.dev, prod: products.prod },
|
|
29
|
+
tier,
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const PORTAL_VERSION = 1; // increment this value to force Stripe to update the portal configurations
|
|
33
|
+
const createPortalConfig = (key, products) => {
|
|
34
|
+
return {
|
|
35
|
+
business_profile: {
|
|
36
|
+
headline: 'ToDesktop Billing Portal',
|
|
37
|
+
privacy_policy_url: 'https://www.todesktop.com/privacy-policy',
|
|
38
|
+
terms_of_service_url: 'https://www.todesktop.com/terms',
|
|
39
|
+
},
|
|
40
|
+
default_return_url: 'https://app.todesktop.com',
|
|
41
|
+
features: {
|
|
42
|
+
payment_method_update: { enabled: true },
|
|
43
|
+
subscription_update: {
|
|
44
|
+
default_allowed_updates: ['price'],
|
|
45
|
+
enabled: true,
|
|
46
|
+
products: products.map((product) => {
|
|
47
|
+
return {
|
|
48
|
+
prices: Object.values(product.prices)
|
|
49
|
+
.filter((price) => price.status === 'active')
|
|
50
|
+
.map((price) => price.id),
|
|
51
|
+
product: product.id,
|
|
52
|
+
};
|
|
53
|
+
}),
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
metadata: { key, version: PORTAL_VERSION },
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
// --- products ---
|
|
60
|
+
export const products = {
|
|
61
|
+
dev: {
|
|
62
|
+
builder: {
|
|
63
|
+
essential: createProduct('prod_MoR1S4o0nLv00y', {
|
|
64
|
+
monthly_125: createPrice('price_1PuuAqIewCKA2h0Iw4judQNj', {
|
|
65
|
+
amount: 125,
|
|
66
|
+
period: 'monthly',
|
|
67
|
+
status: 'active',
|
|
68
|
+
}),
|
|
69
|
+
monthly_99: createPrice('price_1M4o9XIewCKA2h0IVfGrid8E', {
|
|
70
|
+
amount: 99,
|
|
71
|
+
period: 'monthly',
|
|
72
|
+
status: 'inactive',
|
|
73
|
+
}),
|
|
74
|
+
yearly_1200: createPrice('price_1PuvdgIewCKA2h0IisTKqjFN', {
|
|
75
|
+
amount: 1200,
|
|
76
|
+
period: 'yearly',
|
|
77
|
+
status: 'active',
|
|
78
|
+
}),
|
|
79
|
+
}),
|
|
80
|
+
professional: createProduct('prod_MoR1SchsRDAIgY', {
|
|
81
|
+
monthly_199: createPrice('price_1M4o9vIewCKA2h0IHREokdD8', {
|
|
82
|
+
amount: 199,
|
|
83
|
+
period: 'monthly',
|
|
84
|
+
status: 'inactive',
|
|
85
|
+
}),
|
|
86
|
+
monthly_240: createPrice('price_1M4o9vIewCKA2h0IHREokdD8', {
|
|
87
|
+
amount: 240,
|
|
88
|
+
period: 'monthly',
|
|
89
|
+
status: 'inactive',
|
|
90
|
+
}),
|
|
91
|
+
monthly_300: createPrice('price_1PuuHrIewCKA2h0IQfEZ4Wog', {
|
|
92
|
+
amount: 300,
|
|
93
|
+
period: 'monthly',
|
|
94
|
+
status: 'active',
|
|
95
|
+
}),
|
|
96
|
+
yearly_2880: createPrice('price_1PuuJAIewCKA2h0IibpUIhf9', {
|
|
97
|
+
amount: 2880,
|
|
98
|
+
period: 'yearly',
|
|
99
|
+
status: 'active',
|
|
100
|
+
}),
|
|
101
|
+
}),
|
|
102
|
+
},
|
|
103
|
+
cli: {
|
|
104
|
+
founder: createProduct('prod_Gq0E8nbTYHtkPl', {
|
|
105
|
+
monthly_100: createPrice('plan_Gq0FzdmoTJshQL', {
|
|
106
|
+
amount: 100,
|
|
107
|
+
period: 'monthly',
|
|
108
|
+
status: 'inactive',
|
|
109
|
+
}),
|
|
110
|
+
monthly_125: createPrice('price_1PuuMRIewCKA2h0IrggfwCwA', {
|
|
111
|
+
amount: 125,
|
|
112
|
+
period: 'monthly',
|
|
113
|
+
status: 'active',
|
|
114
|
+
}),
|
|
115
|
+
yearly_1200: createPrice('price_1PuuMkIewCKA2h0IRxhkDpmk', {
|
|
116
|
+
amount: 1200,
|
|
117
|
+
period: 'yearly',
|
|
118
|
+
status: 'active',
|
|
119
|
+
}),
|
|
120
|
+
}),
|
|
121
|
+
founder30: createProduct('prod_GsL6LaRo4NFD5n', {
|
|
122
|
+
monthly_30: createPrice('plan_GsL7NZskOY0TC9', {
|
|
123
|
+
amount: 30,
|
|
124
|
+
period: 'monthly',
|
|
125
|
+
status: 'active',
|
|
126
|
+
}),
|
|
127
|
+
}),
|
|
128
|
+
founder50: createProduct('prod_GsL5O1PdbxOrxJ', {
|
|
129
|
+
monthly_50: createPrice('plan_GsL6VYAshfh7c4', {
|
|
130
|
+
amount: 50,
|
|
131
|
+
period: 'monthly',
|
|
132
|
+
status: 'active',
|
|
133
|
+
}),
|
|
134
|
+
monthly_90: createPrice('plan_GsL6VYAshfh7c4', {
|
|
135
|
+
amount: 90,
|
|
136
|
+
period: 'monthly',
|
|
137
|
+
status: 'inactive',
|
|
138
|
+
}),
|
|
139
|
+
}),
|
|
140
|
+
performance: createProduct('prod_LphQku6BNkzCga', {
|
|
141
|
+
monthly_300: createPrice('price_1L821UIewCKA2h0IUwRhicyo', {
|
|
142
|
+
amount: 300,
|
|
143
|
+
period: 'monthly',
|
|
144
|
+
status: 'inactive',
|
|
145
|
+
}),
|
|
146
|
+
monthly_375: createPrice('price_1PuuO7IewCKA2h0IOK9ivzS0', {
|
|
147
|
+
amount: 375,
|
|
148
|
+
period: 'monthly',
|
|
149
|
+
status: 'active',
|
|
150
|
+
}),
|
|
151
|
+
yearly_3600: createPrice('price_1PuuOKIewCKA2h0IrcVvJkgG', {
|
|
152
|
+
amount: 3600,
|
|
153
|
+
period: 'yearly',
|
|
154
|
+
status: 'active',
|
|
155
|
+
}),
|
|
156
|
+
}),
|
|
157
|
+
scale: createProduct('prod_LphQxNgfUIxVfA', {
|
|
158
|
+
monthly_1200: createPrice('price_1L821wIewCKA2h0IMLUmjulL', {
|
|
159
|
+
amount: 1200,
|
|
160
|
+
period: 'monthly',
|
|
161
|
+
status: 'inactive',
|
|
162
|
+
}),
|
|
163
|
+
monthly_1500: createPrice('price_1PuuPFIewCKA2h0IbPmKdsJr', {
|
|
164
|
+
amount: 1500,
|
|
165
|
+
period: 'monthly',
|
|
166
|
+
status: 'active',
|
|
167
|
+
}),
|
|
168
|
+
yearly_14400: createPrice('price_1PuuPaIewCKA2h0IhLfSlRFj', {
|
|
169
|
+
amount: 14400,
|
|
170
|
+
period: 'yearly',
|
|
171
|
+
status: 'active',
|
|
172
|
+
}),
|
|
173
|
+
}),
|
|
174
|
+
},
|
|
175
|
+
legacy: {
|
|
176
|
+
business: createProduct('prod_Fe8CbCE2wGJIWr', {
|
|
177
|
+
monthly_199: createPrice('plan_Fe8CUkZfXasFtB', {
|
|
178
|
+
amount: 199,
|
|
179
|
+
period: 'monthly',
|
|
180
|
+
status: 'active',
|
|
181
|
+
}),
|
|
182
|
+
}),
|
|
183
|
+
enterprise: createProduct('prod_Hc9PMnHUmHvOlw', {
|
|
184
|
+
monthly_700: createPrice('price_1H2v6JIewCKA2h0IgUwsuctb', {
|
|
185
|
+
amount: 700,
|
|
186
|
+
period: 'monthly',
|
|
187
|
+
status: 'active',
|
|
188
|
+
}),
|
|
189
|
+
}),
|
|
190
|
+
essential: createProduct('prod_FplN7CkqFRH0ye', {
|
|
191
|
+
monthly_58: createPrice('plan_FpljxNuZtNFFbm', {
|
|
192
|
+
amount: 58,
|
|
193
|
+
period: 'monthly',
|
|
194
|
+
status: 'active',
|
|
195
|
+
}),
|
|
196
|
+
}),
|
|
197
|
+
essentialNew: createProduct('prod_GYXm5X66hM1Ywj', {
|
|
198
|
+
monthly_58: createPrice('plan_GYXmTA3EdfCv4q', {
|
|
199
|
+
amount: 58,
|
|
200
|
+
period: 'monthly',
|
|
201
|
+
status: 'active',
|
|
202
|
+
}),
|
|
203
|
+
yearly_580: createPrice('plan_GYXmTA3EdfCv4q', {
|
|
204
|
+
amount: 580,
|
|
205
|
+
period: 'yearly',
|
|
206
|
+
status: 'active',
|
|
207
|
+
}),
|
|
208
|
+
}),
|
|
209
|
+
growth: createProduct('prod_FplOSDbBmxba94', {
|
|
210
|
+
monthly_199: createPrice('plan_FplOshrr1w3Mvu', {
|
|
211
|
+
amount: 199,
|
|
212
|
+
period: 'monthly',
|
|
213
|
+
status: 'active',
|
|
214
|
+
}),
|
|
215
|
+
}),
|
|
216
|
+
professional: createProduct('prod_GYXo54YK5kga12', {
|
|
217
|
+
monthly_199: createPrice('plan_GYXoIkvwVKyfF2', {
|
|
218
|
+
amount: 199,
|
|
219
|
+
period: 'monthly',
|
|
220
|
+
status: 'active',
|
|
221
|
+
}),
|
|
222
|
+
yearly_1990: createPrice('price_1KHU70IewCKA2h0IR87yXOQ2', {
|
|
223
|
+
amount: 1990,
|
|
224
|
+
period: 'yearly',
|
|
225
|
+
status: 'inactive',
|
|
226
|
+
}),
|
|
227
|
+
yearly_2388: createPrice('price_1KHU70IewCKA2h0IR87yXOQ2', {
|
|
228
|
+
amount: 2388,
|
|
229
|
+
period: 'yearly',
|
|
230
|
+
status: 'active',
|
|
231
|
+
}),
|
|
232
|
+
}),
|
|
233
|
+
startup: createProduct('prod_Fe8BTslXbdylxV', {
|
|
234
|
+
monthly_49: createPrice('plan_Fe8BzLp7k71eGD', {
|
|
235
|
+
amount: 49,
|
|
236
|
+
period: 'monthly',
|
|
237
|
+
status: 'active',
|
|
238
|
+
}),
|
|
239
|
+
yearly_200: createPrice('plan_Fe8BzLp7k71eGD', {
|
|
240
|
+
amount: 200,
|
|
241
|
+
period: 'yearly',
|
|
242
|
+
status: 'active',
|
|
243
|
+
}),
|
|
244
|
+
}),
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
prod: {
|
|
248
|
+
builder: {
|
|
249
|
+
essential: createProduct('prod_MoR2Ldm5PJpJZJ', {
|
|
250
|
+
monthly_125: createPrice('price_1PuuU1IewCKA2h0IUSAcuUUb', {
|
|
251
|
+
amount: 125,
|
|
252
|
+
period: 'monthly',
|
|
253
|
+
status: 'active',
|
|
254
|
+
}),
|
|
255
|
+
monthly_99: createPrice('price_1M4oA4IewCKA2h0IWgfbSJBe', {
|
|
256
|
+
amount: 99,
|
|
257
|
+
period: 'monthly',
|
|
258
|
+
status: 'inactive',
|
|
259
|
+
}),
|
|
260
|
+
yearly_1200: createPrice('price_1PuuUZIewCKA2h0IDMNwNqQl', {
|
|
261
|
+
amount: 1200,
|
|
262
|
+
period: 'yearly',
|
|
263
|
+
status: 'active',
|
|
264
|
+
}),
|
|
265
|
+
}),
|
|
266
|
+
professional: createProduct('prod_MoR2h0Nf16hhgb', {
|
|
267
|
+
monthly_199: createPrice('price_1M4oABIewCKA2h0INkbaCbIS', {
|
|
268
|
+
amount: 199,
|
|
269
|
+
period: 'monthly',
|
|
270
|
+
status: 'inactive',
|
|
271
|
+
}),
|
|
272
|
+
monthly_240: createPrice('price_1MIDxtIewCKA2h0IvWi5weJL', {
|
|
273
|
+
amount: 240,
|
|
274
|
+
period: 'monthly',
|
|
275
|
+
status: 'inactive',
|
|
276
|
+
}),
|
|
277
|
+
monthly_300: createPrice('price_1PuuVSIewCKA2h0IETsLUwF9', {
|
|
278
|
+
amount: 300,
|
|
279
|
+
period: 'monthly',
|
|
280
|
+
status: 'active',
|
|
281
|
+
}),
|
|
282
|
+
yearly_2880: createPrice('price_1PuuVmIewCKA2h0I37dMpqI5', {
|
|
283
|
+
amount: 2880,
|
|
284
|
+
period: 'yearly',
|
|
285
|
+
status: 'active',
|
|
286
|
+
}),
|
|
287
|
+
}),
|
|
288
|
+
},
|
|
289
|
+
cli: {
|
|
290
|
+
founder: createProduct('prod_GpzVRVsBgluoef', {
|
|
291
|
+
monthly_100: createPrice('plan_GpzWZLfsOzjrvI', {
|
|
292
|
+
amount: 100,
|
|
293
|
+
period: 'monthly',
|
|
294
|
+
status: 'inactive',
|
|
295
|
+
}),
|
|
296
|
+
monthly_125: createPrice('price_1PuuXFIewCKA2h0IVHSyfFsd', {
|
|
297
|
+
amount: 125,
|
|
298
|
+
period: 'monthly',
|
|
299
|
+
status: 'active',
|
|
300
|
+
}),
|
|
301
|
+
yearly_1200: createPrice('price_1PuuXYIewCKA2h0IAsygBajd', {
|
|
302
|
+
amount: 1200,
|
|
303
|
+
period: 'yearly',
|
|
304
|
+
status: 'active',
|
|
305
|
+
}),
|
|
306
|
+
}),
|
|
307
|
+
founder30: createProduct('prod_GrHtZKuUDvLZOF', {
|
|
308
|
+
monthly_30: createPrice('plan_GrHuyGjzYN0XN2', {
|
|
309
|
+
amount: 30,
|
|
310
|
+
period: 'monthly',
|
|
311
|
+
status: 'active',
|
|
312
|
+
}),
|
|
313
|
+
}),
|
|
314
|
+
founder50: createProduct('prod_GsL0ntimYpTTwD', {
|
|
315
|
+
monthly_50: createPrice('plan_GsL1IRUwpj5CIF', {
|
|
316
|
+
amount: 50,
|
|
317
|
+
period: 'monthly',
|
|
318
|
+
status: 'active',
|
|
319
|
+
}),
|
|
320
|
+
monthly_90: createPrice('price_1JMHNnIewCKA2h0II5RGjVtk', {
|
|
321
|
+
amount: 90,
|
|
322
|
+
period: 'monthly',
|
|
323
|
+
status: 'inactive',
|
|
324
|
+
}),
|
|
325
|
+
}),
|
|
326
|
+
performance: createProduct('prod_LphRn5Rfuq3CMh', {
|
|
327
|
+
monthly_300: createPrice('price_1L822LIewCKA2h0I5JYyOG1p', {
|
|
328
|
+
amount: 300,
|
|
329
|
+
period: 'monthly',
|
|
330
|
+
status: 'inactive',
|
|
331
|
+
}),
|
|
332
|
+
monthly_375: createPrice('price_1PuuYKIewCKA2h0IWBJ4cyRQ', {
|
|
333
|
+
amount: 375,
|
|
334
|
+
period: 'monthly',
|
|
335
|
+
status: 'active',
|
|
336
|
+
}),
|
|
337
|
+
yearly_3600: createPrice('price_1PuuYcIewCKA2h0IzeU1xWbQ', {
|
|
338
|
+
amount: 3600,
|
|
339
|
+
period: 'yearly',
|
|
340
|
+
status: 'active',
|
|
341
|
+
}),
|
|
342
|
+
}),
|
|
343
|
+
scale: createProduct('prod_LphRKSuMLjQriP', {
|
|
344
|
+
monthly_1200: createPrice('price_1L822RIewCKA2h0IPt9f2nZM', {
|
|
345
|
+
amount: 1200,
|
|
346
|
+
period: 'monthly',
|
|
347
|
+
status: 'inactive',
|
|
348
|
+
}),
|
|
349
|
+
monthly_1500: createPrice('price_1PuuarIewCKA2h0IEONPcFU5', {
|
|
350
|
+
amount: 1500,
|
|
351
|
+
period: 'monthly',
|
|
352
|
+
status: 'active',
|
|
353
|
+
}),
|
|
354
|
+
yearly_14400: createPrice('price_1Puub5IewCKA2h0IMJ3CQ58r', {
|
|
355
|
+
amount: 14400,
|
|
356
|
+
period: 'yearly',
|
|
357
|
+
status: 'active',
|
|
358
|
+
}),
|
|
359
|
+
}),
|
|
360
|
+
},
|
|
361
|
+
legacy: {
|
|
362
|
+
business: createProduct('prod_FdmEvAgT7ZtVEw', {
|
|
363
|
+
monthly_199: createPrice('plan_FdmE8akq9ukxiY', {
|
|
364
|
+
amount: 199,
|
|
365
|
+
period: 'monthly',
|
|
366
|
+
status: 'active',
|
|
367
|
+
}),
|
|
368
|
+
}),
|
|
369
|
+
enterprise: createProduct('prod_GuGGWeMQ3SCuE9', {
|
|
370
|
+
monthly_700: createPrice('plan_GuGICX6nRtDthN', {
|
|
371
|
+
amount: 700,
|
|
372
|
+
period: 'monthly',
|
|
373
|
+
status: 'active',
|
|
374
|
+
}),
|
|
375
|
+
}),
|
|
376
|
+
essential: createProduct('prod_FohIP5aSMWWGyY', {
|
|
377
|
+
monthly_58: createPrice('plan_FohJzCujA6vvt4', {
|
|
378
|
+
amount: 58,
|
|
379
|
+
period: 'monthly',
|
|
380
|
+
status: 'active',
|
|
381
|
+
}),
|
|
382
|
+
}),
|
|
383
|
+
essentialNew: createProduct('prod_GYXn73zcoJKsF8', {
|
|
384
|
+
monthly_58: createPrice('plan_GYXn2cnPl5dy7j', {
|
|
385
|
+
amount: 58,
|
|
386
|
+
period: 'monthly',
|
|
387
|
+
status: 'active',
|
|
388
|
+
}),
|
|
389
|
+
yearly_580: createPrice('price_1Gqb24IewCKA2h0ILP5rxTnT', {
|
|
390
|
+
amount: 580,
|
|
391
|
+
period: 'yearly',
|
|
392
|
+
status: 'active',
|
|
393
|
+
}),
|
|
394
|
+
}),
|
|
395
|
+
growth: createProduct('prod_FohKfjLOlJNm1W', {
|
|
396
|
+
monthly_199: createPrice('plan_FohKGuWis5ocsi', {
|
|
397
|
+
amount: 199,
|
|
398
|
+
period: 'monthly',
|
|
399
|
+
status: 'active',
|
|
400
|
+
}),
|
|
401
|
+
}),
|
|
402
|
+
professional: createProduct('prod_GYXouE5K7vuitU', {
|
|
403
|
+
monthly_199: createPrice('plan_GYXoKsa2j0yURg', {
|
|
404
|
+
amount: 199,
|
|
405
|
+
period: 'monthly',
|
|
406
|
+
status: 'active',
|
|
407
|
+
}),
|
|
408
|
+
yearly_1990: createPrice('price_1KHTgaIewCKA2h0I81TVg85r', {
|
|
409
|
+
amount: 1990,
|
|
410
|
+
period: 'yearly',
|
|
411
|
+
status: 'inactive',
|
|
412
|
+
}),
|
|
413
|
+
yearly_2388: createPrice('price_1KLT32IewCKA2h0IFeJOAgG5', {
|
|
414
|
+
amount: 2388,
|
|
415
|
+
period: 'yearly',
|
|
416
|
+
status: 'active',
|
|
417
|
+
}),
|
|
418
|
+
}),
|
|
419
|
+
startup: createProduct('prod_FdmCGcrX2IETUH', {
|
|
420
|
+
monthly_49: createPrice('plan_FdmDAUN7JGD8pR', {
|
|
421
|
+
amount: 49,
|
|
422
|
+
period: 'monthly',
|
|
423
|
+
status: 'active',
|
|
424
|
+
}),
|
|
425
|
+
yearly_200: createPrice('plan_Ft8qvk401twwrW', {
|
|
426
|
+
amount: 200,
|
|
427
|
+
period: 'yearly',
|
|
428
|
+
status: 'active',
|
|
429
|
+
}),
|
|
430
|
+
}),
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
};
|
|
434
|
+
const { dev, prod } = products;
|
|
435
|
+
// --- plans ---
|
|
436
|
+
export const basicPlan = createPlan('basic', {
|
|
437
|
+
dev: [
|
|
438
|
+
dev.builder.essential,
|
|
439
|
+
dev.cli.founder30,
|
|
440
|
+
dev.cli.founder50,
|
|
441
|
+
dev.cli.founder,
|
|
442
|
+
dev.legacy.essential,
|
|
443
|
+
dev.legacy.essentialNew,
|
|
444
|
+
dev.legacy.startup,
|
|
445
|
+
],
|
|
446
|
+
prod: [
|
|
447
|
+
prod.builder.essential,
|
|
448
|
+
prod.cli.founder30,
|
|
449
|
+
prod.cli.founder50,
|
|
450
|
+
prod.cli.founder,
|
|
451
|
+
prod.legacy.essential,
|
|
452
|
+
prod.legacy.essentialNew,
|
|
453
|
+
prod.legacy.startup,
|
|
454
|
+
],
|
|
455
|
+
});
|
|
456
|
+
export const legacyProPlan = createPlan('legacy_pro', {
|
|
457
|
+
dev: [
|
|
458
|
+
dev.builder.professional,
|
|
459
|
+
dev.cli.founder,
|
|
460
|
+
dev.cli.founder30,
|
|
461
|
+
dev.cli.founder50,
|
|
462
|
+
dev.cli.performance,
|
|
463
|
+
dev.cli.scale,
|
|
464
|
+
dev.legacy.professional,
|
|
465
|
+
dev.legacy.growth,
|
|
466
|
+
dev.legacy.business,
|
|
467
|
+
],
|
|
468
|
+
prod: [
|
|
469
|
+
prod.builder.professional,
|
|
470
|
+
prod.cli.founder,
|
|
471
|
+
prod.cli.founder30,
|
|
472
|
+
prod.cli.founder50,
|
|
473
|
+
prod.cli.performance,
|
|
474
|
+
prod.cli.scale,
|
|
475
|
+
prod.legacy.professional,
|
|
476
|
+
prod.legacy.growth,
|
|
477
|
+
prod.legacy.business,
|
|
478
|
+
],
|
|
479
|
+
});
|
|
480
|
+
export const proPlan = createPlan('pro', {
|
|
481
|
+
dev: [
|
|
482
|
+
dev.builder.professional,
|
|
483
|
+
dev.cli.performance,
|
|
484
|
+
dev.legacy.professional,
|
|
485
|
+
dev.legacy.growth,
|
|
486
|
+
dev.legacy.business,
|
|
487
|
+
],
|
|
488
|
+
prod: [
|
|
489
|
+
prod.builder.professional,
|
|
490
|
+
prod.cli.performance,
|
|
491
|
+
prod.legacy.professional,
|
|
492
|
+
prod.legacy.growth,
|
|
493
|
+
prod.legacy.business,
|
|
494
|
+
],
|
|
495
|
+
});
|
|
496
|
+
export const scalePlan = createPlan('scale', {
|
|
497
|
+
dev: [dev.cli.scale, dev.legacy.enterprise],
|
|
498
|
+
prod: [prod.cli.scale, prod.legacy.enterprise],
|
|
499
|
+
});
|
|
500
|
+
// --- configurations ---
|
|
501
|
+
export const configurations = {
|
|
502
|
+
dev: {
|
|
503
|
+
builder: {
|
|
504
|
+
update: createPortalConfig(PortalConfigKey.BuilderUpdateDev, [
|
|
505
|
+
dev.builder.essential,
|
|
506
|
+
dev.builder.professional,
|
|
507
|
+
]),
|
|
508
|
+
upgrade: createPortalConfig(PortalConfigKey.BuilderUpgradeDev, [
|
|
509
|
+
dev.builder.professional,
|
|
510
|
+
]),
|
|
511
|
+
},
|
|
512
|
+
cli: {
|
|
513
|
+
update: createPortalConfig(PortalConfigKey.CLIUpdateDev, [
|
|
514
|
+
dev.cli.founder,
|
|
515
|
+
dev.cli.performance,
|
|
516
|
+
dev.cli.scale,
|
|
517
|
+
]),
|
|
518
|
+
upgrade: createPortalConfig(PortalConfigKey.CLIUpgradeDev, [
|
|
519
|
+
dev.cli.performance,
|
|
520
|
+
dev.cli.scale,
|
|
521
|
+
]),
|
|
522
|
+
},
|
|
523
|
+
},
|
|
524
|
+
prod: {
|
|
525
|
+
builder: {
|
|
526
|
+
update: createPortalConfig(PortalConfigKey.BuilderUpdateProd, [
|
|
527
|
+
prod.builder.essential,
|
|
528
|
+
prod.builder.professional,
|
|
529
|
+
]),
|
|
530
|
+
upgrade: createPortalConfig(PortalConfigKey.BuilderUpgradeProd, [
|
|
531
|
+
prod.builder.professional,
|
|
532
|
+
]),
|
|
533
|
+
},
|
|
534
|
+
cli: {
|
|
535
|
+
update: createPortalConfig(PortalConfigKey.CLIUpdateProd, [
|
|
536
|
+
prod.cli.founder,
|
|
537
|
+
prod.cli.performance,
|
|
538
|
+
prod.cli.scale,
|
|
539
|
+
]),
|
|
540
|
+
upgrade: createPortalConfig(PortalConfigKey.CLIUpgradeProd, [
|
|
541
|
+
prod.cli.performance,
|
|
542
|
+
prod.cli.scale,
|
|
543
|
+
]),
|
|
544
|
+
},
|
|
545
|
+
},
|
|
546
|
+
};
|
|
547
|
+
// --- utilities ---
|
|
548
|
+
export const hasActiveSub = (sub) => {
|
|
549
|
+
return !!(sub && (sub.status === 'active' || sub.status === 'trialing'));
|
|
550
|
+
};
|
|
551
|
+
export const hasPlan = (plan, sub) => {
|
|
552
|
+
if (!sub || !hasActiveSub(sub))
|
|
553
|
+
return false;
|
|
554
|
+
const plans = [basicPlan, legacyProPlan, proPlan, scalePlan];
|
|
555
|
+
// find the plans that are eligible to be tested
|
|
556
|
+
const eligiblePlans = plans.filter((eligiblePlan) => {
|
|
557
|
+
return plan.eligiblePlanTiers.includes(eligiblePlan.tier);
|
|
558
|
+
});
|
|
559
|
+
// test if any of those plans contains the current subscription
|
|
560
|
+
for (const eligiblePlan of eligiblePlans) {
|
|
561
|
+
const allProducts = [
|
|
562
|
+
...eligiblePlan.products.dev,
|
|
563
|
+
...eligiblePlan.products.prod,
|
|
564
|
+
];
|
|
565
|
+
for (const { id, prices } of allProducts) {
|
|
566
|
+
if ((sub === null || sub === void 0 ? void 0 : sub.productId) && (sub === null || sub === void 0 ? void 0 : sub.productId) === id) {
|
|
567
|
+
return true;
|
|
568
|
+
}
|
|
569
|
+
if (Object.values(prices).some((price) => price.id === (sub === null || sub === void 0 ? void 0 : sub.planId))) {
|
|
570
|
+
return true;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
return false;
|
|
575
|
+
};
|
|
576
|
+
export const getPlan = (sub) => {
|
|
577
|
+
const plans = [basicPlan, legacyProPlan, proPlan, scalePlan];
|
|
578
|
+
for (const plan of plans) {
|
|
579
|
+
const allProducts = [...plan.products.dev, ...plan.products.prod];
|
|
580
|
+
for (const { id, prices } of allProducts) {
|
|
581
|
+
if ((sub === null || sub === void 0 ? void 0 : sub.productId) && (sub === null || sub === void 0 ? void 0 : sub.productId) === id) {
|
|
582
|
+
return plan;
|
|
583
|
+
}
|
|
584
|
+
if (Object.values(prices).some((price) => price.id === (sub === null || sub === void 0 ? void 0 : sub.planId))) {
|
|
585
|
+
return plan;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
return null;
|
|
590
|
+
};
|
|
591
|
+
export const LegacyProductRecord = {
|
|
592
|
+
builder_essential: {
|
|
593
|
+
dev: dev.builder.essential,
|
|
594
|
+
prod: prod.builder.essential,
|
|
595
|
+
},
|
|
596
|
+
builder_professional: {
|
|
597
|
+
dev: dev.builder.professional,
|
|
598
|
+
prod: prod.builder.professional,
|
|
599
|
+
},
|
|
600
|
+
business: { dev: dev.legacy.business, prod: prod.legacy.business },
|
|
601
|
+
cli_founder: { dev: dev.cli.founder, prod: prod.cli.founder },
|
|
602
|
+
cli_founder_30: { dev: dev.cli.founder30, prod: prod.cli.founder30 },
|
|
603
|
+
cli_founder_50: { dev: dev.cli.founder50, prod: prod.cli.founder50 },
|
|
604
|
+
cli_performance: { dev: dev.cli.performance, prod: prod.cli.performance },
|
|
605
|
+
cli_scale: { dev: dev.cli.scale, prod: prod.cli.scale },
|
|
606
|
+
enterprise: { dev: dev.legacy.enterprise, prod: prod.legacy.enterprise },
|
|
607
|
+
essential: { dev: dev.legacy.essential, prod: prod.legacy.essential },
|
|
608
|
+
essential_new: {
|
|
609
|
+
dev: dev.legacy.essentialNew,
|
|
610
|
+
prod: prod.legacy.essentialNew,
|
|
611
|
+
},
|
|
612
|
+
growth: { dev: dev.legacy.growth, prod: prod.legacy.growth },
|
|
613
|
+
professional: {
|
|
614
|
+
dev: dev.legacy.professional,
|
|
615
|
+
prod: prod.legacy.professional,
|
|
616
|
+
},
|
|
617
|
+
professional_annual: {
|
|
618
|
+
dev: dev.legacy.professional,
|
|
619
|
+
prod: prod.legacy.professional,
|
|
620
|
+
},
|
|
621
|
+
professional_annual_full_price: {
|
|
622
|
+
dev: dev.legacy.professional,
|
|
623
|
+
prod: prod.legacy.professional,
|
|
624
|
+
},
|
|
625
|
+
startup: { dev: dev.legacy.startup, prod: prod.legacy.startup },
|
|
626
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
type AjvJSONSchemaType = object;
|
|
2
|
+
export interface DesktopAppPlugin {
|
|
3
|
+
/**
|
|
4
|
+
* Package name, including version information.
|
|
5
|
+
* e.g. "@todesktop/plugin-foo", "@todesktop/plugin-baz@1.0.0"
|
|
6
|
+
*/
|
|
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;
|
|
22
|
+
}
|
|
23
|
+
export type ToDesktopPlugin = {
|
|
24
|
+
main?: string;
|
|
25
|
+
namespace: string;
|
|
26
|
+
preferences?: PluginPreferences;
|
|
27
|
+
preload?: string;
|
|
28
|
+
version: number;
|
|
29
|
+
};
|
|
30
|
+
export type PluginPreferences = {
|
|
31
|
+
[id: string]: PluginPreference;
|
|
32
|
+
};
|
|
33
|
+
export type PluginPreference = CheckboxSpec | NumberSpec | TextSpec;
|
|
34
|
+
export type TextSpec = PreferenceSpec<'text', {
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
validator?: AjvJSONSchemaType;
|
|
37
|
+
value?: string;
|
|
38
|
+
}>;
|
|
39
|
+
export type NumberSpec = PreferenceSpec<'number', {
|
|
40
|
+
placeholder?: number;
|
|
41
|
+
validator?: AjvJSONSchemaType;
|
|
42
|
+
value?: number;
|
|
43
|
+
}>;
|
|
44
|
+
export type CheckboxSpec = PreferenceSpec<'checkbox', {
|
|
45
|
+
validator?: AjvJSONSchemaType;
|
|
46
|
+
value?: boolean;
|
|
47
|
+
}>;
|
|
48
|
+
interface PreferenceSpec<T, V> {
|
|
49
|
+
description: string;
|
|
50
|
+
name: string;
|
|
51
|
+
order?: number;
|
|
52
|
+
spec: V;
|
|
53
|
+
type: T;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|