@gitpod/gitpod-protocol 0.1.5-mp-remove-slow-server-proxy.0 → 0.1.5-mp-server-errors.4

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.
@@ -103,4 +103,8 @@ export namespace ErrorCodes {
103
103
 
104
104
  // 650 Invalid Value
105
105
  export const INVALID_VALUE = 650;
106
+
107
+ export function isUserError(code: number): boolean {
108
+ return code >= 400 && code < 500;
109
+ }
106
110
  }
package/src/plans.ts CHANGED
@@ -490,6 +490,22 @@ export namespace Plans {
490
490
  return chargebeeId === Plans.FREE_OPEN_SOURCE.chargebeeId;
491
491
  }
492
492
 
493
+ export function isPersonalPlan(planId: string | undefined): boolean {
494
+ const plan = Plans.getById(planId);
495
+ if (!plan) {
496
+ return false;
497
+ }
498
+ return !plan.team;
499
+ }
500
+
501
+ export function isTeamPlan(planId: string | undefined): boolean {
502
+ const plan = Plans.getById(planId);
503
+ if (!plan) {
504
+ return false;
505
+ }
506
+ return !!plan.team;
507
+ }
508
+
493
509
  export function getHoursPerMonth(plan: Plan): number {
494
510
  return plan.hoursPerMonth == "unlimited" ? ABSOLUTE_MAX_USAGE : plan.hoursPerMonth;
495
511
  }
package/src/protocol.ts CHANGED
@@ -153,12 +153,21 @@ export namespace User {
153
153
  user.additionalData.ideSettings = newIDESettings;
154
154
  }
155
155
 
156
+ // TODO: make it more explicit that these field names are relied for our tracking purposes
157
+ // and decouple frontend from relying on them - instead use user.additionalData.profile object directly in FE
156
158
  export function getProfile(user: User): Profile {
157
159
  return {
158
160
  name: User.getName(user!) || "",
159
161
  email: User.getPrimaryEmail(user!) || "",
160
162
  company: user?.additionalData?.profile?.companyName,
161
163
  avatarURL: user?.avatarUrl,
164
+ companyWebsite: user?.additionalData?.profile?.companyWebsite,
165
+ jobRole: user?.additionalData?.profile?.jobRole,
166
+ jobRoleOther: user?.additionalData?.profile?.jobRoleOther,
167
+ explorationReasons: user?.additionalData?.profile?.explorationReasons,
168
+ signupGoals: user?.additionalData?.profile?.signupGoals,
169
+ signupGoalsOther: user?.additionalData?.profile?.signupGoalsOther,
170
+ onboardedTimestamp: user?.additionalData?.profile?.onboardedTimestamp,
162
171
  };
163
172
  }
164
173
 
@@ -190,12 +199,21 @@ export namespace User {
190
199
  return AttributionId.create(user);
191
200
  }
192
201
 
202
+ // TODO: refactor where this is referenced so it's more clearly tied to just analytics-tracking
203
+ // Let other places rely on the ProfileDetails type since that's what we store
193
204
  // The actual Profile of a User
194
205
  export interface Profile {
195
206
  name: string;
196
207
  email: string;
197
208
  company?: string;
198
209
  avatarURL?: string;
210
+ companyWebsite?: string;
211
+ jobRole?: string;
212
+ jobRoleOther?: string;
213
+ explorationReasons?: string[];
214
+ signupGoals?: string[];
215
+ signupGoalsOther?: string;
216
+ onboardedTimestamp?: string;
199
217
  }
200
218
  export namespace Profile {
201
219
  export function hasChanges(before: Profile, after: Profile) {
@@ -203,7 +221,13 @@ export namespace User {
203
221
  before.name !== after.name ||
204
222
  before.email !== after.email ||
205
223
  before.company !== after.company ||
206
- before.avatarURL !== after.avatarURL
224
+ before.avatarURL !== after.avatarURL ||
225
+ before.companyWebsite !== after.companyWebsite ||
226
+ before.jobRole !== after.jobRole ||
227
+ before.jobRoleOther !== after.jobRoleOther ||
228
+ // not checking explorationReasons or signupGoals atm as it's an array - need to check deep equality
229
+ before.signupGoalsOther !== after.signupGoalsOther ||
230
+ before.onboardedTimestamp !== after.onboardedTimestamp
207
231
  );
208
232
  }
209
233
  }
@@ -254,6 +278,20 @@ export interface ProfileDetails {
254
278
  companyName?: string;
255
279
  // the user's email
256
280
  emailAddress?: string;
281
+ // the user's company website
282
+ companyWebsite?: string;
283
+ // type of role user has in their job
284
+ jobRole?: string;
285
+ // freeform entry for job role user works in (when jobRole is "other")
286
+ jobRoleOther?: string;
287
+ // Reasons user is exploring Gitpod when they signed up
288
+ explorationReasons?: string[];
289
+ // what user hopes to accomplish when they signed up
290
+ signupGoals?: string[];
291
+ // freeform entry for signup goals (when signupGoals is "other")
292
+ signupGoalsOther?: string;
293
+ // Set after a user completes the onboarding flow
294
+ onboardedTimestamp?: string;
257
295
  }
258
296
 
259
297
  export interface EmailNotificationSettings {
@@ -323,6 +361,8 @@ export namespace NamedWorkspaceFeatureFlag {
323
361
  }
324
362
  }
325
363
 
364
+ export type EnvVar = UserEnvVar | ProjectEnvVarWithValue | EnvVarWithValue;
365
+
326
366
  export interface EnvVarWithValue {
327
367
  name: string;
328
368
  value: string;
@@ -1417,6 +1457,7 @@ export interface AuthProviderInfo {
1417
1457
  readonly authProviderType: string;
1418
1458
  readonly host: string;
1419
1459
  readonly ownerId?: string;
1460
+ readonly organizationId?: string;
1420
1461
  readonly verified: boolean;
1421
1462
  readonly isReadonly?: boolean;
1422
1463
  readonly hiddenOnDashboard?: boolean;