From a35e2b93d6f427672b48a94b4dff681144241565 Mon Sep 17 00:00:00 2001 From: Andrew Liu <159852527+aliu39@users.noreply.github.com> Date: Fri, 27 Dec 2024 14:53:09 -0800 Subject: [PATCH] Make arg an options obj for forward compatibility --- .../integrations/featureFlags/openfeature/errorHook/init.js | 2 +- .../suites/integrations/featureFlags/openfeature/init.js | 2 +- packages/browser/src/index.ts | 2 +- .../src/integrations/featureFlags/openfeature/index.ts | 2 +- .../integrations/featureFlags/openfeature/integration.ts | 6 +++++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dev-packages/browser-integration-tests/suites/integrations/featureFlags/openfeature/errorHook/init.js b/dev-packages/browser-integration-tests/suites/integrations/featureFlags/openfeature/errorHook/init.js index 606717d69dd7..8e96c186503f 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/featureFlags/openfeature/errorHook/init.js +++ b/dev-packages/browser-integration-tests/suites/integrations/featureFlags/openfeature/errorHook/init.js @@ -16,7 +16,7 @@ window.openFeatureClient = { }; window.Sentry = Sentry; -window.sentryOpenFeatureIntegration = Sentry.openFeatureIntegration(window.openFeatureClient); +window.sentryOpenFeatureIntegration = Sentry.openFeatureIntegration({openFeatureClient: window.openFeatureClient}); Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', diff --git a/dev-packages/browser-integration-tests/suites/integrations/featureFlags/openfeature/init.js b/dev-packages/browser-integration-tests/suites/integrations/featureFlags/openfeature/init.js index fdad88250cb7..78a4812b3489 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/featureFlags/openfeature/init.js +++ b/dev-packages/browser-integration-tests/suites/integrations/featureFlags/openfeature/init.js @@ -16,7 +16,7 @@ window.openFeatureClient = { }; window.Sentry = Sentry; -window.sentryOpenFeatureIntegration = Sentry.openFeatureIntegration(window.openFeatureClient); +window.sentryOpenFeatureIntegration = Sentry.openFeatureIntegration({openFeatureClient: window.openFeatureClient}); Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', diff --git a/packages/browser/src/index.ts b/packages/browser/src/index.ts index 907361601498..b1c3826962a4 100644 --- a/packages/browser/src/index.ts +++ b/packages/browser/src/index.ts @@ -74,4 +74,4 @@ export { type FeatureFlagsIntegration, } from './integrations/featureFlags'; export { launchDarklyIntegration, buildLaunchDarklyFlagUsedHandler } from './integrations/featureFlags/launchdarkly'; -export { openFeatureIntegration } from './integrations/featureFlags/openfeature'; +export { openFeatureIntegration, type OpenFeatureIntegrationOptions } from './integrations/featureFlags/openfeature'; diff --git a/packages/browser/src/integrations/featureFlags/openfeature/index.ts b/packages/browser/src/integrations/featureFlags/openfeature/index.ts index 9c14fad73798..4b1ecee94ae6 100644 --- a/packages/browser/src/integrations/featureFlags/openfeature/index.ts +++ b/packages/browser/src/integrations/featureFlags/openfeature/index.ts @@ -1 +1 @@ -export { openFeatureIntegration } from './integration'; +export { openFeatureIntegration, type OpenFeatureIntegrationOptions } from './integration'; diff --git a/packages/browser/src/integrations/featureFlags/openfeature/integration.ts b/packages/browser/src/integrations/featureFlags/openfeature/integration.ts index 1cf2f4ba4579..52133c6d4665 100644 --- a/packages/browser/src/integrations/featureFlags/openfeature/integration.ts +++ b/packages/browser/src/integrations/featureFlags/openfeature/integration.ts @@ -11,7 +11,11 @@ import type { EvaluationDetails, HookContext, HookHints, JsonValue, OpenFeatureC import { defineIntegration } from '@sentry/core'; import { copyFlagsFromScopeToEvent, insertFlagToScope } from '../../../utils/featureFlags'; -export const openFeatureIntegration = defineIntegration((openFeatureClient: OpenFeatureClient) => { +export type OpenFeatureIntegrationOptions = { + openFeatureClient: OpenFeatureClient; +}; + +export const openFeatureIntegration = defineIntegration(({openFeatureClient}: OpenFeatureIntegrationOptions) => { return { name: 'OpenFeature',