Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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/core/optimizely_config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export class OptimizelyConfig {
public events: OptimizelyEvent[];
private datafile: string;


constructor(configObj: ProjectConfig, datafile: string, logger?: LoggerFacade) {
this.sdkKey = configObj.sdkKey ?? '';
this.environmentKey = configObj.environmentKey ?? '';
Expand Down
14 changes: 14 additions & 0 deletions lib/core/project_config/index.ts
Comment thread
raju-opti marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ interface Event {
key: string;
id: string;
experimentsIds: string[];

// the field is named experimentIds in the datafile, but this type previously defined it as experimentsIds.
// keeping both to avoid breaking changes, removed experimentsIds in v6.
experimentIds: string[]; // fix typo in property name (https://github.com/optimizely/javascript-sdk/issues/991)
}

interface VariableUsageMap {
Expand Down Expand Up @@ -142,6 +146,16 @@ export const createProjectConfig = function(datafileObj?: JSON, datafileStr: str

projectConfig.__datafileStr = datafileStr === null ? JSON.stringify(datafileObj) : datafileStr;

// Copy experimentIds to experimentsIds in each event to fix typo in property name
// https://github.com/optimizely/javascript-sdk/issues/991
if (!projectConfig.events) {
projectConfig.events = [];
}

projectConfig.events.forEach(event => {
event.experimentsIds = event.experimentIds;
Comment thread
junaed-optimizely marked this conversation as resolved.
Outdated
});

/*
* Conditions of audiences in projectConfig.typedAudiences are not
* expected to be string-encoded as they are here in projectConfig.audiences.
Expand Down
6 changes: 5 additions & 1 deletion lib/shared_types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2020-2024, Optimizely
* Copyright 2020-2025, Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -469,6 +469,10 @@ export type OptimizelyEvent = {
id: string;
key: string;
experimentsIds: string[];

// the field is named experimentIds in the datafile, but this type previously defined it as experimentsIds.
// keeping both to avoid breaking changes, removed experimentsIds in v6.
experimentIds: string[]; // fix typo in property name (https://github.com/optimizely/javascript-sdk/issues/991)
};

export interface OptimizelyFeature {
Expand Down
Loading