Skip to content

Commit c293ab4

Browse files
authored
add method to clear anon data (#480)
1 parent 0c0fd2d commit c293ab4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/authorization/authorization.ts

+10
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export interface WithJWT {
5757
logout: () => void;
5858
refreshJwtToken: (authTypes: string) => Promise<string>;
5959
setVisitorUsageTracked: (consent: boolean) => void;
60+
clearVisitorEventsAndUserData: () => void;
6061
}
6162

6263
export interface WithoutJWT {
@@ -66,6 +67,7 @@ export interface WithoutJWT {
6667
setUserID: (userId: string, identityResolution?: IdentityResolution) => Promise<void>;
6768
logout: () => void;
6869
setVisitorUsageTracked: (consent: boolean) => void;
70+
clearVisitorEventsAndUserData: () => void;
6971
}
7072

7173
export const setAnonUserId = async (userId: string) => {
@@ -568,6 +570,10 @@ export function initialize(
568570
}
569571
localStorage.setItem(SHARED_PREF_ANON_USAGE_TRACKED, 'false');
570572
}
573+
},
574+
clearVisitorEventsAndUserData: () => {
575+
anonUserManager.removeAnonSessionCriteriaData();
576+
clearAnonymousUser();
571577
}
572578
};
573579
}
@@ -988,6 +994,10 @@ export function initialize(
988994
}
989995
localStorage.setItem(SHARED_PREF_ANON_USAGE_TRACKED, 'false');
990996
}
997+
},
998+
clearVisitorEventsAndUserData: () => {
999+
anonUserManager.removeAnonSessionCriteriaData();
1000+
clearAnonymousUser();
9911001
}
9921002
};
9931003
}

0 commit comments

Comments
 (0)