Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a961147
saving
raju-opti Aug 22, 2024
eb9110c
saving
raju-opti Aug 27, 2024
f88fd9f
up
raju-opti Aug 27, 2024
c406523
fix test
raju-opti Aug 28, 2024
de99436
fix more tests
raju-opti Aug 29, 2024
ef85d65
fix tests
raju-opti Aug 29, 2024
580a0b6
saving
raju-opti Aug 30, 2024
7940193
saving
raju-opti Sep 2, 2024
08636b7
emitter test
raju-opti Sep 3, 2024
f1a68e4
save
raju-opti Sep 4, 2024
5439eb2
fix more test
raju-opti Sep 5, 2024
2ff16c9
fix tests
raju-opti Sep 5, 2024
a5305f9
fix tests
raju-opti Sep 5, 2024
9c6e8ee
fix
raju-opti Sep 6, 2024
2441875
update
raju-opti Sep 9, 2024
3755d24
update
raju-opti Sep 9, 2024
2d25fd5
update
raju-opti Sep 9, 2024
a086e62
saving
raju-opti Sep 10, 2024
c705ccb
add tests
raju-opti Sep 10, 2024
3c8a57c
add test
raju-opti Sep 10, 2024
b276b7e
tests
raju-opti Sep 11, 2024
cae172f
update
raju-opti Sep 13, 2024
53ccf3e
update
raju-opti Sep 13, 2024
8dea409
tests
raju-opti Sep 17, 2024
f57c315
add more tests
raju-opti Sep 17, 2024
1643628
add tests
raju-opti Sep 18, 2024
b41f28f
update
raju-opti Sep 18, 2024
0098fc2
update
raju-opti Sep 18, 2024
5758a9b
tests
raju-opti Sep 18, 2024
a71fdd9
add more tests
raju-opti Sep 19, 2024
5a29def
add tests
raju-opti Sep 19, 2024
fcbef0d
update name
raju-opti Sep 19, 2024
acf7bcf
remove notification registry
raju-opti Sep 19, 2024
4a98a6d
fix repeater test
raju-opti Sep 19, 2024
a24e263
fixes
raju-opti Sep 19, 2024
d27b3b1
updates
raju-opti Sep 20, 2024
3cc4e7c
update
raju-opti Sep 20, 2024
515696e
update
raju-opti Sep 20, 2024
f92b56f
update
raju-opti Sep 20, 2024
56ebf5e
update
raju-opti Sep 20, 2024
a877e9d
upd
raju-opti Sep 20, 2024
c2fbc70
exclude spec from build
raju-opti Sep 20, 2024
19877a2
private
raju-opti Sep 20, 2024
ef4879d
update
raju-opti Sep 27, 2024
0b8c06d
update
raju-opti Sep 27, 2024
c483d85
updating
raju-opti Sep 27, 2024
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
Prev Previous commit
Next Next commit
saving
  • Loading branch information
raju-opti committed Sep 27, 2024
commit a086e620dba3ac910c4b27aff064d7988df38306
2 changes: 2 additions & 0 deletions lib/common_exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
export { LogLevel, LogHandler, getLogger, setLogHandler } from './modules/logging';
export { LOG_LEVEL } from './utils/enums';
export { createLogger } from './plugins/logger';
export { createStaticProjectConfigManager } from './project_config/config_manager_factory';
export { PollingConfigManagerConfig } from './project_config/config_manager_factory';
2 changes: 1 addition & 1 deletion lib/core/decision_service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
getVariationKeyFromId,
isActive,
ProjectConfig,
} from '../project_config';
} from '../../project_config';
import { AudienceEvaluator, createAudienceEvaluator } from '../audience_evaluator';
import * as stringValidator from '../../utils/string_value_validator';
import {
Expand Down
2 changes: 1 addition & 1 deletion lib/core/event_builder/event_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
getEventId,
getLayerId,
ProjectConfig,
} from '../project_config';
} from '../../project_config';

const logger = getLogger('EVENT_BUILDER');

Expand Down
2 changes: 1 addition & 1 deletion lib/core/event_builder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
getLayerId,
getVariationKeyFromId,
ProjectConfig,
} from '../project_config';
} from '../../project_config';
import * as eventTagUtils from '../../utils/event_tag_utils';
import { isAttributeValid } from '../../utils/attributes_validator';
import { EventTags, UserAttributes, Event as EventLoggingEndpoint } from '../../shared_types';
Expand Down
2 changes: 1 addition & 1 deletion lib/core/optimizely_config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
import { LoggerFacade, getLogger } from '../../modules/logging';
import { ProjectConfig } from '../project_config';
import { ProjectConfig } from '../../project_config';
import { DEFAULT_OPERATOR_TYPES } from '../condition_tree_evaluator';
import {
Audience,
Expand Down
5 changes: 4 additions & 1 deletion lib/index.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ import eventProcessorConfigValidator from './utils/event_processor_config_valida
import { createNotificationCenter } from './core/notification_center';
import { default as eventProcessor } from './plugins/event_processor';
import { OptimizelyDecideOption, Client, Config, OptimizelyOptions } from './shared_types';
import { createHttpPollingDatafileManager } from './plugins/datafile_manager/browser_http_polling_datafile_manager';
import { BrowserOdpManager } from './plugins/odp_manager/index.browser';
import Optimizely from './optimizely';
import { IUserAgentParser } from './core/odp/user_agent_parser';
import { getUserAgentParser } from './plugins/odp/user_agent_parser/index.browser';
import * as commonExports from './common_exports';
import { PollingConfigManagerConfig } from './project_config/config_manager_factory';
import { createPollingProjectConfigManager } from './project_config/config_manager_factory.browser';

const logger = getLogger();
logHelper.setLogHandler(loggerPlugin.createLogger());
Expand Down Expand Up @@ -198,6 +199,7 @@ export {
OptimizelyDecideOption,
IUserAgentParser,
getUserAgentParser,
createPollingProjectConfigManager,
};

export * from './common_exports';
Expand All @@ -215,6 +217,7 @@ export default {
__internalResetRetryState,
OptimizelyDecideOption,
getUserAgentParser,
createPollingProjectConfigManager,
};

export * from './export_types';
4 changes: 3 additions & 1 deletion lib/index.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import eventProcessorConfigValidator from './utils/event_processor_config_valida
import { createNotificationCenter } from './core/notification_center';
import { createEventProcessor } from './plugins/event_processor';
import { OptimizelyDecideOption, Client, Config } from './shared_types';
import { createHttpPollingDatafileManager } from './plugins/datafile_manager/http_polling_datafile_manager';
import { NodeOdpManager } from './plugins/odp_manager/index.node';
import * as commonExports from './common_exports';
import { createPollingProjectConfigManager } from './project_config/config_manager_factory.node';

const logger = getLogger();
setLogLevel(LogLevel.ERROR);
Expand Down Expand Up @@ -144,6 +144,7 @@ export {
setLogLevel,
createInstance,
OptimizelyDecideOption,
createPollingProjectConfigManager
};

export * from './common_exports';
Expand All @@ -158,6 +159,7 @@ export default {
setLogLevel,
createInstance,
OptimizelyDecideOption,
createPollingProjectConfigManager
};

export * from './export_types';
4 changes: 3 additions & 1 deletion lib/index.react_native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import eventProcessorConfigValidator from './utils/event_processor_config_valida
import { createNotificationCenter } from './core/notification_center';
import { createEventProcessor } from './plugins/event_processor/index.react_native';
import { OptimizelyDecideOption, Client, Config } from './shared_types';
import { createHttpPollingDatafileManager } from './plugins/datafile_manager/react_native_http_polling_datafile_manager';
import { BrowserOdpManager } from './plugins/odp_manager/index.browser';
import * as commonExports from './common_exports';
import { createPollingProjectConfigManager } from './project_config/config_manager_factory.react_native';

import 'fast-text-encoding';
import 'react-native-get-random-values';
Expand Down Expand Up @@ -154,6 +154,7 @@ export {
setLogLevel,
createInstance,
OptimizelyDecideOption,
createPollingProjectConfigManager,
};

export * from './common_exports';
Expand All @@ -168,6 +169,7 @@ export default {
setLogLevel,
createInstance,
OptimizelyDecideOption,
createPollingProjectConfigManager,
};

export * from './export_types';
28 changes: 14 additions & 14 deletions lib/modules/datafile-manager/browserDatafileManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
* limitations under the License.
*/

import { makeGetRequest } from './browserRequest';
import HttpPollingDatafileManager from './httpPollingDatafileManager';
import { Headers, AbortableRequest } from './http';
import { DatafileManagerConfig } from './datafileManager';
// import { makeGetRequest } from './browserRequest';
// import HttpPollingDatafileManager from './httpPollingDatafileManager';
// import { Headers, AbortableRequest } from './http';
// import { DatafileManagerConfig } from './datafileManager';

export default class BrowserDatafileManager extends HttpPollingDatafileManager {
protected makeGetRequest(reqUrl: string, headers: Headers): AbortableRequest {
return makeGetRequest(reqUrl, headers);
}
// export default class BrowserDatafileManager extends HttpPollingDatafileManager {
// protected makeGetRequest(reqUrl: string, headers: Headers): AbortableRequest {
// return makeGetRequest(reqUrl, headers);
// }

protected getConfigDefaults(): Partial<DatafileManagerConfig> {
return {
autoUpdate: false,
};
}
}
// protected getConfigDefaults(): Partial<DatafileManagerConfig> {
// return {
// autoUpdate: false,
// };
// }
// }
34 changes: 17 additions & 17 deletions lib/modules/datafile-manager/index.react_native.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/**
* Copyright 2022, Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// /**
// * Copyright 2022, Optimizely
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// * http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */

export * from './datafileManager';
export { default as HttpPollingDatafileManager } from './reactNativeDatafileManager';
// export * from './datafileManager';
// export { default as HttpPollingDatafileManager } from './reactNativeDatafileManager';
62 changes: 31 additions & 31 deletions lib/modules/datafile-manager/reactNativeDatafileManager.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
/**
* Copyright 2022, 2024, Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// /**
// * Copyright 2022, 2024, Optimizely
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// * http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */

import { makeGetRequest } from './browserRequest';
import HttpPollingDatafileManager from './httpPollingDatafileManager';
import { Headers, AbortableRequest } from './http';
import { DatafileManagerConfig } from './datafileManager';
import ReactNativeAsyncStorageCache from '../../plugins/key_value_cache/reactNativeAsyncStorageCache';
// import { makeGetRequest } from './browserRequest';
// import HttpPollingDatafileManager from './httpPollingDatafileManager';
// import { Headers, AbortableRequest } from './http';
// import { DatafileManagerConfig } from './datafileManager';
// import ReactNativeAsyncStorageCache from '../../plugins/key_value_cache/reactNativeAsyncStorageCache';

export default class ReactNativeDatafileManager extends HttpPollingDatafileManager {
protected makeGetRequest(reqUrl: string, headers: Headers): AbortableRequest {
return makeGetRequest(reqUrl, headers);
}
// export default class ReactNativeDatafileManager extends HttpPollingDatafileManager {
// protected makeGetRequest(reqUrl: string, headers: Headers): AbortableRequest {
// return makeGetRequest(reqUrl, headers);
// }

protected getConfigDefaults(): Partial<DatafileManagerConfig> {
return {
autoUpdate: true,
cache: new ReactNativeAsyncStorageCache(),
};
}
}
// protected getConfigDefaults(): Partial<DatafileManagerConfig> {
// return {
// autoUpdate: true,
// cache: new ReactNativeAsyncStorageCache(),
// };
// }
// }
4 changes: 2 additions & 2 deletions lib/optimizely/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ import {
import { newErrorDecision } from '../optimizely_decision';
import OptimizelyUserContext from '../optimizely_user_context';
// import { createProjectConfigManager, ProjectConfigManager } from '../core/project_config/project_config_manager';
import { ProjectConfigManager } from '../project_config__/project_config_manager';
import { ProjectConfigManager } from '../project_config/project_config_manager';
import { createDecisionService, DecisionService, DecisionObj } from '../core/decision_service';
import { getImpressionEvent, getConversionEvent } from '../core/event_builder';
import { buildImpressionEvent, buildConversionEvent } from '../core/event_builder/event_helpers';
import { NotificationRegistry } from '../core/notification_center/notification_registry';
import fns from '../utils/fns';
import { validate } from '../utils/attributes_validator';
import * as eventTagsValidator from '../utils/event_tags_validator';
import * as projectConfig from '../core/project_config';
import * as projectConfig from '../project_config';
import * as userProfileServiceValidator from '../utils/user_profile_service_validator';
import * as stringValidator from '../utils/string_value_validator';
import * as decision from '../core/decision';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
/**
* Copyright 2021-2022, 2024, Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { LoggerFacade } from '../../modules/logging';
import { HttpPollingDatafileManager } from '../../modules/datafile-manager/index.react_native';
import { DatafileOptions, DatafileManager, PersistentCacheProvider } from '../../shared_types';
import { DatafileManagerConfig } from '../../modules/datafile-manager/index.react_native';
import { toDatafile, tryCreatingProjectConfig } from '../../core/project_config';
import fns from '../../utils/fns';
// /**
// * Copyright 2021-2022, 2024, Optimizely
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// * http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
// import { LoggerFacade } from '../../modules/logging';
// import { HttpPollingDatafileManager } from '../../modules/datafile-manager/index.react_native';
// import { DatafileOptions, DatafileManager, PersistentCacheProvider } from '../../shared_types';
// import { DatafileManagerConfig } from '../../modules/datafile-manager/index.react_native';
// import { toDatafile, tryCreatingProjectConfig } from '../../core/project_config';
// import fns from '../../utils/fns';

export function createHttpPollingDatafileManager(
sdkKey: string,
logger: LoggerFacade,
// TODO[OASIS-6649]: Don't use object type
// eslint-disable-next-line @typescript-eslint/ban-types
datafile?: string | object,
datafileOptions?: DatafileOptions,
persistentCacheProvider?: PersistentCacheProvider,
): DatafileManager {
const datafileManagerConfig: DatafileManagerConfig = { sdkKey };
if (datafileOptions === undefined || (typeof datafileOptions === 'object' && datafileOptions !== null)) {
fns.assign(datafileManagerConfig, datafileOptions);
}
if (datafile) {
const { configObj, error } = tryCreatingProjectConfig({
datafile: datafile,
jsonSchemaValidator: undefined,
logger: logger,
});
// export function createHttpPollingDatafileManager(
// sdkKey: string,
// logger: LoggerFacade,
// // TODO[OASIS-6649]: Don't use object type
// // eslint-disable-next-line @typescript-eslint/ban-types
// datafile?: string | object,
// datafileOptions?: DatafileOptions,
// persistentCacheProvider?: PersistentCacheProvider,
// ): DatafileManager {
// const datafileManagerConfig: DatafileManagerConfig = { sdkKey };
// if (datafileOptions === undefined || (typeof datafileOptions === 'object' && datafileOptions !== null)) {
// fns.assign(datafileManagerConfig, datafileOptions);
// }
// if (datafile) {
// const { configObj, error } = tryCreatingProjectConfig({
// datafile: datafile,
// jsonSchemaValidator: undefined,
// logger: logger,
// });

if (error) {
logger.error(error);
}
if (configObj) {
datafileManagerConfig.datafile = toDatafile(configObj);
}
}
if (persistentCacheProvider) {
datafileManagerConfig.cache = persistentCacheProvider();
}
return new HttpPollingDatafileManager(datafileManagerConfig);
}
// if (error) {
// logger.error(error);
// }
// if (configObj) {
// datafileManagerConfig.datafile = toDatafile(configObj);
// }
// }
// if (persistentCacheProvider) {
// datafileManagerConfig.cache = persistentCacheProvider();
// }
// return new HttpPollingDatafileManager(datafileManagerConfig);
// }
Loading