@backstage/core-app-api 1.1.0-next.1 → 1.1.0-next.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # @backstage/core-app-api
2
2
 
3
+ ## 1.1.0-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - f9ec4e46e3: When using React Router v6 stable, it is now possible for components within the `Route` element tree to have `path` props, although they will be ignored.
8
+ - 667d917488: Updated dependency `msw` to `^0.47.0`.
9
+ - 87ec2ba4d6: Updated dependency `msw` to `^0.46.0`.
10
+ - e9d40ebf54: If you'd like to send analytics events to multiple implementations, you may now
11
+ do so using the `MultipleAnalyticsApi` implementation provided by this package.
12
+
13
+ ```tsx
14
+ import { MultipleAnalyticsApi } from '@backstage/core-app-api';
15
+ import {
16
+ analyticsApiRef,
17
+ configApiRef,
18
+ storageApiRef,
19
+ identityApiRef,
20
+ } from '@internal/backstage/core-plugin-api';
21
+ import { CustomAnalyticsApi } from '@internal/analytics';
22
+ import { VendorAnalyticsApi } from '@vendor/analytics';
23
+
24
+ createApiFactory({
25
+ api: analyticsApiRef,
26
+ deps: { configApi: configApiRef, identityApi: identityApiRef, storageApi: storageApiRef },
27
+ factory: ({ configApi, identityApi, storageApi }) =>
28
+ MultipleAnalyticsApi.fromApis([
29
+ VendorAnalyticsApi.fromConfig(configApi, { identityApi }),
30
+ CustomAnalyticsApi.fromConfig(configApi, { identityApi, storageApi }),
31
+ ]),
32
+ }),
33
+ ```
34
+
35
+ - Updated dependencies
36
+ - @backstage/core-plugin-api@1.0.6-next.2
37
+
3
38
  ## 1.1.0-next.1
4
39
 
5
40
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -276,6 +276,49 @@ declare class AlertApiForwarder implements AlertApi {
276
276
  alert$(): Observable<AlertMessage>;
277
277
  }
278
278
 
279
+ /**
280
+ * An implementation of the AnalyticsApi that can be used to forward analytics
281
+ * events to multiple concrete implementations.
282
+ *
283
+ * @public
284
+ *
285
+ * @example
286
+ *
287
+ * ```jsx
288
+ * createApiFactory({
289
+ * api: analyticsApiRef,
290
+ * deps: { configApi: configApiRef, identityApi: identityApiRef, storageApi: storageApiRef },
291
+ * factory: ({ configApi, identityApi, storageApi }) =>
292
+ * MultipleAnalyticsApi.fromApis([
293
+ * VendorAnalyticsApi.fromConfig(configApi, { identityApi }),
294
+ * CustomAnalyticsApi.fromConfig(configApi, { identityApi, storageApi }),
295
+ * ]),
296
+ * });
297
+ * ```
298
+ */
299
+ declare class MultipleAnalyticsApi implements AnalyticsApi {
300
+ private readonly actualApis;
301
+ private constructor();
302
+ /**
303
+ * Create an AnalyticsApi implementation from an array of concrete
304
+ * implementations.
305
+ *
306
+ * @example
307
+ *
308
+ * ```jsx
309
+ * MultipleAnalyticsApi.fromApis([
310
+ * SomeAnalyticsApi.fromConfig(configApi),
311
+ * new CustomAnalyticsApi(),
312
+ * ]);
313
+ * ```
314
+ */
315
+ static fromApis(actualApis: AnalyticsApi[]): MultipleAnalyticsApi;
316
+ /**
317
+ * Forward the event to all configured analytics API implementations.
318
+ */
319
+ captureEvent(event: AnalyticsEvent): void;
320
+ }
321
+
279
322
  /**
280
323
  * Base implementation for the AnalyticsApi that does nothing.
281
324
  *
@@ -859,4 +902,4 @@ declare type FeatureFlaggedProps = {
859
902
  */
860
903
  declare const FeatureFlagged: (props: FeatureFlaggedProps) => JSX.Element;
861
904
 
862
- export { AlertApiForwarder, ApiFactoryHolder, ApiFactoryRegistry, ApiFactoryScope, ApiProvider, ApiProviderProps, ApiResolver, AppComponents, AppConfigLoader, AppContext, AppIcons, AppOptions, AppRouteBinder, AppThemeSelector, AtlassianAuth, AuthApiCreateOptions, BackstageApp, BitbucketAuth, BitbucketSession, BootErrorPageProps, ErrorAlerter, ErrorApiForwarder, ErrorBoundaryFallbackProps, FeatureFlagged, FeatureFlaggedProps, FetchMiddleware, FetchMiddlewares, FlatRoutes, FlatRoutesProps, GithubAuth, GitlabAuth, GoogleAuth, LocalStorageFeatureFlags, MicrosoftAuth, NoOpAnalyticsApi, OAuth2, OAuth2CreateOptions, OAuth2Session, OAuthApiCreateOptions, OAuthRequestManager, OktaAuth, OneLoginAuth, OneLoginAuthCreateOptions, SamlAuth, SignInPageProps, UnhandledErrorForwarder, UrlPatternDiscovery, WebStorage, createFetchApi, createSpecializedApp, defaultConfigLoader };
905
+ export { AlertApiForwarder, ApiFactoryHolder, ApiFactoryRegistry, ApiFactoryScope, ApiProvider, ApiProviderProps, ApiResolver, AppComponents, AppConfigLoader, AppContext, AppIcons, AppOptions, AppRouteBinder, AppThemeSelector, AtlassianAuth, AuthApiCreateOptions, BackstageApp, BitbucketAuth, BitbucketSession, BootErrorPageProps, ErrorAlerter, ErrorApiForwarder, ErrorBoundaryFallbackProps, FeatureFlagged, FeatureFlaggedProps, FetchMiddleware, FetchMiddlewares, FlatRoutes, FlatRoutesProps, GithubAuth, GitlabAuth, GoogleAuth, LocalStorageFeatureFlags, MicrosoftAuth, MultipleAnalyticsApi, NoOpAnalyticsApi, OAuth2, OAuth2CreateOptions, OAuth2Session, OAuthApiCreateOptions, OAuthRequestManager, OktaAuth, OneLoginAuth, OneLoginAuthCreateOptions, SamlAuth, SignInPageProps, UnhandledErrorForwarder, UrlPatternDiscovery, WebStorage, createFetchApi, createSpecializedApp, defaultConfigLoader };
package/dist/index.esm.js CHANGED
@@ -1172,6 +1172,23 @@ class AlertApiForwarder {
1172
1172
  }
1173
1173
  }
1174
1174
 
1175
+ class MultipleAnalyticsApi {
1176
+ constructor(actualApis) {
1177
+ this.actualApis = actualApis;
1178
+ }
1179
+ static fromApis(actualApis) {
1180
+ return new MultipleAnalyticsApi(actualApis);
1181
+ }
1182
+ captureEvent(event) {
1183
+ this.actualApis.forEach((analyticsApi) => {
1184
+ try {
1185
+ analyticsApi.captureEvent(event);
1186
+ } catch {
1187
+ }
1188
+ });
1189
+ }
1190
+ }
1191
+
1175
1192
  class NoOpAnalyticsApi {
1176
1193
  captureEvent(_event) {
1177
1194
  }
@@ -1762,11 +1779,6 @@ function collectSubTree(node, entries = new Array()) {
1762
1779
  if (!isValidElement(element)) {
1763
1780
  return;
1764
1781
  }
1765
- if (element.props.path) {
1766
- throw new Error(
1767
- `Elements within the element prop tree may not have paths, found "${element.props.path}"`
1768
- );
1769
- }
1770
1782
  const routeRef = getComponentData(element, "core.mountPoint");
1771
1783
  if (routeRef) {
1772
1784
  const plugin = getComponentData(element, "core.plugin");
@@ -1784,6 +1796,12 @@ const routingV2Collector = createCollector(
1784
1796
  }),
1785
1797
  (acc, node, parent, ctx) => {
1786
1798
  var _a, _b, _c, _d, _e, _f;
1799
+ if (ctx == null ? void 0 : ctx.isElementAncestor) {
1800
+ return ctx;
1801
+ }
1802
+ if ((parent == null ? void 0 : parent.props.element) === node) {
1803
+ return { ...ctx, isElementAncestor: true };
1804
+ }
1787
1805
  const pathProp = (_a = node.props) == null ? void 0 : _a.path;
1788
1806
  const mountPoint = getComponentData(node, "core.mountPoint");
1789
1807
  if (mountPoint && pathProp) {
@@ -1793,12 +1811,6 @@ const routingV2Collector = createCollector(
1793
1811
  )}"`
1794
1812
  );
1795
1813
  }
1796
- if (ctx == null ? void 0 : ctx.isElementAncestor) {
1797
- return ctx;
1798
- }
1799
- if ((parent == null ? void 0 : parent.props.element) === node) {
1800
- return { ...ctx, isElementAncestor: true };
1801
- }
1802
1814
  const parentChildren = (_c = (_b = ctx == null ? void 0 : ctx.obj) == null ? void 0 : _b.children) != null ? _c : acc.objects;
1803
1815
  if (pathProp !== void 0) {
1804
1816
  if (typeof pathProp !== "string") {
@@ -2867,5 +2879,5 @@ const FlatRoutes = (props) => {
2867
2879
  return useRoutes(withNotFound);
2868
2880
  };
2869
2881
 
2870
- export { AlertApiForwarder, ApiFactoryRegistry, ApiProvider, ApiResolver, AppThemeSelector, AtlassianAuth, BitbucketAuth, ErrorAlerter, ErrorApiForwarder, FeatureFlagged, FetchMiddlewares, FlatRoutes, GithubAuth, GitlabAuth, GoogleAuth, LocalStorageFeatureFlags, MicrosoftAuth, NoOpAnalyticsApi, OAuth2, OAuthRequestManager, OktaAuth, OneLoginAuth, SamlAuth, UnhandledErrorForwarder, UrlPatternDiscovery, WebStorage, createFetchApi, createSpecializedApp, defaultConfigLoader };
2882
+ export { AlertApiForwarder, ApiFactoryRegistry, ApiProvider, ApiResolver, AppThemeSelector, AtlassianAuth, BitbucketAuth, ErrorAlerter, ErrorApiForwarder, FeatureFlagged, FetchMiddlewares, FlatRoutes, GithubAuth, GitlabAuth, GoogleAuth, LocalStorageFeatureFlags, MicrosoftAuth, MultipleAnalyticsApi, NoOpAnalyticsApi, OAuth2, OAuthRequestManager, OktaAuth, OneLoginAuth, SamlAuth, UnhandledErrorForwarder, UrlPatternDiscovery, WebStorage, createFetchApi, createSpecializedApp, defaultConfigLoader };
2871
2883
  //# sourceMappingURL=index.esm.js.map