From b872cb2cdf6e48c92f895473f4731bbb995e3a8f Mon Sep 17 00:00:00 2001 From: Nicky Bondarenko Date: Tue, 26 Nov 2024 15:20:04 +0100 Subject: [PATCH] feat: add link to web view into debug9 --- packages/sdk/src/Confidence.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/sdk/src/Confidence.ts b/packages/sdk/src/Confidence.ts index 12c52a4..900308e 100644 --- a/packages/sdk/src/Confidence.ts +++ b/packages/sdk/src/Confidence.ts @@ -56,6 +56,8 @@ export interface Configuration { /** Flag Resolver Client * @internal */ readonly flagResolverClient: FlagResolverClient; + /* @internal */ + readonly clientSecret: string; } /** @@ -311,7 +313,13 @@ export class Confidence implements EventSender, Trackable, FlagResolver { getFlag(path: string, defaultValue: number): Promise; getFlag(path: string, defaultValue: T): Promise; async getFlag(path: string, defaultValue: any): Promise { - return (await this.evaluateFlag(path, defaultValue)).value; + const clientKey = this.config.clientSecret; + const flag = (await this.evaluateFlag(path, defaultValue)).value; + const context = this._context; + this.config.logger.debug?.( + `Resolve debug: https://app.confidence.spotify.com/flags/resolver-test?client-key=${clientKey}&flag=flags/${flag}&context=${context}`, + ); + return flag; } /** @@ -374,6 +382,7 @@ export class Confidence implements EventSender, Trackable, FlagResolver { eventSenderEngine, timeout, logger, + clientSecret, }); } }