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