-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathindex.universal.ts
More file actions
136 lines (112 loc) · 3.99 KB
/
index.universal.ts
File metadata and controls
136 lines (112 loc) · 3.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/**
* Copyright 2025, 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
*
* https://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 { Client, Config } from './shared_types';
import { getOptimizelyInstance } from './client_factory';
import { JAVASCRIPT_CLIENT_ENGINE } from './utils/enums';
import { RequestHandler } from './utils/http_request_handler/http';
export type UniversalConfig = Config & {
requestHandler: RequestHandler;
}
/**
* Creates an instance of the Optimizely class
* @param {Config} config
* @return {Client|null} the Optimizely client object
* null on error
*/
export const createInstance = function(config: UniversalConfig): Client {
return getOptimizelyInstance(config);
};
export { createEventDispatcher } from './event_processor/event_dispatcher/event_dispatcher_factory';
export { createPollingProjectConfigManager } from './project_config/config_manager_factory.universal';
export { createForwardingEventProcessor, createBatchEventProcessor } from './event_processor/event_processor_factory.universal';
export { createOdpManager } from './odp/odp_manager_factory.universal';
// TODO: decide on vuid manager API for universal
// export { createVuidManager } from './vuid/vuid_manager_factory.node';
export * from './common_exports';
export const clientEngine: string = JAVASCRIPT_CLIENT_ENGINE;
// type exports
export type { RequestHandler } from './utils/http_request_handler/http';
// config manager related types
export type {
StaticConfigManagerConfig,
OpaqueConfigManager,
} from './project_config/config_manager_factory';
export type { UniversalPollingConfigManagerConfig } from './project_config/config_manager_factory.universal';
// event processor related types
export type {
LogEvent,
EventDispatcherResponse,
EventDispatcher,
} from './event_processor/event_dispatcher/event_dispatcher';
export type { UniversalBatchEventProcessorOptions } from './event_processor/event_processor_factory.universal';
// odp manager related types
export type {
UniversalOdpManagerOptions,
} from './odp/odp_manager_factory.universal';
export type {
UserAgentParser,
} from './odp/ua_parser/user_agent_parser';
export type {
OpaqueEventProcessor,
} from './event_processor/event_processor_factory';
// Logger related types
export type {
LogHandler,
} from './logging/logger';
export type {
OpaqueLevelPreset,
LoggerConfig,
OpaqueLogger,
} from './logging/logger_factory';
// Error related types
export type { ErrorHandler } from './error/error_handler';
export type { OpaqueErrorNotifier } from './error/error_notifier_factory';
export type { Cache } from './utils/cache/cache';
export type {
NotificationType,
NotificationPayload,
ActivateListenerPayload as ActivateNotificationPayload,
DecisionListenerPayload as DecisionNotificationPayload,
TrackListenerPayload as TrackNotificationPayload,
LogEventListenerPayload as LogEventNotificationPayload,
OptimizelyConfigUpdateListenerPayload as OptimizelyConfigUpdateNotificationPayload,
} from './notification_center/type';
export type {
UserAttributeValue,
UserAttributes,
OptimizelyConfig,
FeatureVariableValue,
OptimizelyVariable,
OptimizelyVariation,
OptimizelyExperiment,
OptimizelyFeature,
OptimizelyDecisionContext,
OptimizelyForcedDecision,
EventTags,
Event,
DatafileOptions,
UserProfileService,
UserProfile,
ListenerPayload,
OptimizelyDecision,
OptimizelyUserContext,
Config,
Client,
ActivateListenerPayload,
TrackListenerPayload,
NotificationCenter,
OptimizelySegmentOption,
} from './shared_types';