@gitpod/gitpod-protocol 0.1.5-pd-timeout-16089.2 → 0.1.5-pd-timeout-16089.10

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.
@@ -27,6 +27,7 @@ import {
27
27
  UserSSHPublicKeyValue,
28
28
  SSHPublicKeyValue,
29
29
  IDESettings,
30
+ EnvVarWithValue,
30
31
  } from "./protocol";
31
32
  import {
32
33
  Team,
@@ -153,6 +154,9 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
153
154
  getUserStorageResource(options: GitpodServer.GetUserStorageResourceOptions): Promise<string>;
154
155
  updateUserStorageResource(options: GitpodServer.UpdateUserStorageResourceOptions): Promise<void>;
155
156
 
157
+ // Workspace env vars
158
+ getWorkspaceEnvVars(workspaceId: string): Promise<EnvVarWithValue[]>;
159
+
156
160
  // User env vars
157
161
  getEnvVars(): Promise<UserEnvVarValue[]>;
158
162
  getAllEnvVars(): Promise<UserEnvVarValue[]>;
@@ -305,11 +309,25 @@ export interface GitpodServer extends JsonRpcServer<GitpodClient>, AdminServer,
305
309
  /**
306
310
  * Frontend notifications
307
311
  */
308
- getNotifications(): Promise<string[]>;
312
+ getNotifications(): Promise<AppNotification[]>;
309
313
 
310
314
  getSupportedWorkspaceClasses(): Promise<SupportedWorkspaceClass[]>;
311
315
  }
312
316
 
317
+ export interface AppNotification {
318
+ message: string;
319
+ action?: {
320
+ url: string;
321
+ label: string;
322
+ };
323
+ notClosable?: boolean;
324
+ }
325
+ export namespace AppNotification {
326
+ export function is(data: any): data is AppNotification {
327
+ return data && typeof data === "object" && data.hasOwnProperty("message");
328
+ }
329
+ }
330
+
313
331
  export interface RateLimiterError {
314
332
  method?: string;
315
333
 
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?.companyName,
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
  }
@@ -257,6 +281,20 @@ export interface ProfileDetails {
257
281
  companyName?: string;
258
282
  // the user's email
259
283
  emailAddress?: string;
284
+ // the user's company website
285
+ companyWebsite?: string;
286
+ // type of role user has in their job
287
+ jobRole?: string;
288
+ // freeform entry for job role user works in (when jobRole is "other")
289
+ jobRoleOther?: string;
290
+ // Reasons user is exploring Gitpod when they signed up
291
+ explorationReasons?: string[];
292
+ // what user hopes to accomplish when they signed up
293
+ signupGoals?: string[];
294
+ // freeform entry for signup goals (when signupGoals is "other")
295
+ signupGoalsOther?: string;
296
+ // Set after a user completes the onboarding flow
297
+ onboardedTimestamp?: string;
260
298
  }
261
299
 
262
300
  export interface EmailNotificationSettings {
@@ -326,6 +364,8 @@ export namespace NamedWorkspaceFeatureFlag {
326
364
  }
327
365
  }
328
366
 
367
+ export type EnvVar = UserEnvVar | ProjectEnvVarWithValue | EnvVarWithValue;
368
+
329
369
  export interface EnvVarWithValue {
330
370
  name: string;
331
371
  value: string;