@gitpod/gitpod-protocol 0.1.5-wth-argo.0 → 0.1.5-yh-vmoptions-fork.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.
- package/data/gitpod-schema.json +206 -28
- package/lib/accounting-protocol.d.ts +162 -0
- package/lib/accounting-protocol.d.ts.map +1 -0
- package/lib/accounting-protocol.js +107 -0
- package/lib/accounting-protocol.js.map +1 -0
- package/lib/admin-protocol.d.ts +32 -4
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js +15 -0
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +44 -0
- package/lib/analytics.d.ts.map +1 -0
- package/lib/analytics.js +10 -0
- package/lib/analytics.js.map +1 -0
- package/lib/auth.d.ts.map +1 -1
- package/lib/context-url.d.ts +31 -0
- package/lib/context-url.d.ts.map +1 -0
- package/lib/context-url.js +102 -0
- package/lib/context-url.js.map +1 -0
- package/lib/context-url.spec.d.ts +14 -0
- package/lib/context-url.spec.d.ts.map +1 -0
- package/lib/context-url.spec.js +109 -0
- package/lib/context-url.spec.js.map +1 -0
- package/lib/email-protocol.d.ts +1 -2
- package/lib/email-protocol.d.ts.map +1 -1
- package/lib/email-protocol.js +4 -4
- package/lib/email-protocol.js.map +1 -1
- package/lib/encryption/container-module.d.ts.map +1 -1
- package/lib/encryption/container-module.js +5 -4
- package/lib/encryption/container-module.js.map +1 -1
- package/lib/encryption/encryption-engine.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.js +25 -26
- package/lib/encryption/encryption-engine.js.map +1 -1
- package/lib/encryption/encryption-engine.spec.d.ts.map +1 -1
- package/lib/encryption/encryption-engine.spec.js +29 -37
- package/lib/encryption/encryption-engine.spec.js.map +1 -1
- package/lib/encryption/encryption-service.d.ts.map +1 -1
- package/lib/encryption/encryption-service.js +30 -44
- package/lib/encryption/encryption-service.js.map +1 -1
- package/lib/encryption/key-provider.d.ts.map +1 -1
- package/lib/encryption/key-provider.js +31 -38
- package/lib/encryption/key-provider.js.map +1 -1
- package/lib/env.d.ts +0 -6
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +7 -27
- package/lib/env.js.map +1 -1
- package/lib/gitpod-file-parser.d.ts.map +1 -1
- package/lib/gitpod-file-parser.js +26 -42
- package/lib/gitpod-file-parser.js.map +1 -1
- package/lib/gitpod-file-parser.spec.js +145 -142
- package/lib/gitpod-file-parser.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +180 -33
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js +194 -273
- package/lib/gitpod-service.js.map +1 -1
- package/lib/headless-workspace-log.d.ts +9 -11
- package/lib/headless-workspace-log.d.ts.map +1 -1
- package/lib/headless-workspace-log.js +6 -8
- package/lib/headless-workspace-log.js.map +1 -1
- package/lib/ide-frontend-service.d.ts +5 -1
- package/lib/ide-frontend-service.d.ts.map +1 -1
- package/lib/ide-protocol.d.ts +105 -0
- package/lib/ide-protocol.d.ts.map +1 -0
- package/lib/{util/without.js → ide-protocol.js} +2 -2
- package/lib/ide-protocol.js.map +1 -0
- package/lib/index.d.ts +16 -10
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -1
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +27 -0
- package/lib/installation-admin-protocol.d.ts.map +1 -0
- package/lib/installation-admin-protocol.js +30 -0
- package/lib/installation-admin-protocol.js.map +1 -0
- package/lib/license-protocol.d.ts +7 -0
- package/lib/license-protocol.d.ts.map +1 -1
- package/lib/license-protocol.js.map +1 -1
- package/lib/messaging/browser/connection.d.ts +5 -3
- package/lib/messaging/browser/connection.d.ts.map +1 -1
- package/lib/messaging/browser/connection.js +184 -34
- package/lib/messaging/browser/connection.js.map +1 -1
- package/lib/messaging/browser/window-connection.d.ts +4 -4
- package/lib/messaging/browser/window-connection.d.ts.map +1 -1
- package/lib/messaging/browser/window-connection.js +42 -59
- package/lib/messaging/browser/window-connection.js.map +1 -1
- package/lib/messaging/client-call-metrics.d.ts +35 -0
- package/lib/messaging/client-call-metrics.d.ts.map +1 -0
- package/lib/messaging/client-call-metrics.js +83 -0
- package/lib/messaging/client-call-metrics.js.map +1 -0
- package/lib/messaging/error.d.ts +6 -1
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +12 -2
- package/lib/messaging/error.js.map +1 -1
- package/lib/messaging/handler.d.ts +10 -0
- package/lib/messaging/handler.d.ts.map +1 -1
- package/lib/messaging/handler.js +1 -1
- package/lib/messaging/node/connection.d.ts +1 -17
- package/lib/messaging/node/connection.d.ts.map +1 -1
- package/lib/messaging/node/connection.js +24 -60
- package/lib/messaging/node/connection.js.map +1 -1
- package/lib/messaging/proxy-factory.d.ts +3 -1
- package/lib/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/messaging/proxy-factory.js +75 -162
- package/lib/messaging/proxy-factory.js.map +1 -1
- package/lib/oss-allowlist.d.ts +14 -0
- package/lib/oss-allowlist.d.ts.map +1 -0
- package/lib/oss-allowlist.js +8 -0
- package/lib/oss-allowlist.js.map +1 -0
- package/lib/payment-protocol.d.ts +18 -0
- package/lib/payment-protocol.d.ts.map +1 -0
- package/lib/payment-protocol.js +13 -0
- package/lib/payment-protocol.js.map +1 -0
- package/lib/permission.d.ts +10 -3
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +41 -31
- package/lib/permission.js.map +1 -1
- package/lib/plans.d.ts +210 -0
- package/lib/plans.d.ts.map +1 -0
- package/lib/plans.js +605 -0
- package/lib/plans.js.map +1 -0
- package/lib/protocol.d.ts +196 -83
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +264 -200
- package/lib/protocol.js.map +1 -1
- package/lib/snapshot-url.d.ts +14 -0
- package/lib/snapshot-url.d.ts.map +1 -0
- package/lib/snapshot-url.js +26 -0
- package/lib/snapshot-url.js.map +1 -0
- package/{src/util/without.ts → lib/snapshot-url.spec.d.ts} +2 -3
- package/lib/snapshot-url.spec.d.ts.map +1 -0
- package/lib/snapshot-url.spec.js +41 -0
- package/lib/snapshot-url.spec.js.map +1 -0
- package/lib/team-subscription-protocol.d.ts +91 -0
- package/lib/team-subscription-protocol.d.ts.map +1 -0
- package/lib/team-subscription-protocol.js +74 -0
- package/lib/team-subscription-protocol.js.map +1 -0
- package/lib/teams-projects-protocol.d.ts +118 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -0
- package/lib/teams-projects-protocol.js +30 -0
- package/lib/teams-projects-protocol.js.map +1 -0
- package/lib/typings/globals.d.ts +2 -2
- package/lib/typings/globals.d.ts.map +1 -1
- package/lib/util/analytics.d.ts +8 -0
- package/lib/util/analytics.d.ts.map +1 -0
- package/lib/util/analytics.js +88 -0
- package/lib/util/analytics.js.map +1 -0
- package/lib/util/async-iterator.d.ts.map +1 -1
- package/lib/util/async-iterator.js +57 -135
- package/lib/util/async-iterator.js.map +1 -1
- package/lib/util/cancelable.js +17 -59
- package/lib/util/cancelable.js.map +1 -1
- package/lib/util/date-time.js +11 -11
- package/lib/util/date-time.js.map +1 -1
- package/lib/util/deferred.js +10 -12
- package/lib/util/deferred.js.map +1 -1
- package/lib/util/disposable.d.ts.map +1 -1
- package/lib/util/disposable.js +27 -40
- package/lib/util/disposable.js.map +1 -1
- package/lib/util/event.d.ts.map +1 -1
- package/lib/util/event.js +63 -77
- package/lib/util/event.js.map +1 -1
- package/lib/util/garbage-collected-cache.d.ts +1 -0
- package/lib/util/garbage-collected-cache.d.ts.map +1 -1
- package/lib/util/garbage-collected-cache.js +27 -47
- package/lib/util/garbage-collected-cache.js.map +1 -1
- package/lib/util/generate-workspace-id.d.ts +6 -1
- package/lib/util/generate-workspace-id.d.ts.map +1 -1
- package/lib/util/generate-workspace-id.js +469 -502
- package/lib/util/generate-workspace-id.js.map +1 -1
- package/lib/util/generate-workspace-id.spec.js +68 -78
- package/lib/util/generate-workspace-id.spec.js.map +1 -1
- package/lib/util/gitpod-cookie.d.ts +20 -0
- package/lib/util/gitpod-cookie.d.ts.map +1 -0
- package/lib/util/gitpod-cookie.js +41 -0
- package/lib/util/gitpod-cookie.js.map +1 -0
- package/lib/util/gitpod-host-url.d.ts +1 -2
- package/lib/util/gitpod-host-url.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.js +108 -109
- package/lib/util/gitpod-host-url.js.map +1 -1
- package/lib/util/gitpod-host-url.spec.d.ts +7 -1
- package/lib/util/gitpod-host-url.spec.d.ts.map +1 -1
- package/lib/util/gitpod-host-url.spec.js +113 -31
- package/lib/util/gitpod-host-url.spec.js.map +1 -1
- package/lib/util/grpc.d.ts +15 -0
- package/lib/util/grpc.d.ts.map +1 -0
- package/lib/util/grpc.js +18 -0
- package/lib/util/grpc.js.map +1 -0
- package/lib/util/jaeger-client-types.d.ts +68 -0
- package/lib/util/jaeger-client-types.d.ts.map +1 -0
- package/lib/{theia-plugins.js → util/jaeger-client-types.js} +1 -1
- package/lib/util/jaeger-client-types.js.map +1 -0
- package/lib/util/logging.d.ts +49 -33
- package/lib/util/logging.d.ts.map +1 -1
- package/lib/util/logging.js +125 -129
- package/lib/util/logging.js.map +1 -1
- package/lib/util/make-link.js +5 -5
- package/lib/util/make-link.js.map +1 -1
- package/lib/util/parse-workspace-id.d.ts +10 -0
- package/lib/util/parse-workspace-id.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.js +31 -7
- package/lib/util/parse-workspace-id.js.map +1 -1
- package/lib/util/parse-workspace-id.spec.d.ts +4 -0
- package/lib/util/parse-workspace-id.spec.d.ts.map +1 -1
- package/lib/util/parse-workspace-id.spec.js +123 -84
- package/lib/util/parse-workspace-id.spec.js.map +1 -1
- package/lib/util/queue.js +16 -55
- package/lib/util/queue.js.map +1 -1
- package/lib/util/queue.spec.js +147 -288
- package/lib/util/queue.spec.js.map +1 -1
- package/lib/util/repeat.d.ts +15 -0
- package/lib/util/repeat.d.ts.map +1 -0
- package/lib/util/repeat.js +55 -0
- package/lib/util/repeat.js.map +1 -0
- package/lib/util/semaphore.d.ts.map +1 -1
- package/lib/util/semaphore.js +15 -46
- package/lib/util/semaphore.js.map +1 -1
- package/lib/util/skip-if.d.ts.map +1 -1
- package/lib/util/skip-if.js +6 -6
- package/lib/util/skip-if.js.map +1 -1
- package/lib/util/timeutil.d.ts +1 -0
- package/lib/util/timeutil.d.ts.map +1 -1
- package/lib/util/timeutil.js +35 -17
- package/lib/util/timeutil.js.map +1 -1
- package/lib/util/timeutil.spec.d.ts.map +1 -1
- package/lib/util/timeutil.spec.js +21 -24
- package/lib/util/timeutil.spec.js.map +1 -1
- package/lib/util/tracing.d.ts +52 -6
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +197 -64
- package/lib/util/tracing.js.map +1 -1
- package/lib/util/tracing.spec.d.ts +7 -0
- package/lib/util/tracing.spec.d.ts.map +1 -0
- package/lib/util/tracing.spec.js +121 -0
- package/lib/util/tracing.spec.js.map +1 -0
- package/lib/util/workspace-port-authentication.d.ts +7 -7
- package/lib/util/workspace-port-authentication.d.ts.map +1 -1
- package/lib/util/workspace-port-authentication.js +10 -12
- package/lib/util/workspace-port-authentication.js.map +1 -1
- package/lib/workspace-cluster.d.ts +76 -0
- package/lib/workspace-cluster.d.ts.map +1 -0
- package/lib/workspace-cluster.js +31 -0
- package/lib/workspace-cluster.js.map +1 -0
- package/lib/workspace-instance.d.ts +45 -5
- package/lib/workspace-instance.d.ts.map +1 -1
- package/lib/wsready.d.ts +1 -1
- package/lib/wsready.d.ts.map +1 -1
- package/lib/wsready.js +2 -2
- package/package.json +32 -18
- package/pkg-yarn.lock +18 -10
- package/provenance-bundle.jsonl +2 -0
- package/src/accounting-protocol.ts +241 -0
- package/src/admin-protocol.ts +70 -19
- package/src/analytics.ts +52 -0
- package/src/auth.ts +2 -2
- package/src/context-url.spec.ts +67 -0
- package/src/context-url.ts +109 -0
- package/src/email-protocol.ts +5 -7
- package/src/encryption/container-module.ts +2 -3
- package/src/encryption/encryption-engine.spec.ts +9 -8
- package/src/encryption/encryption-engine.ts +14 -14
- package/src/encryption/encryption-service.ts +4 -5
- package/src/encryption/key-provider.ts +16 -19
- package/src/env.ts +0 -22
- package/src/gitpod-file-parser.spec.ts +55 -61
- package/src/gitpod-file-parser.ts +16 -17
- package/src/gitpod-service.ts +348 -110
- package/src/headless-workspace-log.ts +12 -14
- package/src/ide-frontend-service.ts +6 -2
- package/src/ide-protocol.ts +119 -0
- package/src/index.ts +16 -10
- package/src/installation-admin-protocol.ts +42 -0
- package/src/license-protocol.ts +12 -6
- package/src/messaging/browser/connection.ts +197 -18
- package/src/messaging/browser/window-connection.ts +39 -29
- package/src/messaging/client-call-metrics.ts +96 -0
- package/src/messaging/error.ts +18 -5
- package/src/messaging/handler.ts +13 -1
- package/src/messaging/node/connection.ts +23 -70
- package/src/messaging/proxy-factory.ts +35 -34
- package/src/oss-allowlist.ts +15 -0
- package/src/payment-protocol.ts +20 -0
- package/src/permission.ts +42 -33
- package/src/plans.ts +679 -0
- package/src/protocol.ts +493 -275
- package/src/snapshot-url.spec.ts +27 -0
- package/src/snapshot-url.ts +27 -0
- package/src/team-subscription-protocol.ts +147 -0
- package/src/teams-projects-protocol.ts +153 -0
- package/src/typings/globals.ts +4 -4
- package/src/util/analytics.ts +109 -0
- package/src/util/async-iterator.ts +4 -5
- package/src/util/cancelable.ts +3 -3
- package/src/util/date-time.ts +8 -8
- package/src/util/deferred.ts +6 -6
- package/src/util/disposable.ts +3 -6
- package/src/util/event.ts +9 -11
- package/src/util/garbage-collected-cache.ts +11 -8
- package/src/util/generate-workspace-id.spec.ts +37 -10
- package/src/util/generate-workspace-id.ts +464 -438
- package/src/util/gitpod-cookie.ts +38 -0
- package/src/util/gitpod-host-url.spec.ts +59 -8
- package/src/util/gitpod-host-url.ts +52 -40
- package/src/util/grpc.ts +15 -0
- package/src/util/jaeger-client-types.ts +102 -0
- package/src/util/logging.ts +145 -72
- package/src/util/make-link.ts +6 -7
- package/src/util/parse-workspace-id.spec.ts +37 -8
- package/src/util/parse-workspace-id.ts +32 -7
- package/src/util/queue.spec.ts +28 -26
- package/src/util/repeat.ts +45 -0
- package/src/util/semaphore.ts +6 -8
- package/src/util/skip-if.ts +10 -7
- package/src/util/timeutil.spec.ts +14 -15
- package/src/util/timeutil.ts +25 -15
- package/src/util/tracing.spec.ts +88 -0
- package/src/util/tracing.ts +200 -31
- package/src/util/workspace-port-authentication.ts +10 -13
- package/src/workspace-cluster.ts +107 -0
- package/src/workspace-instance.ts +98 -31
- package/src/wsready.ts +3 -3
- package/data/builtin-theia-plugins.json +0 -372
- package/lib/messaging/connection-error-handler.d.ts +0 -27
- package/lib/messaging/connection-error-handler.d.ts.map +0 -1
- package/lib/messaging/connection-error-handler.js +0 -46
- package/lib/messaging/connection-error-handler.js.map +0 -1
- package/lib/theia-plugins.d.ts +0 -11
- package/lib/theia-plugins.d.ts.map +0 -1
- package/lib/theia-plugins.js.map +0 -1
- package/lib/util/context-url.d.ts +0 -13
- package/lib/util/context-url.d.ts.map +0 -1
- package/lib/util/context-url.js +0 -26
- package/lib/util/context-url.js.map +0 -1
- package/lib/util/context-url.spec.d.ts +0 -10
- package/lib/util/context-url.spec.d.ts.map +0 -1
- package/lib/util/context-url.spec.js +0 -52
- package/lib/util/context-url.spec.js.map +0 -1
- package/lib/util/repeater.d.ts +0 -22
- package/lib/util/repeater.d.ts.map +0 -1
- package/lib/util/repeater.js +0 -118
- package/lib/util/repeater.js.map +0 -1
- package/lib/util/safe-promise.d.ts +0 -11
- package/lib/util/safe-promise.d.ts.map +0 -1
- package/lib/util/safe-promise.js +0 -34
- package/lib/util/safe-promise.js.map +0 -1
- package/lib/util/without.d.ts +0 -7
- package/lib/util/without.d.ts.map +0 -1
- package/lib/util/without.js.map +0 -1
- package/src/messaging/connection-error-handler.ts +0 -62
- package/src/theia-plugins.ts +0 -11
- package/src/util/context-url.spec.ts +0 -25
- package/src/util/context-url.ts +0 -23
- package/src/util/jaeger-client.d.ts +0 -105
- package/src/util/repeater.ts +0 -49
- package/src/util/safe-promise.ts +0 -26
package/src/plans.ts
ADDED
|
@@ -0,0 +1,679 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2021 Gitpod GmbH. All rights reserved.
|
|
3
|
+
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
+
* See License-AGPL.txt in the project root for license information.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export type Currency = "USD" | "EUR";
|
|
8
|
+
export namespace Currency {
|
|
9
|
+
export const getAll = (): Currency[] => {
|
|
10
|
+
return ["USD", "EUR"];
|
|
11
|
+
};
|
|
12
|
+
export const getSymbol = (c: Currency) => {
|
|
13
|
+
return c === "USD" ? "$" : "€";
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Different plans of the same type MAY have different prices ($/€, for example) but MUST have the same feature set.
|
|
19
|
+
*/
|
|
20
|
+
export type PlanType =
|
|
21
|
+
| "free"
|
|
22
|
+
| "free-50"
|
|
23
|
+
| "free-open-source"
|
|
24
|
+
| "student"
|
|
25
|
+
| "basic"
|
|
26
|
+
| "personal"
|
|
27
|
+
| "professional"
|
|
28
|
+
| "professional-new";
|
|
29
|
+
export type HoursPerMonthType = number | "unlimited";
|
|
30
|
+
export interface Plan {
|
|
31
|
+
chargebeeId: string;
|
|
32
|
+
githubId?: number;
|
|
33
|
+
githubPlanNumber?: number;
|
|
34
|
+
|
|
35
|
+
name: string;
|
|
36
|
+
currency: Currency;
|
|
37
|
+
/** In full currencies (Euro, US Dollar, ...) */
|
|
38
|
+
pricePerMonth: number;
|
|
39
|
+
hoursPerMonth: HoursPerMonthType;
|
|
40
|
+
type: PlanType;
|
|
41
|
+
team?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export namespace Plan {
|
|
44
|
+
export const is = (o: any): o is Plan => {
|
|
45
|
+
return (
|
|
46
|
+
"chargebeeId" in o &&
|
|
47
|
+
"name" in o &&
|
|
48
|
+
"currency" in o &&
|
|
49
|
+
"pricePerMonth" in o &&
|
|
50
|
+
"hoursPerMonth" in o &&
|
|
51
|
+
"type" in o
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const MAX_PARALLEL_WORKSPACES = 16;
|
|
57
|
+
|
|
58
|
+
export interface Coupon {
|
|
59
|
+
id: string;
|
|
60
|
+
isGithubStudentCoupon?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export namespace Coupon {
|
|
63
|
+
export const is = (o: any): o is Coupon => {
|
|
64
|
+
return "id" in o;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export namespace Coupons {
|
|
68
|
+
export const INTERNAL_GITPOD_GHSP: Coupon = {
|
|
69
|
+
id: "INTERNAL_GITPOD_GHSP",
|
|
70
|
+
isGithubStudentCoupon: true,
|
|
71
|
+
};
|
|
72
|
+
export const INTERNAL_GITPOD_GHSP_2: Coupon = {
|
|
73
|
+
id: "INTERNAL_GITPOD_GHSP_2",
|
|
74
|
+
isGithubStudentCoupon: true,
|
|
75
|
+
};
|
|
76
|
+
export const GITHUBSTUDENTPACKFORFACULTY: Coupon = {
|
|
77
|
+
id: "GITHUBSTUDENTPACKFORFACULTY",
|
|
78
|
+
isGithubStudentCoupon: true,
|
|
79
|
+
};
|
|
80
|
+
export const isGithubStudentCoupon = (id: string): boolean | undefined => {
|
|
81
|
+
const c = getAllCoupons().find((ic) => ic.id === id);
|
|
82
|
+
if (!c) {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
return !!c.isGithubStudentCoupon;
|
|
86
|
+
};
|
|
87
|
+
export const getAllCoupons = (): Coupon[] => {
|
|
88
|
+
return Object.keys(Coupons)
|
|
89
|
+
.map((k) => (Coupons as any)[k])
|
|
90
|
+
.filter((a) => typeof a === "object" && Coupon.is(a));
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Theoretical maximum of workspace hours: 16 workspaces for 24h a day for 31 days as permitted by the v3 unlimited plan
|
|
95
|
+
// Other unlimited hour plans are restricted by the number of Parallel Workspaces they can start.
|
|
96
|
+
export const ABSOLUTE_MAX_USAGE = MAX_PARALLEL_WORKSPACES * 24 * 31;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Version history:
|
|
100
|
+
* - v1:
|
|
101
|
+
* - Free
|
|
102
|
+
* - Basic
|
|
103
|
+
* - Professional
|
|
104
|
+
* - Team Professional
|
|
105
|
+
* - v2:
|
|
106
|
+
* - Free
|
|
107
|
+
* - Personal
|
|
108
|
+
* - Unlimited: rebranded professional with unlimited hours
|
|
109
|
+
* - Team Unlimited: rebranded professional with unlimited hours
|
|
110
|
+
* - dropped: Basic
|
|
111
|
+
* - v2.5:
|
|
112
|
+
* + Student Unlimited
|
|
113
|
+
* + Team Unlimited Student
|
|
114
|
+
* - V3:
|
|
115
|
+
* - Free: reduced to 50h (stays default, but not advertised directly anymore)
|
|
116
|
+
* - Personal (8/9)
|
|
117
|
+
* - Professional (23/25)
|
|
118
|
+
* - Unlimited (35/39)
|
|
119
|
+
* - v4:
|
|
120
|
+
* - Professional Open Source (free)
|
|
121
|
+
* - v5:
|
|
122
|
+
* - Unleashed: rebranded Unlimited
|
|
123
|
+
*/
|
|
124
|
+
export namespace Plans {
|
|
125
|
+
/**
|
|
126
|
+
* The old default plan (v1): 100h hours for public repos
|
|
127
|
+
*/
|
|
128
|
+
export const FREE: Plan = {
|
|
129
|
+
chargebeeId: "free",
|
|
130
|
+
githubId: 2034,
|
|
131
|
+
githubPlanNumber: 1,
|
|
132
|
+
|
|
133
|
+
type: "free",
|
|
134
|
+
name: "Open Source",
|
|
135
|
+
currency: "USD",
|
|
136
|
+
pricePerMonth: 0,
|
|
137
|
+
hoursPerMonth: 100,
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The new default plan (v3): 50h hours for public repos
|
|
142
|
+
*/
|
|
143
|
+
export const FREE_50: Plan = {
|
|
144
|
+
chargebeeId: "free-50",
|
|
145
|
+
githubId: 4902,
|
|
146
|
+
githubPlanNumber: 5,
|
|
147
|
+
|
|
148
|
+
type: "free-50",
|
|
149
|
+
name: "Open Source",
|
|
150
|
+
currency: "USD",
|
|
151
|
+
pricePerMonth: 0,
|
|
152
|
+
hoursPerMonth: 50,
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Users created after this date get the FREE_50 plan (v3) instead of the (old) FREE plan (v1)
|
|
157
|
+
*/
|
|
158
|
+
export const FREE_50_START_DATE = "2019-12-19T00:00:00.000Z";
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* The 'Professional Open Source' plan was introduced to offer professional open-souce developers unlimited hours.
|
|
162
|
+
*/
|
|
163
|
+
export const FREE_OPEN_SOURCE: Plan = {
|
|
164
|
+
chargebeeId: "free-open-source",
|
|
165
|
+
type: "free-open-source",
|
|
166
|
+
name: "Professional Open Source",
|
|
167
|
+
currency: "USD",
|
|
168
|
+
pricePerMonth: 0,
|
|
169
|
+
hoursPerMonth: "unlimited",
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The 'Student Unleashed' plans were introduced to give students access to the highly-priced unlimited plans.
|
|
174
|
+
*/
|
|
175
|
+
export const PROFESSIONAL_STUDENT_EUR: Plan = {
|
|
176
|
+
chargebeeId: "professional-student-eur",
|
|
177
|
+
type: "student",
|
|
178
|
+
name: "Student Unleashed",
|
|
179
|
+
currency: "EUR",
|
|
180
|
+
pricePerMonth: 8,
|
|
181
|
+
hoursPerMonth: "unlimited",
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* The 'Student Unleashed' plans were introduced to give students access to the highly-priced unlimited plans.
|
|
186
|
+
*/
|
|
187
|
+
export const PROFESSIONAL_STUDENT_USD: Plan = {
|
|
188
|
+
chargebeeId: "professional-student-usd",
|
|
189
|
+
type: "student",
|
|
190
|
+
name: "Student Unleashed",
|
|
191
|
+
currency: "USD",
|
|
192
|
+
pricePerMonth: 9,
|
|
193
|
+
hoursPerMonth: "unlimited",
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* The 'Student Unleashed' plans were introduced to give students access to the highly-priced unlimited plans.
|
|
198
|
+
*/
|
|
199
|
+
export const TEAM_PROFESSIONAL_STUDENT_EUR: Plan = {
|
|
200
|
+
chargebeeId: "team-professional-student-eur",
|
|
201
|
+
type: "student",
|
|
202
|
+
name: "Team Student Unleashed",
|
|
203
|
+
team: true,
|
|
204
|
+
currency: "EUR",
|
|
205
|
+
pricePerMonth: 8,
|
|
206
|
+
hoursPerMonth: "unlimited",
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* The 'Student Unleashed' plans were introduced to give students access to the highly-priced unlimited plans.
|
|
211
|
+
*/
|
|
212
|
+
export const TEAM_PROFESSIONAL_STUDENT_USD: Plan = {
|
|
213
|
+
chargebeeId: "team-professional-student-usd",
|
|
214
|
+
type: "student",
|
|
215
|
+
name: "Team Student Unleashed",
|
|
216
|
+
team: true,
|
|
217
|
+
currency: "USD",
|
|
218
|
+
pricePerMonth: 9,
|
|
219
|
+
hoursPerMonth: "unlimited",
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* The 'basic' plan was the original differentiator between FREE and Professional (v1) but got discarded soon.
|
|
224
|
+
*/
|
|
225
|
+
export const BASIC_EUR: Plan = {
|
|
226
|
+
chargebeeId: "basic-eur",
|
|
227
|
+
type: "basic",
|
|
228
|
+
name: "Standard",
|
|
229
|
+
currency: "EUR",
|
|
230
|
+
pricePerMonth: 17,
|
|
231
|
+
hoursPerMonth: 100,
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* The 'basic' plan was the original differentiator between FREE and Professional (v1) but got discarded soon.
|
|
236
|
+
*/
|
|
237
|
+
export const BASIC_USD: Plan = {
|
|
238
|
+
chargebeeId: "basic-usd",
|
|
239
|
+
githubId: 2035,
|
|
240
|
+
githubPlanNumber: 2,
|
|
241
|
+
|
|
242
|
+
type: "basic",
|
|
243
|
+
name: "Standard",
|
|
244
|
+
currency: "USD",
|
|
245
|
+
pricePerMonth: 19,
|
|
246
|
+
hoursPerMonth: 100,
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* The 'personal' plan was introduced to superseed the 'basic' plan (introduced with v2) to be more attractive to hobbyists.
|
|
251
|
+
*/
|
|
252
|
+
export const PERSONAL_EUR: Plan = {
|
|
253
|
+
chargebeeId: "personal-eur",
|
|
254
|
+
type: "personal",
|
|
255
|
+
name: "Personal",
|
|
256
|
+
currency: "EUR",
|
|
257
|
+
pricePerMonth: 8,
|
|
258
|
+
hoursPerMonth: 100,
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* The 'personal' plan was introduced to superseed the 'basic' plan (introduced with v2) to be more attractive to hobbyists.
|
|
263
|
+
*/
|
|
264
|
+
export const PERSONAL_USD: Plan = {
|
|
265
|
+
chargebeeId: "personal-usd",
|
|
266
|
+
githubId: 2274,
|
|
267
|
+
githubPlanNumber: 4,
|
|
268
|
+
|
|
269
|
+
type: "personal",
|
|
270
|
+
name: "Personal",
|
|
271
|
+
currency: "USD",
|
|
272
|
+
pricePerMonth: 9,
|
|
273
|
+
hoursPerMonth: 100,
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* This is the 'new' Professional plan (v3), which is meant to fit well between Personal (9$/8€) on the left and
|
|
278
|
+
* Unleashed (39$/35€) on the right.
|
|
279
|
+
*/
|
|
280
|
+
export const PROFESSIONAL_NEW_EUR: Plan = {
|
|
281
|
+
chargebeeId: "professional-new-eur",
|
|
282
|
+
type: "professional-new",
|
|
283
|
+
name: "Professional",
|
|
284
|
+
currency: "EUR",
|
|
285
|
+
pricePerMonth: 23,
|
|
286
|
+
hoursPerMonth: "unlimited",
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* This is the 'new' Professional plan (v3), which is meant to fit well between Personal (9$/8€) on the left and
|
|
291
|
+
* Unleashed (39$/35€) on the right.
|
|
292
|
+
*/
|
|
293
|
+
export const PROFESSIONAL_NEW_USD: Plan = {
|
|
294
|
+
chargebeeId: "professional-new-usd",
|
|
295
|
+
type: "professional-new",
|
|
296
|
+
name: "Professional",
|
|
297
|
+
currency: "USD",
|
|
298
|
+
pricePerMonth: 25,
|
|
299
|
+
hoursPerMonth: "unlimited",
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* This is the 'new' Team Professional plan (v3), which is meant to fit well between Personal (9$/8€) on the left and
|
|
304
|
+
* Unleashed (39$/35€) on the right.
|
|
305
|
+
*/
|
|
306
|
+
export const TEAM_PROFESSIONAL_NEW_EUR: Plan = {
|
|
307
|
+
chargebeeId: "team-professional-new-eur",
|
|
308
|
+
type: "professional-new",
|
|
309
|
+
name: "Team Professional",
|
|
310
|
+
currency: "EUR",
|
|
311
|
+
team: true,
|
|
312
|
+
pricePerMonth: 23,
|
|
313
|
+
hoursPerMonth: "unlimited",
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* This is the 'new' Team Professional plan (v3), which is meant to fit well between Personal (9$/8€) on the left and
|
|
318
|
+
* Unleashed (39$/35€) on the right.
|
|
319
|
+
*/
|
|
320
|
+
export const TEAM_PROFESSIONAL_NEW_USD: Plan = {
|
|
321
|
+
chargebeeId: "team-professional-new-usd",
|
|
322
|
+
type: "professional-new",
|
|
323
|
+
name: "Team Professional",
|
|
324
|
+
currency: "USD",
|
|
325
|
+
team: true,
|
|
326
|
+
pricePerMonth: 25,
|
|
327
|
+
hoursPerMonth: "unlimited",
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* This is the 'Unleashed' plan (v1, rebranded v2, v5)
|
|
332
|
+
* It was originally introduced as 'Professional', and we cannot update the ids, so it stays that way in the code.
|
|
333
|
+
*/
|
|
334
|
+
export const PROFESSIONAL_EUR: Plan = {
|
|
335
|
+
chargebeeId: "professional-eur",
|
|
336
|
+
type: "professional",
|
|
337
|
+
name: "Unleashed",
|
|
338
|
+
currency: "EUR",
|
|
339
|
+
pricePerMonth: 35,
|
|
340
|
+
hoursPerMonth: "unlimited",
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* This is the 'Unleashed' plan (v1, rebranded v2, v5)
|
|
345
|
+
* It was originally introduced as 'Professional', and we cannot update the ids, so it stays that way in the code.
|
|
346
|
+
*/
|
|
347
|
+
export const PROFESSIONAL_USD: Plan = {
|
|
348
|
+
chargebeeId: "professional-usd",
|
|
349
|
+
githubId: 2036,
|
|
350
|
+
githubPlanNumber: 3,
|
|
351
|
+
|
|
352
|
+
type: "professional",
|
|
353
|
+
name: "Unleashed",
|
|
354
|
+
currency: "USD",
|
|
355
|
+
pricePerMonth: 39,
|
|
356
|
+
hoursPerMonth: "unlimited",
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* This is the Team-'Unleashed' plan (v1, rebranded v2, v5)
|
|
361
|
+
* It was originally introduced as 'Professional', and we cannot update the ids, so it stays that way in the code.
|
|
362
|
+
*/
|
|
363
|
+
export const TEAM_PROFESSIONAL_USD: Plan = {
|
|
364
|
+
chargebeeId: "team-professional-usd",
|
|
365
|
+
type: "professional",
|
|
366
|
+
name: "Team Unleashed",
|
|
367
|
+
currency: "USD",
|
|
368
|
+
team: true,
|
|
369
|
+
pricePerMonth: 39,
|
|
370
|
+
hoursPerMonth: "unlimited",
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* This is the Team-'Unleashed' plan (v1, rebranded v2, v5)
|
|
375
|
+
* It was originally introduced as 'Professional', and we cannot update the ids, so it stays that way in the code.
|
|
376
|
+
*/
|
|
377
|
+
export const TEAM_PROFESSIONAL_EUR: Plan = {
|
|
378
|
+
chargebeeId: "team-professional-eur",
|
|
379
|
+
type: "professional",
|
|
380
|
+
name: "Team Unleashed",
|
|
381
|
+
currency: "EUR",
|
|
382
|
+
team: true,
|
|
383
|
+
pricePerMonth: 35,
|
|
384
|
+
hoursPerMonth: "unlimited",
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
const getAllPlans = (): Plan[] => {
|
|
388
|
+
return Object.keys(Plans)
|
|
389
|
+
.map((k) => (Plans as any)[k])
|
|
390
|
+
.filter((a) => typeof a === "object" && Plan.is(a));
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* This function returns all individual plans that might be active (= we have subscriptions for) at the moment
|
|
395
|
+
*/
|
|
396
|
+
export function getAvailablePlans(currency: Currency): Plan[] {
|
|
397
|
+
const availablePaidPlans = [
|
|
398
|
+
Plans.BASIC_EUR,
|
|
399
|
+
Plans.BASIC_USD,
|
|
400
|
+
Plans.PERSONAL_EUR,
|
|
401
|
+
Plans.PERSONAL_USD,
|
|
402
|
+
Plans.PROFESSIONAL_NEW_EUR,
|
|
403
|
+
Plans.PROFESSIONAL_NEW_USD,
|
|
404
|
+
Plans.PROFESSIONAL_EUR,
|
|
405
|
+
Plans.PROFESSIONAL_USD,
|
|
406
|
+
];
|
|
407
|
+
return [Plans.FREE, Plans.FREE_50, Plans.FREE_OPEN_SOURCE, ...availablePaidPlans.filter((p) => p.currency)];
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export const getAvailableTeamPlans = (currency?: Currency): Plan[] => {
|
|
411
|
+
const teamPlans = getAllPlans().filter((p) => !!p.team);
|
|
412
|
+
return currency ? teamPlans.filter((p) => p.currency === currency) : teamPlans;
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
export function getById(id: string | undefined): Plan | undefined {
|
|
416
|
+
if (id === undefined) {
|
|
417
|
+
return undefined;
|
|
418
|
+
}
|
|
419
|
+
return getAllPlans().find((p) => p.chargebeeId === id) || undefined;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export function getByTypeAndCurrency(type: PlanType, currency: Currency): Plan | undefined {
|
|
423
|
+
return getAllPlans()
|
|
424
|
+
.filter((p) => p.type)
|
|
425
|
+
.find((p) => p.currency === currency);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
export function getProPlan(currency: Currency): Plan {
|
|
429
|
+
switch (currency) {
|
|
430
|
+
case "EUR":
|
|
431
|
+
return Plans.PROFESSIONAL_EUR;
|
|
432
|
+
case "USD":
|
|
433
|
+
return Plans.PROFESSIONAL_USD;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
export function getNewProPlan(currency: Currency): Plan {
|
|
438
|
+
switch (currency) {
|
|
439
|
+
case "EUR":
|
|
440
|
+
return Plans.PROFESSIONAL_NEW_EUR;
|
|
441
|
+
case "USD":
|
|
442
|
+
return Plans.PROFESSIONAL_NEW_USD;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export function getStudentProPlan(currency: Currency): Plan {
|
|
447
|
+
switch (currency) {
|
|
448
|
+
case "EUR":
|
|
449
|
+
return Plans.PROFESSIONAL_STUDENT_EUR;
|
|
450
|
+
case "USD":
|
|
451
|
+
return Plans.PROFESSIONAL_STUDENT_USD;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export function getBasicPlan(currency: Currency): Plan {
|
|
456
|
+
switch (currency) {
|
|
457
|
+
case "EUR":
|
|
458
|
+
return Plans.BASIC_EUR;
|
|
459
|
+
case "USD":
|
|
460
|
+
return Plans.BASIC_USD;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export function getPersonalPlan(currency: Currency): Plan {
|
|
465
|
+
switch (currency) {
|
|
466
|
+
case "EUR":
|
|
467
|
+
return Plans.PERSONAL_EUR;
|
|
468
|
+
case "USD":
|
|
469
|
+
return Plans.PERSONAL_USD;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
export function getFreePlan(userCreationDate: string): Plan {
|
|
474
|
+
return userCreationDate < Plans.FREE_50_START_DATE ? Plans.FREE : Plans.FREE_50;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export function isFreePlan(chargebeeId: string | undefined): boolean {
|
|
478
|
+
return (
|
|
479
|
+
chargebeeId === Plans.FREE.chargebeeId ||
|
|
480
|
+
chargebeeId === Plans.FREE_50.chargebeeId ||
|
|
481
|
+
chargebeeId === Plans.FREE_OPEN_SOURCE.chargebeeId
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
export function isFreeNonTransientPlan(chargebeeId: string | undefined): boolean {
|
|
486
|
+
return chargebeeId === Plans.FREE_OPEN_SOURCE.chargebeeId;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
export function getHoursPerMonth(plan: Plan): number {
|
|
490
|
+
return plan.hoursPerMonth == "unlimited" ? ABSOLUTE_MAX_USAGE : plan.hoursPerMonth;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Returns the maximum number of parallel workspaces for the given plan
|
|
495
|
+
* @param plan
|
|
496
|
+
*/
|
|
497
|
+
export function getParallelWorkspacesById(planId: string | undefined): number {
|
|
498
|
+
return getParallelWorkspaces(Plans.getById(planId));
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Returns the maximum number of parallel workspaces for the given plan
|
|
503
|
+
* @param plan
|
|
504
|
+
*/
|
|
505
|
+
export function getParallelWorkspaces(plan: Plan | undefined): number {
|
|
506
|
+
const DEFAULT = 4;
|
|
507
|
+
if (!plan) {
|
|
508
|
+
return DEFAULT;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
switch (plan.type) {
|
|
512
|
+
case "professional-new":
|
|
513
|
+
return 8;
|
|
514
|
+
|
|
515
|
+
case "professional":
|
|
516
|
+
case "student":
|
|
517
|
+
return 16;
|
|
518
|
+
}
|
|
519
|
+
return DEFAULT;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* This declares the plan structure we have in Gitpod: All entries in a sub-array have the same arity in this structure.
|
|
524
|
+
* This is used to impose a partial order on plan types (cmp. compareTypes(...)).
|
|
525
|
+
* The order inside the sub-array carries meaning, too: The first one is the current, preferred plan (we advertise) for the given arity.
|
|
526
|
+
* This is used to be able to get the next "higher" plan (cmp. getNextHigherPlanType).
|
|
527
|
+
*/
|
|
528
|
+
const planStructure: PlanType[][] = [
|
|
529
|
+
["free-50", "free", "free-open-source"],
|
|
530
|
+
["personal", "basic"],
|
|
531
|
+
["professional-new"],
|
|
532
|
+
["professional", "student"],
|
|
533
|
+
];
|
|
534
|
+
|
|
535
|
+
function getPlanTypeArity(type: PlanType) {
|
|
536
|
+
return planStructure.findIndex((types: PlanType[]) => types.includes(type));
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function getPlanTypeForArity(arity: number): PlanType | undefined {
|
|
540
|
+
if (arity >= planStructure.length) {
|
|
541
|
+
return undefined;
|
|
542
|
+
}
|
|
543
|
+
return planStructure[arity][0];
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Returns the preferred plan type with the next higher arity
|
|
548
|
+
* @param type
|
|
549
|
+
*/
|
|
550
|
+
export function getNextHigherPlanType(type: PlanType): PlanType {
|
|
551
|
+
const arity = getPlanTypeArity(type);
|
|
552
|
+
const nextHigherType = getPlanTypeForArity(arity + 1);
|
|
553
|
+
return nextHigherType || "professional";
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* This imposes a partial order on the plan types
|
|
558
|
+
* @param planTypeA
|
|
559
|
+
* @param planTypeB
|
|
560
|
+
*/
|
|
561
|
+
export function compareTypes(planTypeA: PlanType, planTypeB: PlanType) {
|
|
562
|
+
const va = getPlanTypeArity(planTypeA);
|
|
563
|
+
const vb = getPlanTypeArity(planTypeB);
|
|
564
|
+
return va < vb ? -1 : va > vb ? 1 : 0;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
export function subscriptionChange(fromType: PlanType, toType: PlanType): "upgrade" | "downgrade" | "none" {
|
|
568
|
+
const cmp = Plans.compareTypes(fromType, toType);
|
|
569
|
+
if (cmp < 0) {
|
|
570
|
+
return "upgrade";
|
|
571
|
+
} else if (cmp > 0) {
|
|
572
|
+
return "downgrade";
|
|
573
|
+
} else {
|
|
574
|
+
return "none";
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
export interface Feature {
|
|
579
|
+
title: string;
|
|
580
|
+
emph?: boolean;
|
|
581
|
+
link?: string;
|
|
582
|
+
tooltip?: string;
|
|
583
|
+
}
|
|
584
|
+
export namespace Feature {
|
|
585
|
+
export const getFeaturesFor = (p: Plan): Feature[] => {
|
|
586
|
+
switch (p.type) {
|
|
587
|
+
case "free":
|
|
588
|
+
return [{ title: "Public repositories" }];
|
|
589
|
+
|
|
590
|
+
case "free-50":
|
|
591
|
+
return [{ title: "Public repositories" }];
|
|
592
|
+
|
|
593
|
+
case "free-open-source":
|
|
594
|
+
return [{ title: "Public repositories" }];
|
|
595
|
+
|
|
596
|
+
case "student":
|
|
597
|
+
return [
|
|
598
|
+
{ title: "Private & Public repos" },
|
|
599
|
+
{
|
|
600
|
+
title: `${Plans.getParallelWorkspaces(p)} Parallel Workspaces`,
|
|
601
|
+
tooltip: "The number of workspaces running at the same time",
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
title: "Team Manageable",
|
|
605
|
+
link: "/teams/",
|
|
606
|
+
tooltip: "Setup Gitpod for an entire Team with a single invoice and credit card",
|
|
607
|
+
},
|
|
608
|
+
{ title: "1h Timeout", tooltip: "Workspaces without user activity are stopped after 1 hour" },
|
|
609
|
+
{
|
|
610
|
+
title: "3h Timeout Boost",
|
|
611
|
+
tooltip: "You can manually boost the timeout to 3 hours within a running workspace",
|
|
612
|
+
},
|
|
613
|
+
];
|
|
614
|
+
|
|
615
|
+
case "basic":
|
|
616
|
+
return [
|
|
617
|
+
{ title: "Private & Public repos" },
|
|
618
|
+
{
|
|
619
|
+
title: `${Plans.getParallelWorkspaces(p)} Parallel Workspaces`,
|
|
620
|
+
tooltip: "The number of workspaces running at the same time.",
|
|
621
|
+
},
|
|
622
|
+
];
|
|
623
|
+
|
|
624
|
+
// Personal
|
|
625
|
+
case "personal":
|
|
626
|
+
return [
|
|
627
|
+
{ title: "Private & Public repos" },
|
|
628
|
+
{
|
|
629
|
+
title: `${Plans.getParallelWorkspaces(p)} Parallel Workspaces`,
|
|
630
|
+
tooltip: "The number of workspaces running at the same time",
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
title: "30min Timeout",
|
|
634
|
+
tooltip: "Workspaces without user activity are stopped after 30 minutes",
|
|
635
|
+
},
|
|
636
|
+
];
|
|
637
|
+
|
|
638
|
+
// Professional
|
|
639
|
+
case "professional-new":
|
|
640
|
+
return [
|
|
641
|
+
{ title: "Private & Public repos" },
|
|
642
|
+
{
|
|
643
|
+
title: `${Plans.getParallelWorkspaces(p)} Parallel Workspaces`,
|
|
644
|
+
tooltip: "The number of workspaces running at the same time",
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
title: "Team Manageable",
|
|
648
|
+
link: "/teams/",
|
|
649
|
+
tooltip: "Setup Gitpod for an entire Team with a single invoice and credit card",
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
title: "30min Timeout",
|
|
653
|
+
tooltip: "Workspaces without user activity are stopped after 30 minutes",
|
|
654
|
+
},
|
|
655
|
+
];
|
|
656
|
+
|
|
657
|
+
// Unleashed
|
|
658
|
+
case "professional":
|
|
659
|
+
return [
|
|
660
|
+
{ title: "Private & Public repos" },
|
|
661
|
+
{
|
|
662
|
+
title: `${Plans.getParallelWorkspaces(p)} Parallel Workspaces`,
|
|
663
|
+
tooltip: "The number of workspaces running at the same time",
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
title: "Team Manageable",
|
|
667
|
+
link: "/teams/",
|
|
668
|
+
tooltip: "Setup Gitpod for an entire Team with a single invoice and credit card",
|
|
669
|
+
},
|
|
670
|
+
{ title: "1h Timeout", tooltip: "Workspaces without user activity are stopped after 1 hour" },
|
|
671
|
+
{
|
|
672
|
+
title: "3h Timeout Boost",
|
|
673
|
+
tooltip: "You can manually boost the timeout to 3 hours within a running workspace",
|
|
674
|
+
},
|
|
675
|
+
];
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
}
|