-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathinit.js
More file actions
37 lines (30 loc) · 954 Bytes
/
init.js
File metadata and controls
37 lines (30 loc) · 954 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import * as Sentry from '@sentry/browser';
// Minimal mock GrowthBook class for tests
window.GrowthBook = class {
constructor() {
this._onFlags = Object.create(null);
this._featureValues = Object.create(null);
}
isOn(featureKey) {
return !!this._onFlags[featureKey];
}
getFeatureValue(featureKey, defaultValue) {
return Object.prototype.hasOwnProperty.call(this._featureValues, featureKey)
? this._featureValues[featureKey]
: defaultValue;
}
// Helpers for tests
__setOn(featureKey, value) {
this._onFlags[featureKey] = !!value;
}
__setFeatureValue(featureKey, value) {
this._featureValues[featureKey] = value;
}
};
window.Sentry = Sentry;
window.sentryGrowthBookIntegration = Sentry.growthbookIntegration({ growthbookClass: window.GrowthBook });
Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
sampleRate: 1.0,
integrations: [window.sentryGrowthBookIntegration],
});