Skip to content

Commit 58156dc

Browse files
authored
🤖 Merge PR DefinitelyTyped#74643 Add optional parameter in SDKEventOptions by @jaissica12
1 parent 904a093 commit 58156dc

4 files changed

Lines changed: 31 additions & 2 deletions

File tree

‎types/mparticle__web-sdk/index.d.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ export interface SDKEventCustomFlags {
155155
}
156156

157157
export interface SDKEventOptions {
158-
shouldUploadEvent: boolean;
158+
shouldUploadEvent?: boolean;
159+
sourceMessageId?: string;
159160
}
160161

161162
export interface DataPlanConfig {

‎types/mparticle__web-sdk/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@types/mparticle__web-sdk",
4-
"version": "2.54.9999",
4+
"version": "2.58.9999",
55
"projects": [
66
"https://github.com/mParticle/mparticle-web-sdk"
77
],

‎types/mparticle__web-sdk/test/mparticle__web-sdk-instance-tests.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,19 @@ const customFlags: mParticle.SDKEventCustomFlags = {
2626

2727
const eventOptions: mParticle.SDKEventOptions = {
2828
shouldUploadEvent: false,
29+
sourceMessageId: "sourceMessageId",
2930
};
3031

32+
const eventOptionsOnlyShouldUpload: mParticle.SDKEventOptions = {
33+
shouldUploadEvent: true,
34+
};
35+
36+
const eventOptionsOnlySourceMessageId: mParticle.SDKEventOptions = {
37+
sourceMessageId: "test-message-id",
38+
};
39+
40+
const eventOptionsEmpty: mParticle.SDKEventOptions = {};
41+
3142
const identifyRequest: mParticle.IdentifyRequest = {
3243
userIdentities: {
3344
customerid: "test",
@@ -178,6 +189,9 @@ instance.logEvent("eventName", instance.EventType.Location);
178189
instance.logEvent("eventName", instance.EventType.Location, customAttrs);
179190
instance.logEvent("eventName", instance.EventType.Location, customAttrs, customFlags);
180191
instance.logEvent("eventName", mParticle.EventType.Location, customAttrs, customFlags, eventOptions);
192+
instance.logEvent("eventName", mParticle.EventType.Location, customAttrs, customFlags, eventOptionsOnlyShouldUpload);
193+
instance.logEvent("eventName", mParticle.EventType.Location, customAttrs, customFlags, eventOptionsOnlySourceMessageId);
194+
instance.logEvent("eventName", mParticle.EventType.Location, customAttrs, customFlags, eventOptionsEmpty);
181195

182196
instance.logForm("click", "eventName");
183197
instance.logForm("click", "eventName", instance.EventType.Location);

‎types/mparticle__web-sdk/test/mparticle__web-sdk-tests.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,19 @@ const customFlags: mParticle.SDKEventCustomFlags = {
2424

2525
const eventOptions: mParticle.SDKEventOptions = {
2626
shouldUploadEvent: false,
27+
sourceMessageId: "sourceMessageId",
2728
};
2829

30+
const eventOptionsOnlyShouldUpload: mParticle.SDKEventOptions = {
31+
shouldUploadEvent: true,
32+
};
33+
34+
const eventOptionsOnlySourceMessageId: mParticle.SDKEventOptions = {
35+
sourceMessageId: "test-message-id",
36+
};
37+
38+
const eventOptionsEmpty: mParticle.SDKEventOptions = {};
39+
2940
const identifyRequest: mParticle.IdentifyRequest = {
3041
userIdentities: {
3142
customerid: "test",
@@ -200,6 +211,9 @@ mParticle.logEvent("eventName", mParticle.EventType.Location);
200211
mParticle.logEvent("eventName", mParticle.EventType.Location, customAttrs);
201212
mParticle.logEvent("eventName", mParticle.EventType.Location, customAttrs, customFlags);
202213
mParticle.logEvent("eventName", mParticle.EventType.Location, customAttrs, customFlags, eventOptions);
214+
mParticle.logEvent("eventName", mParticle.EventType.Location, customAttrs, customFlags, eventOptionsOnlyShouldUpload);
215+
mParticle.logEvent("eventName", mParticle.EventType.Location, customAttrs, customFlags, eventOptionsOnlySourceMessageId);
216+
mParticle.logEvent("eventName", mParticle.EventType.Location, customAttrs, customFlags, eventOptionsEmpty);
203217

204218
mParticle.logForm("click", "eventName");
205219
mParticle.logForm("click", "eventName", mParticle.EventType.Location);

0 commit comments

Comments
 (0)