Skip to content

Commit 43012df

Browse files
committed
Adds closed webview event
1 parent 34f5ca1 commit 43012df

File tree

3 files changed

+93
-1
lines changed

3 files changed

+93
-1
lines changed

docs/telemetry-events.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,18 @@ or
750750
}
751751
```
752752

753+
### commitDetails/closed
754+
755+
```typescript
756+
{
757+
[`context.${string}`]: string | number | boolean,
758+
'context.webview.host': 'editor' | 'view',
759+
'context.webview.id': string,
760+
'context.webview.instanceId': string,
761+
'context.webview.type': string
762+
}
763+
```
764+
753765
### commitDetails/mode/changed
754766

755767
> Sent when the user changes the selected tab (mode) on the Graph Details view
@@ -943,6 +955,18 @@ or
943955
}
944956
```
945957

958+
### graph/closed
959+
960+
```typescript
961+
{
962+
[`context.${string}`]: string | number | boolean,
963+
'context.webview.host': 'editor' | 'view',
964+
'context.webview.id': string,
965+
'context.webview.instanceId': string,
966+
'context.webview.type': string
967+
}
968+
```
969+
946970
### graph/columns/changed
947971

948972
> Sent when the user changes the columns on the Commit Graph
@@ -1185,6 +1209,18 @@ or
11851209
}
11861210
```
11871211

1212+
### graphDetails/closed
1213+
1214+
```typescript
1215+
{
1216+
[`context.${string}`]: string | number | boolean,
1217+
'context.webview.host': 'editor' | 'view',
1218+
'context.webview.id': string,
1219+
'context.webview.instanceId': string,
1220+
'context.webview.type': string
1221+
}
1222+
```
1223+
11881224
### graphDetails/mode/changed
11891225

11901226
> Sent when the user changes the selected tab (mode) on the Graph Details view
@@ -1310,6 +1346,18 @@ or
13101346
void
13111347
```
13121348

1349+
### home/closed
1350+
1351+
```typescript
1352+
{
1353+
[`context.${string}`]: string | number | boolean,
1354+
'context.webview.host': 'editor' | 'view',
1355+
'context.webview.id': string,
1356+
'context.webview.instanceId': string,
1357+
'context.webview.type': string
1358+
}
1359+
```
1360+
13131361
### home/command
13141362

13151363
> Sent when a Home command is executed
@@ -1735,6 +1783,18 @@ void
17351783
}
17361784
```
17371785

1786+
### patchDetails/closed
1787+
1788+
```typescript
1789+
{
1790+
[`context.${string}`]: string | number | boolean,
1791+
'context.webview.host': 'editor' | 'view',
1792+
'context.webview.id': string,
1793+
'context.webview.instanceId': string,
1794+
'context.webview.type': string
1795+
}
1796+
```
1797+
17381798
### patchDetails/showAborted
17391799

17401800
```typescript
@@ -1880,6 +1940,18 @@ void
18801940
}
18811941
```
18821942

1943+
### settings/closed
1944+
1945+
```typescript
1946+
{
1947+
[`context.${string}`]: string | number | boolean,
1948+
'context.webview.host': 'editor' | 'view',
1949+
'context.webview.id': string,
1950+
'context.webview.instanceId': string,
1951+
'context.webview.type': string
1952+
}
1953+
```
1954+
18831955
### settings/showAborted
18841956

18851957
```typescript
@@ -2169,6 +2241,18 @@ or
21692241
}
21702242
```
21712243

2244+
### timeline/closed
2245+
2246+
```typescript
2247+
{
2248+
[`context.${string}`]: string | number | boolean,
2249+
'context.webview.host': 'editor' | 'view',
2250+
'context.webview.id': string,
2251+
'context.webview.instanceId': string,
2252+
'context.webview.type': string
2253+
}
2254+
```
2255+
21722256
### timeline/commit/selected
21732257

21742258
> Sent when the user selects (clicks on) a commit on the Visual History

src/constants.telemetry.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export interface TelemetryGlobalContext extends SubscriptionEventData {
5151
'workspace.isTrusted': boolean;
5252
}
5353

54-
export interface TelemetryEvents extends WebviewShowAbortedEvents, WebviewShownEvents {
54+
export interface TelemetryEvents extends WebviewShowAbortedEvents, WebviewShownEvents, WebviewClosedEvents {
5555
/** Sent when account validation fails */
5656
'account/validation/failed': AccountValidationFailedEvent;
5757

@@ -307,6 +307,11 @@ type WebviewShownEvents = {
307307
>}/shown`]: WebviewShownEventData & Record<`context.${string}`, string | number | boolean | undefined>;
308308
};
309309

310+
type WebviewClosedEvents = {
311+
[K in `${WebviewTypes | WebviewViewTypes}/closed`]: WebviewContextEventData &
312+
Record<`context.${string}`, string | number | boolean | undefined>;
313+
};
314+
310315
type ConfigEventData = {
311316
[K in `config.${string}`]: string | number | boolean | null;
312317
};

src/webviews/webviewController.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ export class WebviewController<
227227
this.provider?.onFocusChanged?.(false);
228228
this.provider?.onVisibilityChanged?.(false);
229229

230+
const context = this.provider.getTelemetryContext?.() ?? this.getTelemetryContext();
231+
this.container.telemetry.sendEvent(`${this.descriptor.type}/closed`, context);
232+
230233
this._ready = false;
231234

232235
this._onDidDispose.fire();

0 commit comments

Comments
 (0)