Skip to content

Commit bf8e322

Browse files
Address PR Comments
1 parent 1cdf758 commit bf8e322

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

src/mp-instance.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import { removeExpiredIdentityCacheDates } from './identity-utils';
4242
import IntegrationCapture from './integrationCapture';
4343
import { IPreInit, processReadyQueue } from './pre-init-utils';
4444
import { BaseEvent, MParticleWebSDK, SDKHelpersApi, } from './sdkRuntimeModels';
45-
import { Callback, SDKEventAttrs } from '@mparticle/web-sdk';
45+
import { Callback, Dictionary, SDKEventAttrs } from '@mparticle/web-sdk';
4646
import { IIdentity } from './identity.interfaces';
4747
import { IEvents } from './events.interfaces';
4848
import { IECommerce } from './ecommerce.interfaces';
@@ -61,7 +61,7 @@ export interface IErrorLogMessageMinified {
6161
t?: string;
6262
}
6363

64-
export type IntegrationDelays = { [key: number]: boolean };
64+
export type IntegrationDelays = Dictionary<boolean>;
6565

6666
// https://go.mparticle.com/work/SQDSDKS-6949
6767
export interface IMParticleWebSDKInstance extends MParticleWebSDK {
@@ -73,7 +73,7 @@ export interface IMParticleWebSDKInstance extends MParticleWebSDK {
7373
_Consent: IConsent;
7474
_Ecommerce: IECommerce;
7575
_Events: IEvents;
76-
_Forwarders: any;
76+
_Forwarders: any; // https://go.mparticle.com/work/SQDSDKS-5767
7777
_ForwardingStatsUploader: ForwardingStatsUploader;
7878
_Helpers: SDKHelpersApi;
7979
_Identity: IIdentity;
@@ -630,7 +630,7 @@ export default function mParticleInstance(this: IMParticleWebSDKInstance, instan
630630
{
631631
messageType: MessageType.PageView,
632632
name: eventName,
633-
data: attrs as { [key: string]: string },
633+
data: attrs as SDKEventAttrs,
634634
eventType: EventType.Unknown,
635635
customFlags: customFlags,
636636
},

src/sdkRuntimeModels.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
SDKEventAttrs,
99
Callback,
1010
} from '@mparticle/web-sdk';
11-
import { IntegrationAttribute, IStore, WrapperSDKTypes } from './store';
11+
import { IntegrationAttribute, IntegrationAttributes, IStore, WrapperSDKTypes } from './store';
1212
import Validators from './validators';
1313
import { Dictionary, valueof } from './utils';
1414
import { IKitConfigs } from './configAPIClient';
@@ -69,7 +69,7 @@ export interface SDKEvent {
6969
AppName?: string;
7070
Package?: string;
7171
ConsentState?: SDKConsentState;
72-
IntegrationAttributes?: { [key: string]: { [key: string]: string } };
72+
IntegrationAttributes?: IntegrationAttributes;
7373
ProductAction?: SDKProductAction;
7474
PromotionAction?: SDKPromotionAction;
7575
ProductImpressions?: SDKProductImpression[];
@@ -205,15 +205,20 @@ export interface MParticleWebSDK {
205205
setOptOut(isOptingOut: boolean): void;
206206
eCommerce: SDKECommerceAPI;
207207

208-
// QUESTION: Is this still used?
209-
// logLevel: string;
208+
isInitialized(): boolean;
209+
210+
ready(f: Function): void;
211+
reset(instance: IMParticleWebSDKInstance): void;
212+
setAppName(name: string): void;
213+
setAppVersion(version: string): void;
214+
setOptOut(isOptingOut: boolean): void;
215+
startTrackingLocation(callback?: Callback): void;
216+
stopTrackingLocation(): void;
210217

211218
ProductActionType: valueof<typeof ProductActionType>;
212219
generateHash(value: string): string;
213-
214-
// QUESTION: Should integration ID be a number or a string?
215-
setIntegrationAttribute(integrationId: number, attrs: IntegrationAttribute): void;
216-
getIntegrationAttributes(integrationId: number): IntegrationAttribute;
220+
setIntegrationAttribute(integrationModuleId: number, attrs: IntegrationAttribute): void;
221+
getIntegrationAttributes(integrationModuleId: number): IntegrationAttribute;
217222
}
218223

219224
// https://go.mparticle.com/work/SQDSDKS-4805
@@ -240,17 +245,8 @@ export interface IMParticleInstanceManager extends MParticleWebSDK {
240245
getEnvironment(): valueof<typeof Constants.Environment>;
241246
getInstance(instanceName?: string): IMParticleWebSDKInstance;
242247
getVersion(): string;
243-
isInitialized(): boolean;
244-
245-
ready(f: Function): void;
246-
reset(instance: IMParticleWebSDKInstance): void;
247-
setAppName(name: string): void;
248-
setAppVersion(version: string): void;
249-
setOptOut(isOptingOut: boolean): void;
250-
startTrackingLocation(callback?: Callback): void;
251-
stopTrackingLocation(): void;
252248

253-
// @deprecated
249+
// https://go.mparticle.com/work/SQDSDKS-7060
254250
sessionManager: Pick<ISessionManager, 'getSession'>;
255251
}
256252

src/store.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,12 @@ function createSDKConfig(config: SDKInitConfig): SDKConfig {
121121
// to TypeScript
122122
export type ServerSettings = Dictionary;
123123
export type SessionAttributes = Dictionary;
124+
125+
// FIXME: DefinitelyTyped Batch definition defines this as a string but
126+
// in some of our kits, we pass this in as a number
127+
// export type IntegrationAttribute = Dictionary<string | number>;
124128
export type IntegrationAttribute = Dictionary<string>;
129+
125130
export type IntegrationAttributes = Dictionary<IntegrationAttribute>;
126131

127132
export type WrapperSDKTypes = 'flutter' | 'none';

0 commit comments

Comments
 (0)