@@ -3,7 +3,6 @@ import { CreateRequestFunction, MigrationState } from './types/internal'
3
3
import StorageManager from './StorageManager'
4
4
import Constants from './Constants'
5
5
import ArgsBuilder from './ArgsBuilder'
6
- import shajs from 'sha.js'
7
6
8
7
type Region = 'eu1' | 'in1' | 'sg1' | 'us1' | 'sk1' ;
9
8
@@ -244,7 +243,6 @@ export enum IdentityState {
244
243
245
244
export class IdentityManager {
246
245
private state : IdentityState = IdentityState . ANONYMOUS
247
- private anonymousLoginUserId : string
248
246
249
247
constructor (
250
248
private userId : string ,
@@ -255,7 +253,6 @@ export class IdentityManager {
255
253
256
254
public setUserId ( userId : string ) : void {
257
255
if ( this . state === IdentityState . ANONYMOUS ) {
258
- this . anonymousLoginUserId = userId
259
256
this . state = IdentityState . IDENTIFIED
260
257
}
261
258
this . userId = userId
@@ -270,33 +267,14 @@ export class IdentityManager {
270
267
}
271
268
272
269
public identifyNonAnonymous ( ) : void {
273
- if ( this . state === IdentityState . ANONYMOUS ) {
274
- this . anonymousLoginUserId = this . userId
275
- }
276
270
this . state = IdentityState . IDENTIFIED
277
271
}
278
272
279
- public get cleverTapID ( ) : string {
280
- if ( this . userId !== this . anonymousLoginUserId && ! this . isAnonymous ) {
281
- const sha = this . sha256 ( this . userId )
282
-
283
- return `${ this . deviceId } _${ sha } `
284
- }
285
-
286
- return this . deviceId
287
- }
288
-
289
273
public get profile ( ) : { [ key : string ] : string } {
290
274
return { Identity : this . userId }
291
275
}
292
276
293
277
public get isAnonymous ( ) : boolean {
294
278
return this . userId === this . deviceId
295
279
}
296
-
297
- private sha256 ( s : string ) : string {
298
- const sha = new shajs . sha256 ( ) . update ( s ) . digest ( 'hex' )
299
-
300
- return sha . substring ( 0 , 10 )
301
- }
302
280
}
0 commit comments