Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions contributions.json
Original file line number Diff line number Diff line change
Expand Up @@ -12658,7 +12658,11 @@
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4"
},
{
"contents": "Save 55% or more on your 1st seat of Pro.",
"contents": "Limited-time sale on GitLens Pro.",
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo && gitlens:promo != pro50"
},
{
"contents": "Save 33% or more on GitLens Pro.",
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == pro50"
},
{
Expand Down Expand Up @@ -12761,7 +12765,11 @@
"when": "gitlens:views:scm:grouped:view == launchpad && !gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4"
},
{
"contents": "Save 55% or more on your 1st seat of Pro.",
"contents": "Limited-time sale on GitLens Pro.",
"when": "gitlens:views:scm:grouped:view == launchpad && !gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo && gitlens:promo != pro50"
},
{
"contents": "Save 33% or more on GitLens Pro.",
"when": "gitlens:views:scm:grouped:view == launchpad && !gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == pro50"
},
{
Expand Down Expand Up @@ -12809,7 +12817,11 @@
"when": "gitlens:views:scm:grouped:view == worktrees && gitlens:plus:required && gitlens:plus:state == 4"
},
{
"contents": "Save 55% or more on your 1st seat of Pro.",
"contents": "Limited-time sale on GitLens Pro.",
"when": "gitlens:views:scm:grouped:view == worktrees && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo && gitlens:promo != pro50"
},
{
"contents": "Save 33% or more on GitLens Pro.",
"when": "gitlens:views:scm:grouped:view == worktrees && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == pro50"
},
{
Expand Down Expand Up @@ -12939,7 +12951,11 @@
"when": "gitlens:plus:required && gitlens:plus:state == 4"
},
{
"contents": "Save 55% or more on your 1st seat of Pro.",
"contents": "Limited-time sale on GitLens Pro.",
"when": "gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo && gitlens:promo != pro50"
},
{
"contents": "Save 33% or more on GitLens Pro.",
"when": "gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == pro50"
},
{
Expand Down
42 changes: 35 additions & 7 deletions docs/telemetry-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
'global.cloudIntegrations.connected.count': number,
'global.cloudIntegrations.connected.ids': string,
'global.debugging': boolean,
'global.device.cohort': number,
'global.enabled': boolean,
'global.folders.count': number,
'global.folders.schemes': string,
Expand Down Expand Up @@ -67,9 +68,10 @@
'global.subscription.featurePreviews.graph.status': 'eligible' | 'active' | 'expired',
'global.subscription.previewTrial.expiresOn': string,
'global.subscription.previewTrial.startedOn': string,
'global.subscription.promo.code': string,
'global.subscription.promo.key': string,
'global.subscription.state': -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6,
'global.subscription.stateString': 'verification' | 'free' | 'preview' | 'preview-expired' | 'trial' | 'trial-expired' | 'trial-reactivation-eligible' | 'paid' | 'unknown',
'global.subscription.status': 'verification' | 'free' | 'preview' | 'preview-expired' | 'trial' | 'trial-expired' | 'trial-reactivation-eligible' | 'paid' | 'unknown',
'global.upgrade': boolean,
'global.upgradedFrom': string,
'global.workspace.isTrusted': boolean
Expand All @@ -87,7 +89,7 @@
'account.id': string,
'code': string,
'exception': string,
'statusCode': string
'statusCode': number
}
```

Expand Down Expand Up @@ -1457,6 +1459,19 @@ void
}
```

### productConfig/failed

> Sent when fetching the product config fails

```typescript
{
'exception': string,
'json': string,
'reason': 'fetch' | 'validation',
'statusCode': number
}
```

### providers/context

> Sent when the "context" of the workspace changes (e.g. repo added, integration connected, etc)
Expand Down Expand Up @@ -1719,9 +1734,10 @@ void
'subscription.featurePreviews.graph.status': 'eligible' | 'active' | 'expired',
'subscription.previewTrial.expiresOn': string,
'subscription.previewTrial.startedOn': string,
'subscription.promo.code': string,
'subscription.promo.key': string,
'subscription.state': -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6,
'subscription.stateString': 'verification' | 'free' | 'preview' | 'preview-expired' | 'trial' | 'trial-expired' | 'trial-reactivation-eligible' | 'paid' | 'unknown',
'subscription.status': 'verification' | 'free' | 'preview' | 'preview-expired' | 'trial' | 'trial-expired' | 'trial-reactivation-eligible' | 'paid' | 'unknown'
'subscription.stateString': 'verification' | 'free' | 'preview' | 'preview-expired' | 'trial' | 'trial-expired' | 'trial-reactivation-eligible' | 'paid' | 'unknown'
}
```

Expand All @@ -1731,7 +1747,18 @@ void

```typescript
{
'action': 'manage' | 'sign-up' | 'sign-in' | 'sign-out' | 'reactivate' | 'resend-verification' | 'pricing' | 'start-preview-trial' | 'upgrade'
'action': 'manage' | 'sign-up' | 'sign-in' | 'sign-out' | 'reactivate' | 'resend-verification' | 'pricing' | 'start-preview-trial'
}
```

or

```typescript
{
'aborted': boolean,
'action': 'upgrade',
'promo.code': string,
'promo.key': string
}
```

Expand Down Expand Up @@ -1809,9 +1836,10 @@ or
'subscription.featurePreviews.graph.status': 'eligible' | 'active' | 'expired',
'subscription.previewTrial.expiresOn': string,
'subscription.previewTrial.startedOn': string,
'subscription.promo.code': string,
'subscription.promo.key': string,
'subscription.state': -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6,
'subscription.stateString': 'verification' | 'free' | 'preview' | 'preview-expired' | 'trial' | 'trial-expired' | 'trial-reactivation-eligible' | 'paid' | 'unknown',
'subscription.status': 'verification' | 'free' | 'preview' | 'preview-expired' | 'trial' | 'trial-expired' | 'trial-reactivation-eligible' | 'paid' | 'unknown'
'subscription.stateString': 'verification' | 'free' | 'preview' | 'preview-expired' | 'trial' | 'trial-expired' | 'trial-reactivation-eligible' | 'paid' | 'unknown'
}
```

Expand Down
28 changes: 24 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19526,7 +19526,12 @@
},
{
"view": "gitlens.views.launchpad",
"contents": "Save 55% or more on your 1st seat of Pro.",
"contents": "Limited-time sale on GitLens Pro.",
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo && gitlens:promo != pro50"
},
{
"view": "gitlens.views.launchpad",
"contents": "Save 33% or more on GitLens Pro.",
"when": "!gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == pro50"
},
{
Expand Down Expand Up @@ -19581,7 +19586,12 @@
},
{
"view": "gitlens.views.scm.grouped",
"contents": "Save 55% or more on your 1st seat of Pro.",
"contents": "Limited-time sale on GitLens Pro.",
"when": "gitlens:views:scm:grouped:view == launchpad && !gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo && gitlens:promo != pro50"
},
{
"view": "gitlens.views.scm.grouped",
"contents": "Save 33% or more on GitLens Pro.",
"when": "gitlens:views:scm:grouped:view == launchpad && !gitlens:launchpad:connect && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == pro50"
},
{
Expand Down Expand Up @@ -19641,7 +19651,12 @@
},
{
"view": "gitlens.views.scm.grouped",
"contents": "Save 55% or more on your 1st seat of Pro.",
"contents": "Limited-time sale on GitLens Pro.",
"when": "gitlens:views:scm:grouped:view == worktrees && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo && gitlens:promo != pro50"
},
{
"view": "gitlens.views.scm.grouped",
"contents": "Save 33% or more on GitLens Pro.",
"when": "gitlens:views:scm:grouped:view == worktrees && gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == pro50"
},
{
Expand Down Expand Up @@ -19724,7 +19739,12 @@
},
{
"view": "gitlens.views.worktrees",
"contents": "Save 55% or more on your 1st seat of Pro.",
"contents": "Limited-time sale on GitLens Pro.",
"when": "gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo && gitlens:promo != pro50"
},
{
"view": "gitlens.views.worktrees",
"contents": "Save 33% or more on GitLens Pro.",
"when": "gitlens:plus:required && gitlens:plus:state == 4 && gitlens:promo == pro50"
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/commands/git/worktree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export class WorktreeGitCommand extends QuickCommand<State> {
}
assertStateStepRepository(state);

const result = yield* ensureAccessStep(state, context, PlusFeatures.Worktrees);
const result = yield* ensureAccessStep(this.container, state, context, PlusFeatures.Worktrees);
if (result === StepResultBreak) continue;

switch (state.subcommand) {
Expand Down
14 changes: 9 additions & 5 deletions src/commands/quickCommand.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import {
} from '../git/utils/reference.utils';
import { getHighlanderProviderName } from '../git/utils/remote.utils';
import { createRevisionRange, isRevisionRange } from '../git/utils/revision.utils';
import { getApplicablePromo } from '../plus/gk/utils/promo.utils';
import { isSubscriptionPaidPlan, isSubscriptionPreviewTrialExpired } from '../plus/gk/utils/subscription.utils';
import type { LaunchpadCommandArgs } from '../plus/launchpad/launchpad';
import {
Expand Down Expand Up @@ -2635,8 +2634,13 @@ function getShowRepositoryStatusStepItems<
export async function* ensureAccessStep<
State extends PartialStepState & { repo?: Repository },
Context extends { title: string },
>(state: State, context: Context, feature: PlusFeatures): AsyncStepResultGenerator<FeatureAccess | RepoFeatureAccess> {
const access = await Container.instance.git.access(feature, state.repo?.path);
>(
container: Container,
state: State,
context: Context,
feature: PlusFeatures,
): AsyncStepResultGenerator<FeatureAccess | RepoFeatureAccess> {
const access = await container.git.access(feature, state.repo?.path);
if (access.allowed) return access;

const directives: DirectiveQuickPickItem[] = [];
Expand All @@ -2651,8 +2655,8 @@ export async function* ensureAccessStep<
} else {
if (access.subscription.required == null) return access;

const promo = getApplicablePromo(access.subscription.current.state, 'gate');
const detail = promo?.quickpick.detail;
const promo = await container.productConfig.getApplicablePromo(access.subscription.current.state, 'gate');
const detail = promo?.content?.quickpick.detail;

placeholder = 'Pro feature — requires a trial or GitLens Pro for use on privately-hosted repos';
if (isSubscriptionPaidPlan(access.subscription.required) && access.subscription.current.account != null) {
Expand Down
2 changes: 1 addition & 1 deletion src/constants.context.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Uri } from 'vscode';
import type { AnnotationStatus, Keys } from './constants';
import type { PromoKeys } from './constants.promos';
import type { SubscriptionPlanId, SubscriptionState } from './constants.subscription';
import type { CustomEditorTypes, GroupableTreeViewTypes, WebviewTypes, WebviewViewTypes } from './constants.views';
import type { PromoKeys } from './plus/gk/models/promo';
import type { WalkthroughContextKeys } from './telemetry/walkthroughStateProvider';

export type ContextKeys = {
Expand Down
24 changes: 0 additions & 24 deletions src/constants.promos.ts

This file was deleted.

16 changes: 16 additions & 0 deletions src/constants.storage.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { GraphBranchesVisibility, ViewShowBranchComparison } from './config';
import type { AIProviders } from './constants.ai';
import type { IntegrationId } from './constants.integrations';
import type { SubscriptionState } from './constants.subscription';
import type { TrackedUsage, TrackedUsageKeys } from './constants.telemetry';
import type { GroupableTreeViewTypes } from './constants.views';
import type { Environment } from './container';
Expand Down Expand Up @@ -69,6 +70,7 @@ export type GlobalStorage = {
version: string;
// Keep the pre-release version separate from the released version
preVersion: string;
'product:config': Stored<StoredProductConfig>;
'confirm:draft:storage': boolean;
'home:sections:collapsed': string[];
'home:walkthrough:dismissed': boolean;
Expand Down Expand Up @@ -103,6 +105,20 @@ export interface StoredConfiguredIntegrationDescriptor {
scopes: string;
}

export interface StoredProductConfig {
promos: StoredPromo[];
}

export interface StoredPromo {
key: string;
code?: string;
locations?: ('account' | 'badge' | 'gate' | 'home')[];
states?: SubscriptionState[];
expiresOn?: number;
startsOn?: number;
percentile?: number;
}

export type DeprecatedWorkspaceStorage = {
/** @deprecated use `confirm:ai:tos:${AIProviders}` */
'confirm:sendToOpenAI': boolean;
Expand Down
26 changes: 22 additions & 4 deletions src/constants.telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export interface TelemetryGlobalContext extends SubscriptionEventData {
'cloudIntegrations.connected.count': number;
'cloudIntegrations.connected.ids': string;
debugging: boolean;
/** Cohort number between 1 and 100 to use for percentage-based rollouts */
'device.cohort': number;
enabled: boolean;
prerelease: boolean;
install: boolean;
Expand Down Expand Up @@ -182,6 +184,9 @@ export interface TelemetryEvents extends WebviewShowAbortedEvents, WebviewShownE
/** Sent when a PR review was started in the inspect overview */
openReviewMode: OpenReviewModeEvent;

/** Sent when fetching the product config fails */
'productConfig/failed': ProductConfigFailedEvent;

/** Sent when the "context" of the workspace changes (e.g. repo added, integration connected, etc) */
'providers/context': void;

Expand Down Expand Up @@ -288,7 +293,7 @@ interface AccountValidationFailedEvent {
'account.id': string;
exception: string;
code: string | undefined;
statusCode: string | undefined;
statusCode: number | undefined;
}

interface ActivateEvent extends ConfigEventData {
Expand Down Expand Up @@ -658,6 +663,13 @@ interface OpenReviewModeEvent {
source: Sources;
}

interface ProductConfigFailedEvent {
reason: 'fetch' | 'validation';
json: string | undefined;
exception?: string;
statusCode?: number | undefined;
}

interface ProvidersRegistrationCompleteEvent {
'config.git.autoRepositoryDetection': boolean | 'subFolders' | 'openEditors' | undefined;
}
Expand Down Expand Up @@ -769,9 +781,10 @@ export interface SubscriptionPreviousEventData
Partial<Flatten<NonNullable<Subscription['previewTrial']>, 'previous.subscription.previewTrial', true>> {}

export interface SubscriptionEventData extends Partial<SubscriptionCurrentEventData> {
'subscription.promo.key'?: string;
'subscription.promo.code'?: string;
'subscription.state'?: SubscriptionState;
'subscription.stateString'?: SubscriptionStateString;
'subscription.status'?: SubscriptionStateString;
}

type SubscriptionActionEventData =
Expand All @@ -784,8 +797,13 @@ type SubscriptionActionEventData =
| 'reactivate'
| 'resend-verification'
| 'pricing'
| 'start-preview-trial'
| 'upgrade';
| 'start-preview-trial';
}
| {
action: 'upgrade';
aborted: boolean;
'promo.key'?: string;
'promo.code'?: string;
}
| {
action: 'visibility';
Expand Down
Loading