Files
klz-cables.com/.pnpm-store/v10/files/0a/9ee3565337aef49859b298cac4ef769fea998f33cc55be8e15328da2a3d1bf59e5be88194de16772d0b635495d2df7579d0c8f30a12208f30a7df7716a50f3
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

67 lines
1.8 KiB
Plaintext

import { defineIntegration } from '../../integration.js';
import { _INTERNAL_copyFlagsFromScopeToEvent, _INTERNAL_insertFlagToScope, _INTERNAL_addFeatureFlagToActiveSpan } from '../../utils/featureFlags.js';
import { fill } from '../../utils/object.js';
/**
* Sentry integration for capturing feature flag evaluations from GrowthBook.
*
* Only boolean results are captured at this time.
*
* @example
* ```typescript
* import { GrowthBook } from '@growthbook/growthbook';
* import * as Sentry from '@sentry/browser'; // or '@sentry/node'
*
* Sentry.init({
* dsn: 'your-dsn',
* integrations: [
* Sentry.growthbookIntegration({ growthbookClass: GrowthBook })
* ]
* });
* ```
*/
const growthbookIntegration = defineIntegration(
({ growthbookClass }) => {
return {
name: 'GrowthBook',
setupOnce() {
const proto = growthbookClass.prototype ;
// Type guard and wrap isOn
if (typeof proto.isOn === 'function') {
fill(proto, 'isOn', _wrapAndCaptureBooleanResult);
}
// Type guard and wrap getFeatureValue
if (typeof proto.getFeatureValue === 'function') {
fill(proto, 'getFeatureValue', _wrapAndCaptureBooleanResult);
}
},
processEvent(event, _hint, _client) {
return _INTERNAL_copyFlagsFromScopeToEvent(event);
},
};
},
);
function _wrapAndCaptureBooleanResult(
original,
) {
return function ( ...args) {
const flagName = args[0];
const result = original.apply(this, args);
if (typeof flagName === 'string' && typeof result === 'boolean') {
_INTERNAL_insertFlagToScope(flagName, result);
_INTERNAL_addFeatureFlagToActiveSpan(flagName, result);
}
return result;
};
}
export { growthbookIntegration };
//# sourceMappingURL=growthbook.js.map