diff --git a/plugins/analytics-provider-segment/package.json b/plugins/analytics-provider-segment/package.json index a885adf3d2..55e3694a12 100644 --- a/plugins/analytics-provider-segment/package.json +++ b/plugins/analytics-provider-segment/package.json @@ -10,11 +10,12 @@ "types": "dist/index.d.ts" }, "backstage": { - "role": "frontend-plugin-module" + "role": "frontend-plugin" }, "scripts": { "start": "backstage-cli package start", "build": "backstage-cli package build", + "export-dynamic": "janus-cli package export-dynamic-plugin", "tsc": "tsc", "lint": "backstage-cli package lint", "test": "backstage-cli package test --passWithNoTests --coverage", @@ -44,6 +45,7 @@ "@backstage/core-app-api": "1.11.0", "@backstage/dev-utils": "1.0.22", "@backstage/test-utils": "1.4.4", + "@janus-idp/cli": "1.4.3", "@testing-library/dom": "9.3.3", "@testing-library/jest-dom": "5.17.0", "@testing-library/react": "12.1.5", @@ -55,6 +57,7 @@ }, "files": [ "dist", + "dist-scalprum", "config.d.ts" ], "configSchema": "config.d.ts" diff --git a/plugins/analytics-provider-segment/src/index.ts b/plugins/analytics-provider-segment/src/index.ts index 787a901636..8c282718a5 100644 --- a/plugins/analytics-provider-segment/src/index.ts +++ b/plugins/analytics-provider-segment/src/index.ts @@ -13,5 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { + analyticsApiRef, + configApiRef, + createApiFactory, + identityApiRef, +} from '@backstage/core-plugin-api'; + +import { SegmentAnalytics } from './apis/implementations/AnalyticsApi'; + export { analyticsModuleSegment } from './plugin'; export * from './apis/implementations/AnalyticsApi'; +export const SegmentAnalyticsApi = createApiFactory({ + api: analyticsApiRef, + deps: { configApi: configApiRef, identityApi: identityApiRef }, + factory: ({ configApi, identityApi }) => + SegmentAnalytics.fromConfig(configApi, identityApi), +});