14
14
* limitations under the License.
15
15
*/
16
16
17
- import { LOG_MESSAGES } from './../../utils/enums/index' ;
18
- import { getLogger , LogHandler , LogLevel } from '../../modules/logging' ;
17
+ import { LogHandler , LogLevel } from '../../modules/logging' ;
19
18
import { ERROR_MESSAGES , ODP_USER_KEY } from '../../utils/enums' ;
20
19
21
20
import { VuidManager } from '../../plugins/vuid_manager' ;
@@ -46,8 +45,13 @@ export interface IOdpManager {
46
45
identifyUser ( userId ?: string , vuid ?: string ) : void ;
47
46
48
47
sendEvent ( { type, action, identifiers, data } : OdpEvent ) : void ;
48
+
49
+ registerVuid ( vuid : string ) : void ;
49
50
}
50
51
52
+ /**
53
+ * Possible statuses for the OdpManager
54
+ */
51
55
export enum Status {
52
56
Running ,
53
57
Stopped ,
@@ -68,7 +72,10 @@ export abstract class OdpManager implements IOdpManager {
68
72
*/
69
73
private configPromise : ResolvablePromise < void > ;
70
74
71
- status : Status = Status . Stopped ;
75
+ /**
76
+ * The current status of the ODP Manager
77
+ */
78
+ private status : Status = Status . Stopped ;
72
79
73
80
/**
74
81
* ODP Segment Manager which provides an interface to the remote ODP server (GraphQL API) for audience segments mapping.
@@ -91,9 +98,8 @@ export abstract class OdpManager implements IOdpManager {
91
98
/**
92
99
* ODP configuration settings for identifying the target API and segments
93
100
*/
94
- odpIntegrationConfig ?: OdpIntegrationConfig ;
101
+ protected odpIntegrationConfig ?: OdpIntegrationConfig ;
95
102
96
- // TODO: Consider accepting logger as a parameter and initializing it in constructor instead
97
103
constructor ( {
98
104
odpIntegrationConfig,
99
105
segmentManager,
@@ -123,10 +129,23 @@ export abstract class OdpManager implements IOdpManager {
123
129
}
124
130
}
125
131
126
- public getStatus ( ) : Status {
132
+ /**
133
+ * Register a VUID with the ODP Manager in client side context
134
+ * @param {string } vuid - Unique identifier of an anonymous vistor
135
+ */
136
+ abstract registerVuid ( vuid : string ) : void ;
137
+
138
+ /**
139
+ * @returns {Status } The current status of the ODP Manager
140
+ */
141
+ getStatus ( ) : Status {
127
142
return this . status ;
128
143
}
129
144
145
+ /**
146
+ * Starts the ODP Manager
147
+ * @returns {Promise<void> } A promise that resolves when starting has completed
148
+ */
130
149
async start ( ) : Promise < void > {
131
150
if ( this . status === Status . Running ) {
132
151
return ;
@@ -147,6 +166,10 @@ export abstract class OdpManager implements IOdpManager {
147
166
return Promise . resolve ( ) ;
148
167
}
149
168
169
+ /**
170
+ * Stops the ODP Manager
171
+ * @returns A promise that resolves when stopping has completed
172
+ */
150
173
async stop ( ) : Promise < void > {
151
174
if ( this . status === Status . Stopped ) {
152
175
return ;
@@ -218,7 +241,7 @@ export abstract class OdpManager implements IOdpManager {
218
241
/**
219
242
* Identifies a user via the ODP Event Manager
220
243
* @param {string } userId (Optional) Custom unique identifier of a target user.
221
- * @param {string } vuid (Optional) Secondary unique identifier of a target user, primarily used by client SDKs.
244
+ * @param {string } vuid (Optional) Secondary unique identifier of a target user, used by client SDKs.
222
245
* @returns
223
246
*/
224
247
identifyUser ( userId ?: string , vuid ?: string ) : void {
0 commit comments