Files
klz-cables.com/.pnpm-store/v10/files/c7/96d59d38d35320ec0ee9cf59f958a4137ad693ccb6f541cbf48934599826e272ac9428add04c3c29eb35fc9ec4433428af1c1e300629019a9fd90553281dc2
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

69 lines
1.9 KiB
Plaintext

Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const integration = require('../../integration.js');
const featureFlags = require('../../utils/featureFlags.js');
const object = require('../../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 = integration.defineIntegration(
({ growthbookClass }) => {
return {
name: 'GrowthBook',
setupOnce() {
const proto = growthbookClass.prototype ;
// Type guard and wrap isOn
if (typeof proto.isOn === 'function') {
object.fill(proto, 'isOn', _wrapAndCaptureBooleanResult);
}
// Type guard and wrap getFeatureValue
if (typeof proto.getFeatureValue === 'function') {
object.fill(proto, 'getFeatureValue', _wrapAndCaptureBooleanResult);
}
},
processEvent(event, _hint, _client) {
return featureFlags._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') {
featureFlags._INTERNAL_insertFlagToScope(flagName, result);
featureFlags._INTERNAL_addFeatureFlagToActiveSpan(flagName, result);
}
return result;
};
}
exports.growthbookIntegration = growthbookIntegration;
//# sourceMappingURL=growthbook.js.map