@mparticle/web-rokt-kit 1.17.0 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Rokt-Kit.common.js +64 -5
- package/dist/Rokt-Kit.iife.js +64 -5
- package/package.json +1 -1
package/dist/Rokt-Kit.common.js
CHANGED
|
@@ -416,10 +416,42 @@ var constructor = function () {
|
|
|
416
416
|
attributes: selectPlacementsAttributes,
|
|
417
417
|
});
|
|
418
418
|
|
|
419
|
-
|
|
420
|
-
|
|
419
|
+
var selection = self.launcher.selectPlacements(selectPlacementsOptions);
|
|
420
|
+
|
|
421
|
+
// After selection resolves, sync the Rokt session ID back to mParticle
|
|
422
|
+
// as an integration attribute so server-side integrations can link events.
|
|
423
|
+
// We log the custom event AFTER setting the attribute because
|
|
424
|
+
// setIntegrationAttribute alone doesn't fire a network request —
|
|
425
|
+
// if the user closes the page before another event fires, the server
|
|
426
|
+
// would never receive the session ID.
|
|
427
|
+
if (selection && typeof selection.then === 'function') {
|
|
428
|
+
selection
|
|
429
|
+
.then(function (sel) {
|
|
430
|
+
if (sel && sel.context && sel.context.sessionId) {
|
|
431
|
+
sel.context.sessionId
|
|
432
|
+
.then(function (sessionId) {
|
|
433
|
+
_setRoktSessionId(sessionId);
|
|
434
|
+
logSelectPlacementsEvent(
|
|
435
|
+
selectPlacementsAttributes
|
|
436
|
+
);
|
|
437
|
+
})
|
|
438
|
+
.catch(function () {
|
|
439
|
+
logSelectPlacementsEvent(
|
|
440
|
+
selectPlacementsAttributes
|
|
441
|
+
);
|
|
442
|
+
});
|
|
443
|
+
} else {
|
|
444
|
+
logSelectPlacementsEvent(selectPlacementsAttributes);
|
|
445
|
+
}
|
|
446
|
+
})
|
|
447
|
+
.catch(function () {
|
|
448
|
+
logSelectPlacementsEvent(selectPlacementsAttributes);
|
|
449
|
+
});
|
|
450
|
+
} else {
|
|
451
|
+
logSelectPlacementsEvent(selectPlacementsAttributes);
|
|
452
|
+
}
|
|
421
453
|
|
|
422
|
-
return
|
|
454
|
+
return selection;
|
|
423
455
|
}
|
|
424
456
|
|
|
425
457
|
/**
|
|
@@ -529,6 +561,25 @@ var constructor = function () {
|
|
|
529
561
|
}
|
|
530
562
|
}
|
|
531
563
|
|
|
564
|
+
function _setRoktSessionId(sessionId) {
|
|
565
|
+
if (!sessionId || typeof sessionId !== 'string') {
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
try {
|
|
569
|
+
var mpInstance = window.mParticle.getInstance();
|
|
570
|
+
if (
|
|
571
|
+
mpInstance &&
|
|
572
|
+
typeof mpInstance.setIntegrationAttribute === 'function'
|
|
573
|
+
) {
|
|
574
|
+
mpInstance.setIntegrationAttribute(moduleId, {
|
|
575
|
+
roktSessionId: sessionId,
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
} catch (e) {
|
|
579
|
+
// Best effort — never let this break the partner page
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
|
|
532
583
|
function onUserIdentified(filteredUser) {
|
|
533
584
|
self.filters.filteredUser = filteredUser;
|
|
534
585
|
self.userAttributes = filteredUser.getAllUserAttributes();
|
|
@@ -543,11 +594,19 @@ var constructor = function () {
|
|
|
543
594
|
}
|
|
544
595
|
|
|
545
596
|
function attachLauncher(accountId, launcherOptions) {
|
|
597
|
+
var mpSessionId =
|
|
598
|
+
window.mParticle &&
|
|
599
|
+
window.mParticle.sessionManager &&
|
|
600
|
+
typeof window.mParticle.sessionManager.getSession === 'function'
|
|
601
|
+
? window.mParticle.sessionManager.getSession()
|
|
602
|
+
: undefined;
|
|
603
|
+
|
|
546
604
|
var options = mergeObjects(
|
|
547
605
|
{
|
|
548
606
|
accountId: accountId,
|
|
549
607
|
},
|
|
550
|
-
launcherOptions || {}
|
|
608
|
+
launcherOptions || {},
|
|
609
|
+
mpSessionId ? { mpSessionId: mpSessionId } : {}
|
|
551
610
|
);
|
|
552
611
|
|
|
553
612
|
if (isPartnerInLocalLauncherTestGroup()) {
|
|
@@ -749,7 +808,7 @@ var constructor = function () {
|
|
|
749
808
|
|
|
750
809
|
function generateIntegrationName(customIntegrationName) {
|
|
751
810
|
var coreSdkVersion = window.mParticle.getVersion();
|
|
752
|
-
var kitVersion = "1.
|
|
811
|
+
var kitVersion = "1.18.1";
|
|
753
812
|
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
|
|
754
813
|
|
|
755
814
|
if (customIntegrationName) {
|
package/dist/Rokt-Kit.iife.js
CHANGED
|
@@ -415,10 +415,42 @@ var RoktKit = (function (exports) {
|
|
|
415
415
|
attributes: selectPlacementsAttributes,
|
|
416
416
|
});
|
|
417
417
|
|
|
418
|
-
|
|
419
|
-
|
|
418
|
+
var selection = self.launcher.selectPlacements(selectPlacementsOptions);
|
|
419
|
+
|
|
420
|
+
// After selection resolves, sync the Rokt session ID back to mParticle
|
|
421
|
+
// as an integration attribute so server-side integrations can link events.
|
|
422
|
+
// We log the custom event AFTER setting the attribute because
|
|
423
|
+
// setIntegrationAttribute alone doesn't fire a network request —
|
|
424
|
+
// if the user closes the page before another event fires, the server
|
|
425
|
+
// would never receive the session ID.
|
|
426
|
+
if (selection && typeof selection.then === 'function') {
|
|
427
|
+
selection
|
|
428
|
+
.then(function (sel) {
|
|
429
|
+
if (sel && sel.context && sel.context.sessionId) {
|
|
430
|
+
sel.context.sessionId
|
|
431
|
+
.then(function (sessionId) {
|
|
432
|
+
_setRoktSessionId(sessionId);
|
|
433
|
+
logSelectPlacementsEvent(
|
|
434
|
+
selectPlacementsAttributes
|
|
435
|
+
);
|
|
436
|
+
})
|
|
437
|
+
.catch(function () {
|
|
438
|
+
logSelectPlacementsEvent(
|
|
439
|
+
selectPlacementsAttributes
|
|
440
|
+
);
|
|
441
|
+
});
|
|
442
|
+
} else {
|
|
443
|
+
logSelectPlacementsEvent(selectPlacementsAttributes);
|
|
444
|
+
}
|
|
445
|
+
})
|
|
446
|
+
.catch(function () {
|
|
447
|
+
logSelectPlacementsEvent(selectPlacementsAttributes);
|
|
448
|
+
});
|
|
449
|
+
} else {
|
|
450
|
+
logSelectPlacementsEvent(selectPlacementsAttributes);
|
|
451
|
+
}
|
|
420
452
|
|
|
421
|
-
return
|
|
453
|
+
return selection;
|
|
422
454
|
}
|
|
423
455
|
|
|
424
456
|
/**
|
|
@@ -528,6 +560,25 @@ var RoktKit = (function (exports) {
|
|
|
528
560
|
}
|
|
529
561
|
}
|
|
530
562
|
|
|
563
|
+
function _setRoktSessionId(sessionId) {
|
|
564
|
+
if (!sessionId || typeof sessionId !== 'string') {
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
try {
|
|
568
|
+
var mpInstance = window.mParticle.getInstance();
|
|
569
|
+
if (
|
|
570
|
+
mpInstance &&
|
|
571
|
+
typeof mpInstance.setIntegrationAttribute === 'function'
|
|
572
|
+
) {
|
|
573
|
+
mpInstance.setIntegrationAttribute(moduleId, {
|
|
574
|
+
roktSessionId: sessionId,
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
} catch (e) {
|
|
578
|
+
// Best effort — never let this break the partner page
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
531
582
|
function onUserIdentified(filteredUser) {
|
|
532
583
|
self.filters.filteredUser = filteredUser;
|
|
533
584
|
self.userAttributes = filteredUser.getAllUserAttributes();
|
|
@@ -542,11 +593,19 @@ var RoktKit = (function (exports) {
|
|
|
542
593
|
}
|
|
543
594
|
|
|
544
595
|
function attachLauncher(accountId, launcherOptions) {
|
|
596
|
+
var mpSessionId =
|
|
597
|
+
window.mParticle &&
|
|
598
|
+
window.mParticle.sessionManager &&
|
|
599
|
+
typeof window.mParticle.sessionManager.getSession === 'function'
|
|
600
|
+
? window.mParticle.sessionManager.getSession()
|
|
601
|
+
: undefined;
|
|
602
|
+
|
|
545
603
|
var options = mergeObjects(
|
|
546
604
|
{
|
|
547
605
|
accountId: accountId,
|
|
548
606
|
},
|
|
549
|
-
launcherOptions || {}
|
|
607
|
+
launcherOptions || {},
|
|
608
|
+
mpSessionId ? { mpSessionId: mpSessionId } : {}
|
|
550
609
|
);
|
|
551
610
|
|
|
552
611
|
if (isPartnerInLocalLauncherTestGroup()) {
|
|
@@ -748,7 +807,7 @@ var RoktKit = (function (exports) {
|
|
|
748
807
|
|
|
749
808
|
function generateIntegrationName(customIntegrationName) {
|
|
750
809
|
var coreSdkVersion = window.mParticle.getVersion();
|
|
751
|
-
var kitVersion = "1.
|
|
810
|
+
var kitVersion = "1.18.1";
|
|
752
811
|
var name = 'mParticle_' + 'wsdkv_' + coreSdkVersion + '_kitv_' + kitVersion;
|
|
753
812
|
|
|
754
813
|
if (customIntegrationName) {
|