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