@@ -4,12 +4,6 @@ import {
44 ExperimentAnalyticsProvider ,
55} from '../types/provider' ;
66import { ExperimentUser } from '../types/user' ;
7- import { safeGlobal } from '../util/global' ;
8-
9- declare global {
10- // eslint-disable-next-line no-var, @typescript-eslint/no-explicit-any
11- var amplitude : any ;
12- }
137
148type AmplitudeIdentify = {
159 set ( property : string , value : unknown ) : void ;
@@ -20,6 +14,12 @@ type AmplitudeInstance = {
2014 options ?: AmplitudeOptions ;
2115 _ua ?: AmplitudeUAParser ;
2216 logEvent ( eventName : string , properties : Record < string , string > ) : void ;
17+ _logEvent (
18+ eventType : string ,
19+ eventProperties : Record < string , unknown > ,
20+ apiProperties : Record < string , unknown > ,
21+ userProperties : Record < string , unknown > ,
22+ ) ;
2323 setUserProperties ( userProperties : Record < string , unknown > ) : void ;
2424 identify ( identify : AmplitudeIdentify ) : void ;
2525} ;
@@ -102,8 +102,8 @@ export class AmplitudeAnalyticsProvider implements ExperimentAnalyticsProvider {
102102
103103 unsetUserProperty ( event : ExperimentAnalyticsEvent ) : void {
104104 // if the variant does not have a value, unset the user property
105- this . amplitudeInstance . identify (
106- new safeGlobal . amplitude . Identify ( ) . unset ( event . userProperty ) ,
107- ) ;
105+ this . amplitudeInstance . _logEvent ( '$identify' , null , null , {
106+ $ unset: { [ event . userProperty ] : '-' } ,
107+ } ) ;
108108 }
109109}
0 commit comments