refactor: move core analytics apis to the compat package
Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
'@backstage/frontend-plugin-api': minor
|
||||
---
|
||||
|
||||
**BREAKING**: Replace default plugin extension and plugin ids to be `app` instead of `root` and update the `MultipleAnalyticsApi` to support new Analytics API context type .
|
||||
**BREAKING**: Replace default plugin extension and plugin ids to be `app` instead of `root`.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
'@backstage/plugin-analytics-module-newrelic-browser': minor
|
||||
'@backstage/plugin-analytics-module-ga4': minor
|
||||
'@backstage/plugin-analytics-module-ga': minor
|
||||
'@backstage/core-compat-api': minor
|
||||
---
|
||||
|
||||
Add support to the new analytics api.
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { AnalyticsApi } from '@backstage/core-plugin-api';
|
||||
import { AnalyticsApi as AnalyticsApi_2 } from '@backstage/frontend-plugin-api';
|
||||
import { AnalyticsEvent } from '@backstage/core-plugin-api';
|
||||
import { AnalyticsEvent as AnalyticsEvent_2 } from '@backstage/frontend-plugin-api';
|
||||
import { AnyRouteRefParams } from '@backstage/core-plugin-api';
|
||||
import { ExternalRouteRef } from '@backstage/core-plugin-api';
|
||||
import { ExternalRouteRef as ExternalRouteRef_2 } from '@backstage/frontend-plugin-api';
|
||||
@@ -51,6 +55,20 @@ export function convertLegacyRouteRefs<
|
||||
[KName in keyof TRefs]: ToNewRouteRef<TRefs[KName]>;
|
||||
};
|
||||
|
||||
// @public
|
||||
export class MultipleAnalyticsApi implements AnalyticsApi, AnalyticsApi_2 {
|
||||
captureEvent(event: AnalyticsEvent | AnalyticsEvent_2): void;
|
||||
static fromApis(
|
||||
actualApis: (AnalyticsApi | AnalyticsApi_2)[],
|
||||
): MultipleAnalyticsApi;
|
||||
}
|
||||
|
||||
// @public
|
||||
export class NoOpAnalyticsApi implements AnalyticsApi, AnalyticsApi_2 {
|
||||
// (undocumented)
|
||||
captureEvent(_event: AnalyticsEvent | AnalyticsEvent_2): void;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type ToNewRouteRef<T extends RouteRef | SubRouteRef | ExternalRouteRef> =
|
||||
T extends RouteRef<infer IParams>
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import { AnalyticsApi, AnalyticsEvent } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
AnalyticsApi as NewAnalyicsApi,
|
||||
AnalyticsEvent as NewAnalyicsEvent,
|
||||
} from '../../definitions';
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
|
||||
/**
|
||||
* An implementation of the AnalyticsApi that can be used to forward analytics
|
||||
+1
-1
@@ -18,7 +18,7 @@ import { AnalyticsApi, AnalyticsEvent } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
AnalyticsApi as NewAnalyicsApi,
|
||||
AnalyticsEvent as NewAnalyicsEvent,
|
||||
} from '../../definitions';
|
||||
} from '@backstage/frontend-plugin-api';
|
||||
|
||||
/**
|
||||
* Base implementation for the AnalyticsApi that does nothing.
|
||||
+1
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020 The Backstage Authors
|
||||
* Copyright 2024 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,7 +14,4 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// This folder contains implementations for all core APIs.
|
||||
// Plugins should rely on these APIs for functionality as much as possible.
|
||||
|
||||
export * from './AnalyticsApi';
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2024 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './implementations';
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
export * from './compatWrapper';
|
||||
|
||||
export * from './apis';
|
||||
|
||||
export { convertLegacyApp } from './convertLegacyApp';
|
||||
export {
|
||||
convertLegacyRouteRef,
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
import { AlertApi } from '@backstage/core-plugin-api';
|
||||
import { alertApiRef } from '@backstage/core-plugin-api';
|
||||
import { AlertMessage } from '@backstage/core-plugin-api';
|
||||
import { AnalyticsApi as AnalyticsApi_2 } from '@backstage/core-plugin-api';
|
||||
import { AnalyticsEvent as AnalyticsEvent_2 } from '@backstage/core-plugin-api';
|
||||
import { AnyApiFactory } from '@backstage/core-plugin-api';
|
||||
import { AnyApiRef } from '@backstage/core-plugin-api';
|
||||
import { ApiFactory } from '@backstage/core-plugin-api';
|
||||
@@ -995,20 +993,6 @@ export { identityApiRef };
|
||||
|
||||
export { microsoftAuthApiRef };
|
||||
|
||||
// @public
|
||||
export class MultipleAnalyticsApi implements AnalyticsApi_2, AnalyticsApi {
|
||||
captureEvent(event: AnalyticsEvent_2 | AnalyticsEvent): void;
|
||||
static fromApis(
|
||||
actualApis: (AnalyticsApi_2 | AnalyticsApi)[],
|
||||
): MultipleAnalyticsApi;
|
||||
}
|
||||
|
||||
// @public
|
||||
export class NoOpAnalyticsApi implements AnalyticsApi_2, AnalyticsApi {
|
||||
// (undocumented)
|
||||
captureEvent(_event: AnalyticsEvent_2 | AnalyticsEvent): void;
|
||||
}
|
||||
|
||||
export { OAuthApi };
|
||||
|
||||
export { OAuthRequestApi };
|
||||
|
||||
@@ -15,5 +15,4 @@
|
||||
*/
|
||||
|
||||
export * from './definitions';
|
||||
export * from './implementations';
|
||||
export * from './system';
|
||||
|
||||
Reference in New Issue
Block a user