Skip to content

Commit 28cc23b

Browse files
committed
[FSSDK-12242] support UNSTABLE_conditionEvaluators option
1 parent c1af6da commit 28cc23b

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

lib/client_factory.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2025, Optimizely
2+
* Copyright 2025-2026, Optimizely
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ import { extractOdpManager } from "./odp/odp_manager_factory";
2222
import { extractVuidManager } from "./vuid/vuid_manager_factory";
2323
import { RequestHandler } from "./utils/http_request_handler/http";
2424
import { CLIENT_VERSION, DEFAULT_CMAB_BACKOFF_MS, DEFAULT_CMAB_CACHE_SIZE, DEFAULT_CMAB_CACHE_TIMEOUT_MS, DEFAULT_CMAB_RETRIES, JAVASCRIPT_CLIENT_ENGINE } from "./utils/enums";
25-
import Optimizely from "./optimizely";
25+
import Optimizely, { OptimizelyOptions } from "./optimizely";
2626
import { DefaultCmabClient } from "./core/decision_service/cmab/cmab_client";
2727
import { CmabCacheValue, DefaultCmabService } from "./core/decision_service/cmab/cmab_service";
2828
import { InMemoryLruCache } from "./utils/cache/in_memory_lru_cache";
@@ -76,7 +76,7 @@ export const getOptimizelyInstance = (config: OptimizelyFactoryConfig): Optimize
7676
logger: logger?.child()
7777
});
7878

79-
const optimizelyOptions = {
79+
const optimizelyOptions: OptimizelyOptions = {
8080
cmabService,
8181
clientEngine: clientEngine || JAVASCRIPT_CLIENT_ENGINE,
8282
clientVersion: clientVersion || CLIENT_VERSION,
@@ -91,6 +91,9 @@ export const getOptimizelyInstance = (config: OptimizelyFactoryConfig): Optimize
9191
eventProcessor,
9292
odpManager,
9393
vuidManager,
94+
// UNSTABLE_conditionEvaluators is not exposed in the public types, but we want to pass it through
95+
// for internal use cases.
96+
UNSTABLE_conditionEvaluators: (config as any).UNSTABLE_conditionEvaluators,
9497
};
9598

9699
return new Optimizely(optimizelyOptions);

lib/core/decision_service/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2017-2022, 2024-2025, Optimizely
2+
* Copyright 2017-2022, 2024-2026, Optimizely
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -158,6 +158,8 @@ export type DecideOptionsMap = Partial<Record<OptimizelyDecideOption, boolean>>;
158158

159159
export const CMAB_DUMMY_ENTITY_ID= '$'
160160

161+
export const LOGGER_NAME = 'DecisionService';
162+
161163
/**
162164
* Optimizely's decision service that determines which variation of an experiment the user will be allocated to.
163165
*
@@ -183,6 +185,7 @@ export class DecisionService {
183185

184186
constructor(options: DecisionServiceOptions) {
185187
this.logger = options.logger;
188+
this.logger?.setName(LOGGER_NAME);
186189
this.audienceEvaluator = createAudienceEvaluator(options.UNSTABLE_conditionEvaluators, this.logger);
187190
this.forcedVariationMap = {};
188191
this.userProfileService = options.userProfileService;

lib/optimizely/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2020-2025, Optimizely
2+
* Copyright 2020-2026, Optimizely
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -242,7 +242,7 @@ export default class Optimizely extends BaseService implements Client {
242242
userProfileService: userProfileService,
243243
userProfileServiceAsync: config.userProfileServiceAsync || undefined,
244244
cmabService: config.cmabService,
245-
logger: this.logger,
245+
logger: this.logger?.child(),
246246
UNSTABLE_conditionEvaluators: config.UNSTABLE_conditionEvaluators,
247247
});
248248

0 commit comments

Comments
 (0)