Patch GrowthBook and set feature callback
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
diff --git a/node_modules/@growthbook/growthbook/dist/GrowthBook.d.ts b/node_modules/@growthbook/growthbook/dist/GrowthBook.d.ts
|
||||
index ec532b0..d96a5f1 100644
|
||||
--- a/node_modules/@growthbook/growthbook/dist/GrowthBook.d.ts
|
||||
+++ b/node_modules/@growthbook/growthbook/dist/GrowthBook.d.ts
|
||||
@@ -1,4 +1,4 @@
|
||||
-import type { ApiHost, Attributes, AutoExperiment, AutoExperimentVariation, ClientKey, Options, Experiment, FeatureApiResponse, FeatureDefinition, FeatureResult, LoadFeaturesOptions, RefreshFeaturesOptions, RenderFunction, Result, SubscriptionFunction, TrackingCallback, TrackingData, WidenPrimitives, InitOptions, InitResponse, InitSyncOptions, PrefetchOptions, StickyAssignmentsDocument, EventLogger, LogUnion, DestroyOptions } from "./types/growthbook";
|
||||
+import type { ApiHost, Attributes, AutoExperiment, AutoExperimentVariation, ClientKey, Options, Experiment, FeatureApiResponse, FeatureDefinition, FeatureResult, FeatureUsageCallback, LoadFeaturesOptions, RefreshFeaturesOptions, RenderFunction, Result, SubscriptionFunction, TrackingCallback, TrackingData, WidenPrimitives, InitOptions, InitResponse, InitSyncOptions, PrefetchOptions, StickyAssignmentsDocument, EventLogger, LogUnion, DestroyOptions } from "./types/growthbook";
|
||||
import { StickyBucketServiceSync } from "./sticky-bucket-service";
|
||||
export declare class GrowthBook<AppFeatures extends Record<string, any> = Record<string, any>> {
|
||||
private context;
|
||||
@@ -106,6 +106,7 @@ export declare class GrowthBook<AppFeatures extends Record<string, any> = Record
|
||||
setDeferredTrackingCalls(calls: TrackingData[]): void;
|
||||
fireDeferredTrackingCalls(): Promise<void>;
|
||||
setTrackingCallback(callback: TrackingCallback): void;
|
||||
+ setFeatureUsageCallback(callback: FeatureUsageCallback): void;
|
||||
setEventLogger(logger: EventLogger): void;
|
||||
logEvent(eventName: string, properties?: Record<string, unknown>): Promise<void>;
|
||||
private _saveDeferredTrack;
|
||||
diff --git a/node_modules/@growthbook/growthbook/dist/esm/GrowthBook.mjs b/node_modules/@growthbook/growthbook/dist/esm/GrowthBook.mjs
|
||||
index e0847f0..4bcc20f 100644
|
||||
--- a/node_modules/@growthbook/growthbook/dist/esm/GrowthBook.mjs
|
||||
+++ b/node_modules/@growthbook/growthbook/dist/esm/GrowthBook.mjs
|
||||
@@ -682,6 +682,9 @@ export class GrowthBook {
|
||||
this._options.trackingCallback = callback;
|
||||
this.fireDeferredTrackingCalls();
|
||||
}
|
||||
+ setFeatureUsageCallback(callback) {
|
||||
+ this._options.onFeatureUsage = callback;
|
||||
+ }
|
||||
setEventLogger(logger) {
|
||||
this._options.eventLogger = logger;
|
||||
}
|
||||
diff --git a/node_modules/@growthbook/growthbook/src/GrowthBook.ts b/node_modules/@growthbook/growthbook/src/GrowthBook.ts
|
||||
index 907fc97..e59201c 100644
|
||||
--- a/node_modules/@growthbook/growthbook/src/GrowthBook.ts
|
||||
+++ b/node_modules/@growthbook/growthbook/src/GrowthBook.ts
|
||||
@@ -16,6 +16,7 @@ import type {
|
||||
Result,
|
||||
SubscriptionFunction,
|
||||
TrackingCallback,
|
||||
+ FeatureUsageCallback,
|
||||
TrackingData,
|
||||
WidenPrimitives,
|
||||
EvalContext,
|
||||
@@ -952,6 +953,10 @@ export class GrowthBook<
|
||||
this.fireDeferredTrackingCalls();
|
||||
}
|
||||
|
||||
+ public setFeatureUsageCallback(callback: FeatureUsageCallback) {
|
||||
+ this._options.onFeatureUsage = callback;
|
||||
+ }
|
||||
+
|
||||
public setEventLogger(logger: EventLogger) {
|
||||
this._options.eventLogger = logger;
|
||||
}
|
||||
Reference in New Issue
Block a user