@forge/bridge
6.1.1-next.16.1.1-next.2
out/featureFlags/featureFlags.js~
out/featureFlags/featureFlags.jsModified−18
Index: package/out/featureFlags/featureFlags.js
===================================================================
--- package/out/featureFlags/featureFlags.js
+++ package/out/featureFlags/featureFlags.js
@@ -1,15 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FeatureFlags = void 0;
const evaluator_1 = require("./evaluator");
-const featureFlagEvents_1 = require("./featureFlagEvents");
const initFeatureFlags_1 = require("./initFeatureFlags");
-const types_1 = require("./types");
class FeatureFlags {
constructor() {
this.initialized = false;
- this.eventProps = {};
}
/**
* Initialize the feature flags client
*/
@@ -19,9 +16,8 @@
}
if (!(config === null || config === void 0 ? void 0 : config.environment)) {
config.environment = 'development';
}
- this.eventProps.environment = config.environment;
const result = await (0, initFeatureFlags_1.initFeatureFlags)({ user, config });
this.initialized = true;
this.evaluator = new evaluator_1.Evaluator(result);
}
@@ -29,12 +25,10 @@
* Check if a feature flag is enabled for the user
*/
checkFlag(flagName, defaultValue = false) {
if (!this.isInitialized() || !this.evaluator) {
- this.sendCheckFlagEvent(flagName, false);
throw new Error('FeatureFlags not initialized. Call initialize() first.');
}
- this.sendCheckFlagEvent(flagName, true);
return this.evaluator.checkFlag(flagName, defaultValue);
}
/**
* Shutdown the feature flags client
@@ -48,18 +42,6 @@
}
isInitialized() {
return this.initialized;
}
- sendCheckFlagEvent(flagName, success) {
- const props = {
- type: types_1.FeatureFlagEventType.CHECKFLAG,
- properties: {
- ...this.eventProps,
- environment: this.eventProps.environment || 'development',
- name: flagName,
- success
- }
- };
- void (0, featureFlagEvents_1.trackFeatureFlagEvent)(props);
- }
}
exports.FeatureFlags = FeatureFlags;