1- import { SDKEvent , SDKEventCustomFlags } from './sdkRuntimeModels' ;
1+ import { SDKEvent , SDKEventCustomFlags , SDKInitConfig } from './sdkRuntimeModels' ;
22import { Dictionary } from './utils' ;
3- import { IKitConfigs } from './configAPIClient' ;
4- import { IdentityApiData } from '@mparticle/web-sdk' ;
3+ import { IFilteringConsentRuleValues , IFilteringEventAttributeValue , IFilteringUserAttributeValue , IKitConfigs , IKitFilterSettings } from './configAPIClient' ;
4+ import { Callback , IdentityApiData , Logger , UserIdentities } from '@mparticle/web-sdk' ;
55import {
66 IMParticleUser ,
7+ ISDKUserAttributes ,
78 ISDKUserIdentity ,
89 UserAttributes ,
910} from './identity-user-interfaces' ;
11+ import { IForwardingStatsData } from './apiClient' ;
12+ import { IPixelConfiguration } from './cookieSyncManager' ;
13+ import { IdentityAPIMethod } from './identity.interfaces' ;
14+ import { AsyncUploader } from './uploaders' ;
15+ import { IdentityType } from './types' ;
1016
1117// TODO: https://go.mparticle.com/work/SQDSDKS-6035
12- export type Kit = Dictionary ;
18+ export interface Kit {
19+ // constructor?: new () => IMPForwarder;
20+ constructor : ( ) => any ;
21+ name : string ;
22+ getId : ( ) => number , // Should this be optional?
23+ suffix ?: string ,
24+ } ;
25+
26+ // TODO: Get rid of this
1327export type MPForwarder = Dictionary ;
1428
1529// The state of the kit when accessed via window.KitName via CDN
1630// or imported as an NPM package
17- export interface UnregisteredKit {
31+ export interface UnregisteredKit {
32+ // FIXME: Consider renaming config to kit config?
1833 register ( config ) : void ;
34+ name : string ;
1935}
2036
2137// The state of the kit after being added to forwarderConstructors in the CDN
2238// or after registered to SDKConfig.kits via NPM
2339export interface RegisteredKit {
2440 constructor ( ) : void ;
41+ // suffix?: string;
2542 name : string ;
2643 getId ( ) : number ;
44+ filters : IKitFilterSettings ;
2745}
2846
2947// The state of the kit after being configured. This is what the kit looks like when acted on.
@@ -80,3 +98,109 @@ export type forwardingStatsCallback = (
8098 forwarder : ConfiguredKit ,
8199 event : SDKEvent
82100) => void ;
101+
102+
103+ export type UserIdentityFilters = typeof IdentityType [ ] ;
104+ export type UserAttributeFilters = string [ ] ;
105+
106+ interface ForwarderSettings {
107+ PriorityValue ?: number ;
108+ }
109+
110+ export interface IMPForwarder {
111+
112+ // @deprecated
113+ setForwarderUserIdentities : ( userIdentities : UserIdentities ) => void ;
114+
115+ setForwarderOnUserIdentified : ( user : IMParticleUser ) => void ;
116+ setForwarderOnIdentityComplete : ( user : IMParticleUser , identityMethod : IdentityAPIMethod ) => void ;
117+ handleForwarderUserAttributes : ( functionNameKey : string , key : string , value : string ) => void ;
118+ id : number ;
119+ settings : ForwarderSettings ;
120+ forwarderStatsUploader : AsyncUploader ;
121+ isInitialized : boolean ;
122+ filteringConsentRuleValues : IFilteringConsentRuleValues ;
123+ filteringUserAttributeValue : IFilteringUserAttributeValue ;
124+ filteringEventAttributeValue : IFilteringEventAttributeValue ;
125+ excludeAnonymousUser : boolean ;
126+ userIdentityFilters : UserIdentityFilters ;
127+ userAttributeFilters : UserAttributeFilters ;
128+ initialized : boolean ;
129+ logger : Logger ;
130+
131+ suffix ?: string ;
132+
133+ eventSubscriptionId : number ;
134+
135+ eventNameFilters : number [ ] ;
136+ eventTypeFilters : number [ ] ;
137+ attributeFilters : number [ ] ;
138+
139+ screenNameFilters : number [ ] ;
140+ screenAttributeFilters : number [ ] ;
141+
142+
143+ // Side loaded kit functioanlity in Forwarder methods
144+ kitInstance : UnregisteredKit ;
145+
146+ // https://go.mparticle.com/work/SQDSDKS-5156
147+ isSandbox ?: boolean ;
148+ hasSandbox ?: boolean ;
149+ isVisible ?: boolean ;
150+
151+ configureSideloadedKit : ( kitConstructor : RegisteredKit ) => void ;
152+
153+ sendSingleForwardingStatsToServer : ( forwardingStatsData : IForwardingStatsData ) => void ;
154+ applyToForwarders : ( functionName : string , functionArgs : any [ ] ) => void ;
155+ sendEventToForwarders : ( event : SDKEvent ) => void ;
156+ processPixelConfigs : ( pixelConfigs : SDKInitConfig ) => void ;
157+ configurePixel : ( pixelConfig : IPixelConfiguration ) => void ;
158+ returnConfiguredKit : ( forwarder : RegisteredKit , config : IKitConfigs ) => IMPForwarder ;
159+
160+ processSideloadedKits : ( mpConfig : SDKInitConfig ) => void ;
161+
162+ init : (
163+ setting : ForwarderSettings ,
164+ forwarderSettingsCallback : Callback ,
165+ testMode : boolean ,
166+ trackerId : string | number | null ,
167+ filteredUserAttributes : ISDKUserAttributes ,
168+ filteredUserIdentities : ISDKUserIdentity [ ] ,
169+ appVersion : string ,
170+ appName : string ,
171+ customFlags : SDKEventCustomFlags ,
172+ clientId : string
173+ ) => void ;
174+
175+ initForwarders : ( userIdentities : UserIdentities , forwarderStatsCallback : Callback ) => void ;
176+ isEnabledForUserAttributes : ( filterObject ?: IFilteringUserAttributeValue , user ?: IMParticleUser ) => boolean ;
177+ isEnabledForUnknownUser : ( excludeAnonymousUserBoolean : boolean , user : IMParticleUser ) => boolean ;
178+
179+ process ?: ( event : SDKEvent ) => string | void ;
180+ name ?: string ;
181+ setUserAttribute ?: ( key : string , value : string ) => string | void ;
182+ removeUserAttribute ?: ( key : string ) => string | void ;
183+ setUserIdentity ?: ( identity : string , type : number ) => string | void ;
184+
185+ // Techically these do not return a value, but we sometimes
186+ // debug message as a string
187+ onUserIdentified ?: ( user : IMParticleUser , identityApiData ?: IdentityApiData ) => string ;
188+ onIdentifyComplete ?: ( user : IMParticleUser , identityApiData : IdentityApiData ) => string ;
189+ onLoginComplete ?: ( user : IMParticleUser , identityApiData : IdentityApiData ) => string ;
190+ onLogoutComplete ?: ( user : IMParticleUser , identityApiData : IdentityApiData ) => string ;
191+ onModifyComplete ?: ( user : IMParticleUser , identityApiData : IdentityApiData ) => string ;
192+ setOptOut : ( optOut : boolean ) => string ;
193+
194+ getForwarderStatsQueue : ( ) => IForwardingStatsData [ ] ;
195+ setForwarderStatsQueue : ( queue : IForwardingStatsData [ ] ) => void ;
196+ processForwarders : ( config : SDKInitConfig , forwardingStatsCallback : Callback ) => void ;
197+ processUIEnabledKits : ( config : SDKInitConfig ) => void ;
198+ returnKitConstructors : ( ) => Dictionary < RegisteredKit > ;
199+ configureUIEnabledKit : ( config : IKitConfigs , kitConstructor : Dictionary < RegisteredKit > ) => void ;
200+
201+ getKitConstructors : ( ) => RegisteredKit [ ] ;
202+ getKitInstance : ( kitName : string ) => UnregisteredKit ;
203+ getKitInstanceByConstructor : ( kitConstructor : RegisteredKit ) => UnregisteredKit ;
204+ getKitInstanceByConstructorName : ( kitConstructorName : string ) => UnregisteredKit ;
205+ getKitInstanceByConstructorSuffix : ( kitConstructorSuffix : string ) => UnregisteredKit ;
206+ }
0 commit comments