-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ld to dependencies and skeleton code. Get rid of core/
- Loading branch information
Showing
5 changed files
with
53 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
// This file is used as entry point to generate the npm package and CDN bundles. | ||
|
||
// export { sendFeedback } from './core/sendFeedback'; | ||
// export { buildFeedbackIntegration } from './core/integration'; | ||
// export { getFeedback } from './core/getFeedback'; | ||
// export { feedbackModalIntegration } from './modal/integration'; | ||
// export { feedbackScreenshotIntegration } from './screenshot/integration'; | ||
export { launchDarklyIntegration } from './integration'; | ||
|
||
export { buildLaunchDarklyIntegration } from './core/integration'; | ||
// export type { | ||
// } from './types'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import type { IntegrationFn } from '@sentry/types'; | ||
import type { LDInspectionFlagUsedHandler } from 'launchdarkly-js-client-sdk'; | ||
import type { LaunchDarklyOptions } from './types'; | ||
|
||
/** | ||
* Sentry integration for capturing feature flags from LaunchDarkly. | ||
* | ||
* See the [feature flag documentation](TODO:) for more information. | ||
* | ||
* @example | ||
* | ||
* ``` | ||
* Sentry.init({ | ||
* dsn: '__DSN__', | ||
* integrations: [Sentry.replayIntegration()], | ||
* }); | ||
* ``` | ||
*/ | ||
export const launchDarklyIntegration = ((options?: LaunchDarklyOptions) => { | ||
const { ldClient } = options; | ||
|
||
return { | ||
name: 'launchdarkly', | ||
|
||
setup(client) { | ||
// type is Sentry SDK client | ||
|
||
// pseudo-code | ||
ldClient.addHandler(FlagUsedHandler()); | ||
}, | ||
}; | ||
}) satisfies IntegrationFn; | ||
|
||
// https://launchdarkly.github.io/js-client-sdk/interfaces/LDInspectionFlagUsedHandler.html //TODO: rm this link | ||
class FlagUsedHandler implements LDInspectionFlagUsedHandler { | ||
public name = 'sentry-feature-flag-monitor'; // eslint-disable-line @sentry-internal/sdk/no-class-field-initializers | ||
public synchronous?: boolean; | ||
public type = 'flag-used' as const; // eslint-disable-line @sentry-internal/sdk/no-class-field-initializers | ||
public method(flagKey, flagDetail, context) { | ||
//TODO: | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
// Integration options | ||
// TODO: could we just put everything in a types.ts file? | ||
|
||
// Integration interface? | ||
import type { LDClient } from 'launchdarkly-js-client-sdk'; | ||
|
||
export type LaunchDarklyOptions = { | ||
ldClient: LDClient; | ||
}; |