Skip to content

[FSSDK-11101] cleanup OptimizelyOptions type #997

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/export_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export {
Event,
EventDispatcher,
DatafileOptions,
OptimizelyOptions,
UserProfileService,
UserProfile,
ListenerPayload,
Expand Down
4 changes: 2 additions & 2 deletions lib/index.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import configValidator from './utils/config_validator';
import defaultEventDispatcher from './event_processor/event_dispatcher/default_dispatcher.browser';
import sendBeaconEventDispatcher from './event_processor/event_dispatcher/send_beacon_dispatcher.browser';
import * as enums from './utils/enums';
import { OptimizelyDecideOption, Client, Config, OptimizelyOptions } from './shared_types';
import { OptimizelyDecideOption, Client, Config } from './shared_types';
import Optimizely from './optimizely';
import { UserAgentParser } from './odp/ua_parser/user_agent_parser';
import { getUserAgentParser } from './odp/ua_parser/ua_parser.browser';
Expand Down Expand Up @@ -57,7 +57,7 @@ const createInstance = function(config: Config): Client | null {
logger = config.logger ? extractLogger(config.logger) : undefined;
const errorNotifier = config.errorNotifier ? extractErrorNotifier(config.errorNotifier) : undefined;

const optimizelyOptions: OptimizelyOptions = {
const optimizelyOptions = {
...config,
clientEngine: clientEngine || enums.JAVASCRIPT_CLIENT_ENGINE,
clientVersion: clientVersion || enums.CLIENT_VERSION,
Expand Down
22 changes: 21 additions & 1 deletion lib/optimizely/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
Variation,
FeatureFlag,
FeatureVariable,
OptimizelyOptions,
OptimizelyDecideOption,
FeatureVariableValue,
OptimizelyDecision,
Expand Down Expand Up @@ -111,6 +110,27 @@ type StringInputs = Partial<Record<InputKey, unknown>>;

type DecisionReasons = (string | number)[];

/**
* options required to create optimizely object
*/
export type OptimizelyOptions = {
projectConfigManager: ProjectConfigManager;
UNSTABLE_conditionEvaluators?: unknown;
clientEngine: string;
clientVersion?: string;
errorNotifier?: ErrorNotifier;
eventProcessor?: EventProcessor;
jsonSchemaValidator?: {
validate(jsonObject: unknown): boolean;
};
logger?: LoggerFacade;
userProfileService?: UserProfileService | null;
defaultDecideOptions?: OptimizelyDecideOption[];
odpManager?: OdpManager;
vuidManager?: VuidManager
disposable?: boolean;
}

export default class Optimizely implements Client {
private disposeOnUpdate?: Fn;
private readyPromise: Promise<unknown>;
Expand Down
26 changes: 0 additions & 26 deletions lib/shared_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,32 +248,6 @@ export enum OptimizelyDecideOption {
EXCLUDE_VARIABLES = 'EXCLUDE_VARIABLES',
}

/**
* options required to create optimizely object
*/
export interface OptimizelyOptions {
projectConfigManager: ProjectConfigManager;
UNSTABLE_conditionEvaluators?: unknown;
clientEngine: string;
clientVersion?: string;
// TODO[OASIS-6649]: Don't use object type
// eslint-disable-next-line @typescript-eslint/ban-types
datafile?: string | object;
datafileManager?: DatafileManager;
errorNotifier?: ErrorNotifier;
eventProcessor?: EventProcessor;
jsonSchemaValidator?: {
validate(jsonObject: unknown): boolean;
};
logger?: LoggerFacade;
sdkKey?: string;
userProfileService?: UserProfileService | null;
defaultDecideOptions?: OptimizelyDecideOption[];
odpManager?: OdpManager;
vuidManager?: VuidManager
disposable?: boolean;
}

/**
* Optimizely Config Entities
*/
Expand Down
Loading