@todesktop/shared 7.188.64 → 7.188.66

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/lib/plans.js CHANGED
@@ -1,92 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PortalConfigKey = exports.getEnterprisePlanIds = exports.getProfessionalPlanIds = exports.getEssentialPlanIds = exports.getBuilderProfessionalPlanIds = exports.getBuilderEssentialPlanIds = exports.getBuilderPlanIds = exports.getCLIScalePlanIds = exports.getCLIPerformancePlanIds = exports.getCLIFounderPlanIds = exports.getCLIPlanIds = exports.getPlanEnvironment = exports.prodPlanIds = exports.devPlanIds = void 0;
4
- function pick(objectInput, ...keys) {
5
- const objectOutput = {};
6
- keys.forEach((key) => {
7
- objectOutput[key] = objectInput[key];
8
- });
9
- return objectOutput;
10
- }
11
- exports.devPlanIds = {
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
- };
28
- exports.prodPlanIds = {
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
- };
46
- exports.getPlanEnvironment = (stage) => stage === 'prod' ? exports.prodPlanIds : exports.devPlanIds;
47
- /* ToDesktop CLI Plans */
48
- exports.getCLIPlanIds = (stage) => {
49
- const planIds = exports.getPlanEnvironment(stage);
50
- return pick(planIds, 'cli_founder', 'cli_founder_30', 'cli_founder_50', 'cli_performance', 'cli_scale');
51
- };
52
- exports.getCLIFounderPlanIds = (stage) => {
53
- const planIds = exports.getPlanEnvironment(stage);
54
- return pick(planIds, 'cli_founder', 'cli_founder_30', 'cli_founder_50');
55
- };
56
- exports.getCLIPerformancePlanIds = (stage) => {
57
- const planIds = exports.getPlanEnvironment(stage);
58
- return pick(planIds, 'cli_performance');
59
- };
60
- exports.getCLIScalePlanIds = (stage) => {
61
- const planIds = exports.getPlanEnvironment(stage);
62
- return pick(planIds, 'cli_scale');
63
- };
64
- /* ToDesktop Builder Plans */
65
- exports.getBuilderPlanIds = (stage) => {
66
- const planIds = exports.getPlanEnvironment(stage);
67
- return pick(planIds, 'builder_essential', 'builder_professional');
68
- };
69
- exports.getBuilderEssentialPlanIds = (stage) => {
70
- const planIds = exports.getPlanEnvironment(stage);
71
- return pick(planIds, 'builder_essential');
72
- };
73
- exports.getBuilderProfessionalPlanIds = (stage) => {
74
- const planIds = exports.getPlanEnvironment(stage);
75
- return pick(planIds, 'builder_professional');
76
- };
77
- /* ToDesktop Web Plans */
78
- exports.getEssentialPlanIds = (stage) => {
79
- const planIds = exports.getPlanEnvironment(stage);
80
- return pick(planIds, 'startup', 'essential', 'essential_new');
81
- };
82
- exports.getProfessionalPlanIds = (stage) => {
83
- const planIds = exports.getPlanEnvironment(stage);
84
- return pick(planIds, 'business', 'growth', 'professional', 'professional_annual');
85
- };
86
- exports.getEnterprisePlanIds = (stage) => {
87
- const planIds = exports.getPlanEnvironment(stage);
88
- return pick(planIds, 'enterprise');
89
- };
3
+ exports.LegacyProductRecord = exports.getPlan = exports.hasPlan = exports.hasActiveSub = exports.configurations = exports.scalePlan = exports.proPlan = exports.legacyProPlan = exports.basicPlan = exports.products = exports.PortalConfigKey = void 0;
90
4
  var PortalConfigKey;
91
5
  (function (PortalConfigKey) {
92
6
  PortalConfigKey["CLIUpdateDev"] = "cli_update_dev";
@@ -97,4 +11,380 @@ var PortalConfigKey;
97
11
  PortalConfigKey["BuilderUpdateProd"] = "builder_update_prod";
98
12
  PortalConfigKey["BuilderUpgradeDev"] = "builder_upgrade_dev";
99
13
  PortalConfigKey["BuilderUpgradeProd"] = "builder_upgrade_prod";
100
- })(PortalConfigKey = exports.PortalConfigKey || (exports.PortalConfigKey = {}));
14
+ })(PortalConfigKey || (exports.PortalConfigKey = PortalConfigKey = {}));
15
+ // --- factory functions ---
16
+ const createPrice = (id, status) => {
17
+ return { id, status };
18
+ };
19
+ const createProduct = (id, prices) => ({ id, prices });
20
+ const createPlan = (tier, products) => {
21
+ const record = {
22
+ basic: { label: 'Basic', tiers: ['basic', 'legacy_pro', 'pro', 'scale'] },
23
+ legacy_pro: { label: 'Pro', tiers: ['legacy_pro', 'pro', 'scale'] },
24
+ pro: { label: 'Pro', tiers: ['pro', 'scale'] },
25
+ scale: { label: 'Scale', tiers: ['scale'] },
26
+ };
27
+ const { label, tiers } = record[tier];
28
+ return {
29
+ tier,
30
+ label,
31
+ eligiblePlanTiers: tiers,
32
+ products: { dev: products.dev, prod: products.prod },
33
+ };
34
+ };
35
+ const PORTAL_VERSION = 1; // increment this value to force Stripe to update the portal configurations
36
+ const createPortalConfig = (key, products) => {
37
+ return {
38
+ default_return_url: 'https://app.todesktop.com',
39
+ business_profile: {
40
+ headline: 'ToDesktop Billing Portal',
41
+ privacy_policy_url: 'https://www.todesktop.com/privacy-policy',
42
+ terms_of_service_url: 'https://www.todesktop.com/terms',
43
+ },
44
+ metadata: { key, version: PORTAL_VERSION },
45
+ features: {
46
+ payment_method_update: { enabled: true },
47
+ subscription_update: {
48
+ enabled: true,
49
+ default_allowed_updates: ['price'],
50
+ products: products.map((product) => {
51
+ return {
52
+ product: product.id,
53
+ prices: Object.values(product.prices)
54
+ .filter((price) => price.status === 'active')
55
+ .map((price) => price.id),
56
+ };
57
+ }),
58
+ },
59
+ },
60
+ };
61
+ };
62
+ // --- products ---
63
+ exports.products = {
64
+ dev: {
65
+ builder: {
66
+ essential: createProduct('prod_MoR1S4o0nLv00y', {
67
+ monthly_99: createPrice('price_1M4o9XIewCKA2h0IVfGrid8E', 'inactive'),
68
+ monthly_125: createPrice('price_1PuuAqIewCKA2h0Iw4judQNj', 'active'),
69
+ yearly_1200: createPrice('price_1PuvdgIewCKA2h0IisTKqjFN', 'active'),
70
+ }),
71
+ professional: createProduct('prod_MoR1SchsRDAIgY', {
72
+ monthly_199: createPrice('price_1M4o9vIewCKA2h0IHREokdD8', 'inactive'),
73
+ monthly_240: createPrice('price_1M4o9vIewCKA2h0IHREokdD8', 'inactive'),
74
+ monthly_300: createPrice('price_1PuuHrIewCKA2h0IQfEZ4Wog', 'active'),
75
+ yearly_2880: createPrice('price_1PuuJAIewCKA2h0IibpUIhf9', 'active'),
76
+ }),
77
+ },
78
+ cli: {
79
+ founder30: createProduct('prod_GsL6LaRo4NFD5n', {
80
+ monthly_30: createPrice('plan_GsL7NZskOY0TC9', 'active'),
81
+ }),
82
+ founder50: createProduct('prod_GsL5O1PdbxOrxJ', {
83
+ monthly_50: createPrice('plan_GsL6VYAshfh7c4', 'active'),
84
+ monthly_90: createPrice('plan_GsL6VYAshfh7c4', 'inactive'),
85
+ }),
86
+ founder: createProduct('prod_Gq0E8nbTYHtkPl', {
87
+ monthly_100: createPrice('plan_Gq0FzdmoTJshQL', 'inactive'),
88
+ monthly_125: createPrice('price_1PuuMRIewCKA2h0IrggfwCwA', 'active'),
89
+ yearly_1200: createPrice('price_1PuuMkIewCKA2h0IRxhkDpmk', 'active'),
90
+ }),
91
+ performance: createProduct('prod_LphQku6BNkzCga', {
92
+ monthly_300: createPrice('price_1L821UIewCKA2h0IUwRhicyo', 'inactive'),
93
+ monthly_375: createPrice('price_1PuuO7IewCKA2h0IOK9ivzS0', 'active'),
94
+ yearly_3600: createPrice('price_1PuuOKIewCKA2h0IrcVvJkgG', 'active'),
95
+ }),
96
+ scale: createProduct('prod_LphQxNgfUIxVfA', {
97
+ monthly_1200: createPrice('price_1L821wIewCKA2h0IMLUmjulL', 'inactive'),
98
+ monthly_1500: createPrice('price_1PuuPFIewCKA2h0IbPmKdsJr', 'active'),
99
+ yearly_14400: createPrice('price_1PuuPaIewCKA2h0IhLfSlRFj', 'active'),
100
+ }),
101
+ },
102
+ legacy: {
103
+ essential: createProduct('prod_FplN7CkqFRH0ye', {
104
+ monthly_58: createPrice('plan_FpljxNuZtNFFbm', 'active'),
105
+ }),
106
+ essentialNew: createProduct('prod_GYXm5X66hM1Ywj', {
107
+ monthly_58: createPrice('plan_GYXmTA3EdfCv4q', 'active'),
108
+ yearly_580: createPrice('plan_GYXmTA3EdfCv4q', 'active'),
109
+ }),
110
+ professional: createProduct('prod_GYXo54YK5kga12', {
111
+ monthly_199: createPrice('plan_GYXoIkvwVKyfF2', 'active'),
112
+ yearly_1990: createPrice('price_1KHU70IewCKA2h0IR87yXOQ2', 'inactive'),
113
+ yearly_2388: createPrice('price_1KHU70IewCKA2h0IR87yXOQ2', 'active'),
114
+ }),
115
+ startup: createProduct('prod_Fe8BTslXbdylxV', {
116
+ monthly_49: createPrice('plan_Fe8BzLp7k71eGD', 'active'),
117
+ yearly_200: createPrice('plan_Fe8BzLp7k71eGD', 'active'),
118
+ }),
119
+ growth: createProduct('prod_FplOSDbBmxba94', {
120
+ monthly_199: createPrice('plan_FplOshrr1w3Mvu', 'active'),
121
+ }),
122
+ business: createProduct('prod_Fe8CbCE2wGJIWr', {
123
+ monthly_199: createPrice('plan_Fe8CUkZfXasFtB', 'active'),
124
+ }),
125
+ enterprise: createProduct('prod_Hc9PMnHUmHvOlw', {
126
+ monthly_700: createPrice('price_1H2v6JIewCKA2h0IgUwsuctb', 'active'),
127
+ }),
128
+ },
129
+ },
130
+ prod: {
131
+ builder: {
132
+ essential: createProduct('prod_MoR2Ldm5PJpJZJ', {
133
+ monthly_99: createPrice('price_1M4oA4IewCKA2h0IWgfbSJBe', 'inactive'),
134
+ monthly_125: createPrice('price_1PuuU1IewCKA2h0IUSAcuUUb', 'active'),
135
+ yearly_1200: createPrice('price_1PuuUZIewCKA2h0IDMNwNqQl', 'active'),
136
+ }),
137
+ professional: createProduct('prod_MoR2h0Nf16hhgb', {
138
+ monthly_199: createPrice('price_1M4oABIewCKA2h0INkbaCbIS', 'inactive'),
139
+ monthly_240: createPrice('price_1MIDxtIewCKA2h0IvWi5weJL', 'inactive'),
140
+ monthly_300: createPrice('price_1PuuVSIewCKA2h0IETsLUwF9', 'active'),
141
+ yearly_2880: createPrice('price_1PuuVmIewCKA2h0I37dMpqI5', 'active'),
142
+ }),
143
+ },
144
+ cli: {
145
+ founder30: createProduct('prod_GrHtZKuUDvLZOF', {
146
+ monthly_30: createPrice('plan_GrHuyGjzYN0XN2', 'active'),
147
+ }),
148
+ founder50: createProduct('prod_GsL0ntimYpTTwD', {
149
+ monthly_50: createPrice('plan_GsL1IRUwpj5CIF', 'active'),
150
+ monthly_90: createPrice('price_1JMHNnIewCKA2h0II5RGjVtk', 'inactive'),
151
+ }),
152
+ founder: createProduct('prod_GpzVRVsBgluoef', {
153
+ monthly_100: createPrice('plan_GpzWZLfsOzjrvI', 'inactive'),
154
+ monthly_125: createPrice('price_1PuuXFIewCKA2h0IVHSyfFsd', 'active'),
155
+ yearly_1200: createPrice('price_1PuuXYIewCKA2h0IAsygBajd', 'active'),
156
+ }),
157
+ performance: createProduct('prod_LphRn5Rfuq3CMh', {
158
+ monthly_300: createPrice('price_1L822LIewCKA2h0I5JYyOG1p', 'inactive'),
159
+ monthly_375: createPrice('price_1PuuYKIewCKA2h0IWBJ4cyRQ', 'active'),
160
+ yearly_3600: createPrice('price_1PuuYcIewCKA2h0IzeU1xWbQ', 'active'),
161
+ }),
162
+ scale: createProduct('prod_LphRKSuMLjQriP', {
163
+ monthly_1200: createPrice('price_1L822RIewCKA2h0IPt9f2nZM', 'inactive'),
164
+ monthly_1500: createPrice('price_1PuuarIewCKA2h0IEONPcFU5', 'active'),
165
+ yearly_14400: createPrice('price_1Puub5IewCKA2h0IMJ3CQ58r', 'active'),
166
+ }),
167
+ },
168
+ legacy: {
169
+ essential: createProduct('prod_FohIP5aSMWWGyY', {
170
+ monthly_58: createPrice('plan_FohJzCujA6vvt4', 'active'),
171
+ }),
172
+ essentialNew: createProduct('prod_GYXn73zcoJKsF8', {
173
+ monthly_58: createPrice('plan_GYXn2cnPl5dy7j', 'active'),
174
+ yearly_580: createPrice('price_1Gqb24IewCKA2h0ILP5rxTnT', 'active'),
175
+ }),
176
+ professional: createProduct('prod_GYXouE5K7vuitU', {
177
+ monthly_199: createPrice('plan_GYXoKsa2j0yURg', 'active'),
178
+ yearly_1990: createPrice('price_1KHTgaIewCKA2h0I81TVg85r', 'inactive'),
179
+ yearly_2388: createPrice('price_1KLT32IewCKA2h0IFeJOAgG5', 'active'),
180
+ }),
181
+ startup: createProduct('prod_FdmCGcrX2IETUH', {
182
+ monthly_49: createPrice('plan_FdmDAUN7JGD8pR', 'active'),
183
+ yearly_200: createPrice('plan_Ft8qvk401twwrW', 'active'),
184
+ }),
185
+ growth: createProduct('prod_FohKfjLOlJNm1W', {
186
+ monthly_199: createPrice('plan_FohKGuWis5ocsi', 'active'),
187
+ }),
188
+ business: createProduct('prod_FdmEvAgT7ZtVEw', {
189
+ monthly_199: createPrice('plan_FdmE8akq9ukxiY', 'active'),
190
+ }),
191
+ enterprise: createProduct('prod_GuGGWeMQ3SCuE9', {
192
+ monthly_700: createPrice('plan_GuGICX6nRtDthN', 'active'),
193
+ }),
194
+ },
195
+ },
196
+ };
197
+ const { dev, prod } = exports.products;
198
+ // --- plans ---
199
+ exports.basicPlan = createPlan('basic', {
200
+ dev: [
201
+ dev.builder.essential,
202
+ dev.cli.founder30,
203
+ dev.cli.founder50,
204
+ dev.cli.founder,
205
+ dev.legacy.essential,
206
+ dev.legacy.essentialNew,
207
+ dev.legacy.startup,
208
+ ],
209
+ prod: [
210
+ prod.builder.essential,
211
+ prod.cli.founder30,
212
+ prod.cli.founder50,
213
+ prod.cli.founder,
214
+ prod.legacy.essential,
215
+ prod.legacy.essentialNew,
216
+ prod.legacy.startup,
217
+ ],
218
+ });
219
+ exports.legacyProPlan = createPlan('legacy_pro', {
220
+ dev: [
221
+ dev.builder.professional,
222
+ dev.cli.founder,
223
+ dev.cli.founder30,
224
+ dev.cli.founder50,
225
+ dev.cli.performance,
226
+ dev.cli.scale,
227
+ dev.legacy.professional,
228
+ dev.legacy.growth,
229
+ dev.legacy.business,
230
+ ],
231
+ prod: [
232
+ prod.builder.professional,
233
+ prod.cli.founder,
234
+ prod.cli.founder30,
235
+ prod.cli.founder50,
236
+ prod.cli.performance,
237
+ prod.cli.scale,
238
+ prod.legacy.professional,
239
+ prod.legacy.growth,
240
+ prod.legacy.business,
241
+ ],
242
+ });
243
+ exports.proPlan = createPlan('pro', {
244
+ dev: [
245
+ dev.builder.professional,
246
+ dev.cli.performance,
247
+ dev.legacy.professional,
248
+ dev.legacy.growth,
249
+ dev.legacy.business,
250
+ ],
251
+ prod: [
252
+ prod.builder.professional,
253
+ prod.cli.performance,
254
+ prod.legacy.professional,
255
+ prod.legacy.growth,
256
+ prod.legacy.business,
257
+ ],
258
+ });
259
+ exports.scalePlan = createPlan('scale', {
260
+ dev: [dev.cli.scale, dev.legacy.enterprise],
261
+ prod: [prod.cli.scale, prod.legacy.enterprise],
262
+ });
263
+ // --- configurations ---
264
+ exports.configurations = {
265
+ dev: {
266
+ builder: {
267
+ update: createPortalConfig(PortalConfigKey.BuilderUpdateDev, [
268
+ dev.builder.essential,
269
+ dev.builder.professional,
270
+ ]),
271
+ upgrade: createPortalConfig(PortalConfigKey.BuilderUpgradeDev, [
272
+ dev.builder.professional,
273
+ ]),
274
+ },
275
+ cli: {
276
+ update: createPortalConfig(PortalConfigKey.CLIUpdateDev, [
277
+ dev.cli.founder,
278
+ dev.cli.performance,
279
+ dev.cli.scale,
280
+ ]),
281
+ upgrade: createPortalConfig(PortalConfigKey.CLIUpgradeDev, [
282
+ dev.cli.performance,
283
+ dev.cli.scale,
284
+ ]),
285
+ },
286
+ },
287
+ prod: {
288
+ builder: {
289
+ update: createPortalConfig(PortalConfigKey.BuilderUpdateProd, [
290
+ prod.builder.essential,
291
+ prod.builder.professional,
292
+ ]),
293
+ upgrade: createPortalConfig(PortalConfigKey.BuilderUpgradeProd, [
294
+ prod.builder.professional,
295
+ ]),
296
+ },
297
+ cli: {
298
+ update: createPortalConfig(PortalConfigKey.CLIUpdateProd, [
299
+ prod.cli.founder,
300
+ prod.cli.performance,
301
+ prod.cli.scale,
302
+ ]),
303
+ upgrade: createPortalConfig(PortalConfigKey.CLIUpgradeProd, [
304
+ prod.cli.performance,
305
+ prod.cli.scale,
306
+ ]),
307
+ },
308
+ },
309
+ };
310
+ // --- utilities ---
311
+ const hasActiveSub = (sub) => {
312
+ return sub && (sub.status === 'active' || sub.status === 'trialing')
313
+ ? true
314
+ : false;
315
+ };
316
+ exports.hasActiveSub = hasActiveSub;
317
+ const hasPlan = (plan, sub) => {
318
+ if (!sub || !(0, exports.hasActiveSub)(sub))
319
+ return false;
320
+ const plans = [exports.basicPlan, exports.legacyProPlan, exports.proPlan, exports.scalePlan];
321
+ // find the plans that are eligible to be tested
322
+ const eligiblePlans = plans.filter((eligiblePlan) => {
323
+ return plan.eligiblePlanTiers.includes(eligiblePlan.tier);
324
+ });
325
+ // test if any of those plans contains the current subscription
326
+ for (const { products } of eligiblePlans) {
327
+ for (const { id, prices } of [...products.dev, ...products.prod]) {
328
+ if ((sub === null || sub === void 0 ? void 0 : sub.productId) && (sub === null || sub === void 0 ? void 0 : sub.productId) === id) {
329
+ return true;
330
+ }
331
+ else if (Object.values(prices).some((price) => price.id === (sub === null || sub === void 0 ? void 0 : sub.planId))) {
332
+ return true;
333
+ }
334
+ }
335
+ }
336
+ return false;
337
+ };
338
+ exports.hasPlan = hasPlan;
339
+ const getPlan = (sub) => {
340
+ const plans = [exports.basicPlan, exports.legacyProPlan, exports.proPlan, exports.scalePlan];
341
+ for (const plan of plans) {
342
+ const { products } = plan;
343
+ for (const { id, prices } of [...products.dev, ...products.prod]) {
344
+ if ((sub === null || sub === void 0 ? void 0 : sub.productId) && (sub === null || sub === void 0 ? void 0 : sub.productId) === id) {
345
+ return plan;
346
+ }
347
+ else if (Object.values(prices).some((price) => price.id === (sub === null || sub === void 0 ? void 0 : sub.planId))) {
348
+ return plan;
349
+ }
350
+ }
351
+ }
352
+ return null;
353
+ };
354
+ exports.getPlan = getPlan;
355
+ exports.LegacyProductRecord = {
356
+ startup: { dev: dev.legacy.startup, prod: prod.legacy.startup },
357
+ business: { dev: dev.legacy.business, prod: prod.legacy.business },
358
+ essential: { dev: dev.legacy.essential, prod: prod.legacy.essential },
359
+ growth: { dev: dev.legacy.growth, prod: prod.legacy.growth },
360
+ essential_new: {
361
+ dev: dev.legacy.essentialNew,
362
+ prod: prod.legacy.essentialNew,
363
+ },
364
+ professional: {
365
+ dev: dev.legacy.professional,
366
+ prod: prod.legacy.professional,
367
+ },
368
+ professional_annual: {
369
+ dev: dev.legacy.professional,
370
+ prod: prod.legacy.professional,
371
+ },
372
+ professional_annual_full_price: {
373
+ dev: dev.legacy.professional,
374
+ prod: prod.legacy.professional,
375
+ },
376
+ cli_founder: { dev: dev.cli.founder, prod: prod.cli.founder },
377
+ cli_founder_30: { dev: dev.cli.founder30, prod: prod.cli.founder30 },
378
+ cli_founder_50: { dev: dev.cli.founder50, prod: prod.cli.founder50 },
379
+ cli_performance: { dev: dev.cli.performance, prod: prod.cli.performance },
380
+ cli_scale: { dev: dev.cli.scale, prod: prod.cli.scale },
381
+ builder_essential: {
382
+ dev: dev.builder.essential,
383
+ prod: prod.builder.essential,
384
+ },
385
+ builder_professional: {
386
+ dev: dev.builder.professional,
387
+ prod: prod.builder.professional,
388
+ },
389
+ enterprise: { dev: dev.legacy.enterprise, prod: prod.legacy.enterprise },
390
+ };
package/lib/plugin.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- declare type AjvJSONSchemaType = object;
1
+ type AjvJSONSchemaType = object;
2
2
  export interface DesktopAppPlugin {
3
3
  /**
4
4
  * Configuration gathered from the todesktop plugin.
@@ -11,28 +11,28 @@ export interface DesktopAppPlugin {
11
11
  */
12
12
  package: string;
13
13
  }
14
- export declare type ToDesktopPlugin = {
14
+ export type ToDesktopPlugin = {
15
15
  namespace: string;
16
16
  version: number;
17
17
  main?: string;
18
18
  preload?: string;
19
19
  preferences?: PluginPreferences;
20
20
  };
21
- export declare type PluginPreferences = {
21
+ export type PluginPreferences = {
22
22
  [id: string]: PluginPreference;
23
23
  };
24
- export declare type PluginPreference = NumberSpec | TextSpec | CheckboxSpec;
25
- export declare type TextSpec = PreferenceSpec<'text', {
24
+ export type PluginPreference = NumberSpec | TextSpec | CheckboxSpec;
25
+ export type TextSpec = PreferenceSpec<'text', {
26
26
  validator?: AjvJSONSchemaType;
27
27
  value?: string;
28
28
  placeholder?: string;
29
29
  }>;
30
- export declare type NumberSpec = PreferenceSpec<'number', {
30
+ export type NumberSpec = PreferenceSpec<'number', {
31
31
  validator?: AjvJSONSchemaType;
32
32
  value?: number;
33
33
  placeholder?: number;
34
34
  }>;
35
- export declare type CheckboxSpec = PreferenceSpec<'checkbox', {
35
+ export type CheckboxSpec = PreferenceSpec<'checkbox', {
36
36
  validator?: AjvJSONSchemaType;
37
37
  value?: boolean;
38
38
  }>;
@@ -1,6 +1,6 @@
1
1
  import { BaseApp, Schemable } from './base';
2
2
  import { IAppBuilderLib } from './desktopify';
3
- export declare type IUploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed';
3
+ export type IUploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed';
4
4
  export interface IUploadFile {
5
5
  uid: string;
6
6
  size: number;
@@ -25,7 +25,7 @@ export interface IAppIcon {
25
25
  appId: string;
26
26
  icon: IHueIcon;
27
27
  }
28
- export declare type IAppIcons = IAppIcon[];
28
+ export type IAppIcons = IAppIcon[];
29
29
  export interface IAppWindowOptions {
30
30
  startInFullscreenMode: boolean;
31
31
  isResizable: boolean;
@@ -1,2 +1,2 @@
1
- export declare type ValidTranslationKeys = 'updateNotification.title' | 'updateNotification.body';
2
- export declare type ValidTranslationLanguages = 'default';
1
+ export type ValidTranslationKeys = 'updateNotification.title' | 'updateNotification.body';
2
+ export type ValidTranslationLanguages = 'default';
@@ -5,9 +5,9 @@ export declare const appTitleValidation: yup.StringSchema;
5
5
  export declare const forceVersionValidation: yup.StringSchema;
6
6
  export declare const iconValidation: yup.StringSchema;
7
7
  export declare const urlValidation: yup.StringSchema;
8
- export declare const urlValidationForm: yup.ObjectSchema<yup.Shape<object, {
8
+ export declare const urlValidationForm: yup.ObjectSchema<{
9
9
  url: string;
10
- }>>;
10
+ }>;
11
11
  export declare const heightValidation: yup.NumberSchema;
12
12
  export declare const widthValidation: yup.NumberSchema;
13
13
  export declare const internalAppRegexValidation: yup.StringSchema;
@@ -51,4 +51,4 @@ export declare const appConfigValidation: yup.ObjectSchema<{
51
51
  publishedVersions: any;
52
52
  };
53
53
  }>;
54
- export declare const shouldMinimizeToTrayIsActive: <Plugin_1 = DesktopAppPlugin>(desktopApp: DesktopifyApp2<Plugin_1>) => boolean;
54
+ export declare const shouldMinimizeToTrayIsActive: <Plugin = DesktopAppPlugin>(desktopApp: DesktopifyApp2<Plugin>) => boolean;
@@ -133,6 +133,7 @@ exports.appConfigValidation = yup.object({
133
133
  })
134
134
  .required(),
135
135
  });
136
- exports.shouldMinimizeToTrayIsActive = (desktopApp) => {
136
+ const shouldMinimizeToTrayIsActive = (desktopApp) => {
137
137
  return desktopApp.trays.some((t) => t.leftClick.role === 'toggleMenu' || t.rightClick.role === 'toggleMenu');
138
138
  };
139
+ exports.shouldMinimizeToTrayIsActive = shouldMinimizeToTrayIsActive;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todesktop/shared",
3
- "version": "7.188.64",
3
+ "version": "7.188.66",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -26,14 +26,17 @@
26
26
  "yup": "^0.26.10"
27
27
  },
28
28
  "devDependencies": {
29
+ "@eslint/eslintrc": "^3.1.0",
30
+ "@eslint/js": "^9.9.1",
29
31
  "@types/semver": "^7.3.9",
30
- "@typescript-eslint/eslint-plugin": "^5.60.1",
31
- "@typescript-eslint/parser": "^5.60.1",
32
+ "@typescript-eslint/eslint-plugin": "^8.4.0",
33
+ "@typescript-eslint/parser": "^8.4.0",
32
34
  "app-builder-lib": "^22.10.4",
33
- "eslint": "^8.43.0",
35
+ "eslint": "^9.9.1",
34
36
  "eslint-config-prettier": "^8.8.0",
35
37
  "eslint-plugin-prettier": "^4.2.1",
38
+ "globals": "^15.9.0",
36
39
  "prettier": "^2.8.8",
37
- "typescript": "^3.9.10"
40
+ "typescript": "^5.5.4"
38
41
  }
39
42
  }
package/src/base.ts CHANGED
@@ -268,16 +268,13 @@ export interface BaseApp extends Schemable {
268
268
  // this property is dynamically resolved at queueBuild in cloud functions
269
269
  parentApp?: BaseApp;
270
270
  parent?: { id: string; relationshipToParent: string } | null;
271
- subscription?: {
272
- status: string;
273
- subscriptionId: string;
274
- itemId: string;
275
- planId: string;
276
- };
271
+ subscription?: Subscription;
277
272
 
278
273
  // artifacts
279
274
  shouldCreate32BitWindowsArtifacts?: boolean;
280
275
  shouldCreateAppImages?: boolean;
276
+
277
+ shouldCreateAppleIntelArtifacts?: boolean;
281
278
  shouldCreateAppleSiliconAssets?: boolean;
282
279
  shouldCreateAppXFiles?: boolean;
283
280
  shouldCreateArm64LinuxArtifacts?: boolean;
@@ -302,3 +299,14 @@ export interface BaseApp extends Schemable {
302
299
  shouldPinToVersion?: boolean;
303
300
  };
304
301
  }
302
+
303
+ export type Subscription = {
304
+ status: string;
305
+ subscriptionId: string;
306
+ itemId: string;
307
+ planId: string;
308
+
309
+ // todo: remove optional qualifier once we complete migration
310
+ productId?: string;
311
+ priceId?: string;
312
+ };