@mparticle/web-sdk 2.45.0 → 2.47.0
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/mparticle.common.js +46 -37
- package/dist/mparticle.esm.js +46 -37
- package/dist/mparticle.js +174 -48
- package/package.json +1 -1
- package/src/batchUploader.ts +7 -2
- package/src/constants.ts +25 -0
- package/src/integrationCapture.ts +61 -28
- package/src/mp-instance.ts +24 -11
- package/src/persistence.js +14 -1
- package/src/roktManager.ts +6 -3
- package/src/sdkToEventsApiConverter.ts +8 -5
- package/src/serverModel.ts +9 -5
- package/src/store.ts +29 -12
- package/src/vault.ts +16 -0
package/dist/mparticle.js
CHANGED
|
@@ -203,7 +203,7 @@ var mParticle = (function () {
|
|
|
203
203
|
Base64: Base64$1
|
|
204
204
|
};
|
|
205
205
|
|
|
206
|
-
var version = "2.
|
|
206
|
+
var version = "2.47.0";
|
|
207
207
|
|
|
208
208
|
var Constants = {
|
|
209
209
|
sdkVersion: version,
|
|
@@ -373,7 +373,15 @@ var mParticle = (function () {
|
|
|
373
373
|
DirectUrlRouting: 'directURLRouting',
|
|
374
374
|
CacheIdentity: 'cacheIdentity',
|
|
375
375
|
AudienceAPI: 'audienceAPI',
|
|
376
|
+
// CaptureIntegrationSpecificIds (legacy): boolean flag from server/UI
|
|
377
|
+
// - 'True' → capture all integration-specific IDs
|
|
378
|
+
// - 'False' → capture none
|
|
376
379
|
CaptureIntegrationSpecificIds: 'captureIntegrationSpecificIds',
|
|
380
|
+
// CaptureIntegrationSpecificIdsV2 (new): string mode from server
|
|
381
|
+
// - 'all' → capture all IDs
|
|
382
|
+
// - 'none' → capture none
|
|
383
|
+
// - 'roktonly' → capture only Rokt-related IDs
|
|
384
|
+
CaptureIntegrationSpecificIdsV2: 'captureIntegrationSpecificIdsV2',
|
|
377
385
|
AstBackgroundEvents: 'astBackgroundEvents'
|
|
378
386
|
},
|
|
379
387
|
DefaultInstance: 'default_instance',
|
|
@@ -387,6 +395,11 @@ var mParticle = (function () {
|
|
|
387
395
|
Environment: {
|
|
388
396
|
Development: 'development',
|
|
389
397
|
Production: 'production'
|
|
398
|
+
},
|
|
399
|
+
CaptureIntegrationSpecificIdsV2Modes: {
|
|
400
|
+
All: 'all',
|
|
401
|
+
None: 'none',
|
|
402
|
+
RoktOnly: 'roktonly'
|
|
390
403
|
}
|
|
391
404
|
};
|
|
392
405
|
// https://go.mparticle.com/work/SQDSDKS-6080
|
|
@@ -396,6 +409,13 @@ var mParticle = (function () {
|
|
|
396
409
|
var HTTP_OK = 200;
|
|
397
410
|
var HTTP_ACCEPTED = 202;
|
|
398
411
|
var HTTP_BAD_REQUEST = 400;
|
|
412
|
+
var StoragePrivacyMap = {
|
|
413
|
+
SDKState: 'functional',
|
|
414
|
+
Products: 'targeting',
|
|
415
|
+
OfflineEvents: 'functional',
|
|
416
|
+
IdentityCache: 'functional',
|
|
417
|
+
TimeOnSite: 'targeting'
|
|
418
|
+
};
|
|
399
419
|
|
|
400
420
|
/******************************************************************************
|
|
401
421
|
Copyright (c) Microsoft Corporation.
|
|
@@ -1480,7 +1500,8 @@ var mParticle = (function () {
|
|
|
1480
1500
|
})(SDKIdentityTypeEnum || (SDKIdentityTypeEnum = {}));
|
|
1481
1501
|
|
|
1482
1502
|
var FeatureFlags$2 = Constants.FeatureFlags;
|
|
1483
|
-
var CaptureIntegrationSpecificIds$1 = FeatureFlags$2.CaptureIntegrationSpecificIds
|
|
1503
|
+
var CaptureIntegrationSpecificIds$1 = FeatureFlags$2.CaptureIntegrationSpecificIds,
|
|
1504
|
+
CaptureIntegrationSpecificIdsV2$1 = FeatureFlags$2.CaptureIntegrationSpecificIdsV2;
|
|
1484
1505
|
function convertEvents(mpid, sdkEvents, mpInstance) {
|
|
1485
1506
|
if (!mpid) {
|
|
1486
1507
|
return null;
|
|
@@ -1547,7 +1568,10 @@ var mParticle = (function () {
|
|
|
1547
1568
|
}
|
|
1548
1569
|
};
|
|
1549
1570
|
}
|
|
1550
|
-
|
|
1571
|
+
// https://go.mparticle.com/work/SQDSDKS-7639
|
|
1572
|
+
var integrationSpecificIds = getFeatureFlag && Boolean(getFeatureFlag(CaptureIntegrationSpecificIds$1));
|
|
1573
|
+
var integrationSpecificIdsV2 = getFeatureFlag && getFeatureFlag(CaptureIntegrationSpecificIdsV2$1);
|
|
1574
|
+
var isIntegrationCaptureEnabled = integrationSpecificIdsV2 && integrationSpecificIdsV2 !== Constants.CaptureIntegrationSpecificIdsV2Modes.None || integrationSpecificIds === true;
|
|
1551
1575
|
if (isIntegrationCaptureEnabled) {
|
|
1552
1576
|
var capturedPartnerIdentities = _IntegrationCapture === null || _IntegrationCapture === void 0 ? void 0 : _IntegrationCapture.getClickIdsAsPartnerIdentities();
|
|
1553
1577
|
if (!isEmpty(capturedPartnerIdentities)) {
|
|
@@ -2162,6 +2186,22 @@ var mParticle = (function () {
|
|
|
2162
2186
|
}
|
|
2163
2187
|
return SessionStorageVault;
|
|
2164
2188
|
}(BaseVault);
|
|
2189
|
+
// DisabledVault is used when persistence is disabled by privacy flags.
|
|
2190
|
+
var DisabledVault = /** @class */function (_super) {
|
|
2191
|
+
__extends(DisabledVault, _super);
|
|
2192
|
+
function DisabledVault(storageKey, options) {
|
|
2193
|
+
var _this = _super.call(this, storageKey, window.localStorage, options) || this;
|
|
2194
|
+
_this.contents = null;
|
|
2195
|
+
return _this;
|
|
2196
|
+
}
|
|
2197
|
+
DisabledVault.prototype.store = function (_item) {
|
|
2198
|
+
this.contents = null;
|
|
2199
|
+
};
|
|
2200
|
+
DisabledVault.prototype.retrieve = function () {
|
|
2201
|
+
return this.contents;
|
|
2202
|
+
};
|
|
2203
|
+
return DisabledVault;
|
|
2204
|
+
}(BaseVault);
|
|
2165
2205
|
|
|
2166
2206
|
var AsyncUploader = /** @class */function () {
|
|
2167
2207
|
function AsyncUploader(url) {
|
|
@@ -2341,7 +2381,7 @@ var mParticle = (function () {
|
|
|
2341
2381
|
this.batchesQueuedForProcessing = [];
|
|
2342
2382
|
// Cache Offline Storage Availability boolean
|
|
2343
2383
|
// so that we don't have to check it every time
|
|
2344
|
-
this.offlineStorageEnabled = this.isOfflineStorageAvailable();
|
|
2384
|
+
this.offlineStorageEnabled = this.isOfflineStorageAvailable() && !mpInstance._Store.getPrivacyFlag('OfflineEvents');
|
|
2345
2385
|
if (this.offlineStorageEnabled) {
|
|
2346
2386
|
this.eventVault = new SessionStorageVault("".concat(mpInstance._Store.storageName, "-events"), {
|
|
2347
2387
|
logger: mpInstance.Logger
|
|
@@ -2418,8 +2458,11 @@ var mParticle = (function () {
|
|
|
2418
2458
|
};
|
|
2419
2459
|
var customFlags = __assign({}, event.CustomFlags);
|
|
2420
2460
|
var integrationAttributes = _Store.integrationAttributes;
|
|
2461
|
+
var integrationSpecificIds = getFeatureFlag(Constants.FeatureFlags.CaptureIntegrationSpecificIds);
|
|
2462
|
+
var integrationSpecificIdsV2 = getFeatureFlag(Constants.FeatureFlags.CaptureIntegrationSpecificIdsV2) || '';
|
|
2463
|
+
var isIntegrationCaptureEnabled = integrationSpecificIdsV2 && integrationSpecificIdsV2 !== Constants.CaptureIntegrationSpecificIdsV2Modes.None || integrationSpecificIds === true;
|
|
2421
2464
|
// https://go.mparticle.com/work/SQDSDKS-5053
|
|
2422
|
-
if (
|
|
2465
|
+
if (isIntegrationCaptureEnabled) {
|
|
2423
2466
|
// Attempt to recapture click IDs in case a third party integration
|
|
2424
2467
|
// has added or updated new click IDs since the last event was sent.
|
|
2425
2468
|
this.mpInstance._IntegrationCapture.capture();
|
|
@@ -4606,6 +4649,16 @@ var mParticle = (function () {
|
|
|
4606
4649
|
this.setNoTargeting = function (noTargeting) {
|
|
4607
4650
|
_this.noTargeting = noTargeting;
|
|
4608
4651
|
};
|
|
4652
|
+
this.getPrivacyFlag = function (storageType) {
|
|
4653
|
+
var privacyControl = StoragePrivacyMap[storageType];
|
|
4654
|
+
if (privacyControl === 'functional') {
|
|
4655
|
+
return _this.getNoFunctional();
|
|
4656
|
+
}
|
|
4657
|
+
if (privacyControl === 'targeting') {
|
|
4658
|
+
return _this.getNoTargeting();
|
|
4659
|
+
}
|
|
4660
|
+
return false;
|
|
4661
|
+
};
|
|
4609
4662
|
this.getDeviceId = function () {
|
|
4610
4663
|
return _this.deviceId;
|
|
4611
4664
|
};
|
|
@@ -4686,6 +4739,7 @@ var mParticle = (function () {
|
|
|
4686
4739
|
mpInstance._Persistence.update();
|
|
4687
4740
|
};
|
|
4688
4741
|
this.processConfig = function (config) {
|
|
4742
|
+
var _a;
|
|
4689
4743
|
var workspaceToken = config.workspaceToken,
|
|
4690
4744
|
requiredWebviewBridgeName = config.requiredWebviewBridgeName;
|
|
4691
4745
|
// We should reprocess the flags and baseUrls in case they have changed when we request an updated config
|
|
@@ -4696,22 +4750,26 @@ var mParticle = (function () {
|
|
|
4696
4750
|
for (var baseUrlKeys in baseUrls) {
|
|
4697
4751
|
_this.SDKConfig[baseUrlKeys] = baseUrls[baseUrlKeys];
|
|
4698
4752
|
}
|
|
4753
|
+
var _b = (_a = config === null || config === void 0 ? void 0 : config.launcherOptions) !== null && _a !== void 0 ? _a : {},
|
|
4754
|
+
noFunctional = _b.noFunctional,
|
|
4755
|
+
noTargeting = _b.noTargeting;
|
|
4756
|
+
if (noFunctional != null) {
|
|
4757
|
+
_this.setNoFunctional(noFunctional);
|
|
4758
|
+
}
|
|
4759
|
+
if (noTargeting != null) {
|
|
4760
|
+
_this.setNoTargeting(noTargeting);
|
|
4761
|
+
}
|
|
4699
4762
|
if (workspaceToken) {
|
|
4700
4763
|
_this.SDKConfig.workspaceToken = workspaceToken;
|
|
4701
|
-
|
|
4764
|
+
if (!_this.getPrivacyFlag('TimeOnSite')) {
|
|
4765
|
+
mpInstance._timeOnSiteTimer = new ForegroundTimeTracker(workspaceToken);
|
|
4766
|
+
}
|
|
4702
4767
|
} else {
|
|
4703
4768
|
mpInstance.Logger.warning('You should have a workspaceToken on your config object for security purposes.');
|
|
4704
4769
|
}
|
|
4705
4770
|
// add a new function to apply items to the store that require config to be returned
|
|
4706
4771
|
_this.storageName = createMainStorageName(workspaceToken);
|
|
4707
4772
|
_this.prodStorageName = createProductStorageName(workspaceToken);
|
|
4708
|
-
// Extract privacy flags directly from config into Store
|
|
4709
|
-
if (config.hasOwnProperty('noFunctional')) {
|
|
4710
|
-
_this.setNoFunctional(config.noFunctional);
|
|
4711
|
-
}
|
|
4712
|
-
if (config.hasOwnProperty('noTargeting')) {
|
|
4713
|
-
_this.setNoTargeting(config.noTargeting);
|
|
4714
|
-
}
|
|
4715
4773
|
_this.SDKConfig.requiredWebviewBridgeName = requiredWebviewBridgeName || workspaceToken;
|
|
4716
4774
|
_this.webviewBridgeEnabled = isWebviewEnabled(_this.SDKConfig.requiredWebviewBridgeName, _this.SDKConfig.minWebviewBridgeVersion);
|
|
4717
4775
|
_this.configurationLoaded = true;
|
|
@@ -4728,6 +4786,7 @@ var mParticle = (function () {
|
|
|
4728
4786
|
CacheIdentity = _a.CacheIdentity,
|
|
4729
4787
|
AudienceAPI = _a.AudienceAPI,
|
|
4730
4788
|
CaptureIntegrationSpecificIds = _a.CaptureIntegrationSpecificIds,
|
|
4789
|
+
CaptureIntegrationSpecificIdsV2 = _a.CaptureIntegrationSpecificIdsV2,
|
|
4731
4790
|
AstBackgroundEvents = _a.AstBackgroundEvents;
|
|
4732
4791
|
if (!config.flags) {
|
|
4733
4792
|
return {};
|
|
@@ -4742,6 +4801,7 @@ var mParticle = (function () {
|
|
|
4742
4801
|
flags[CacheIdentity] = config.flags[CacheIdentity] === 'True';
|
|
4743
4802
|
flags[AudienceAPI] = config.flags[AudienceAPI] === 'True';
|
|
4744
4803
|
flags[CaptureIntegrationSpecificIds] = config.flags[CaptureIntegrationSpecificIds] === 'True';
|
|
4804
|
+
flags[CaptureIntegrationSpecificIdsV2] = config.flags[CaptureIntegrationSpecificIdsV2] || 'none';
|
|
4745
4805
|
flags[AstBackgroundEvents] = config.flags[AstBackgroundEvents] === 'True';
|
|
4746
4806
|
return flags;
|
|
4747
4807
|
}
|
|
@@ -4889,6 +4949,9 @@ var mParticle = (function () {
|
|
|
4889
4949
|
} else {
|
|
4890
4950
|
mpInstance._Store.isFirstRun = false;
|
|
4891
4951
|
}
|
|
4952
|
+
if (mpInstance._Store.getPrivacyFlag('SDKState')) {
|
|
4953
|
+
return;
|
|
4954
|
+
}
|
|
4892
4955
|
|
|
4893
4956
|
// https://go.mparticle.com/work/SQDSDKS-6045
|
|
4894
4957
|
if (!mpInstance._Store.isLocalStorageAvailable) {
|
|
@@ -4974,7 +5037,7 @@ var mParticle = (function () {
|
|
|
4974
5037
|
}
|
|
4975
5038
|
};
|
|
4976
5039
|
this.update = function () {
|
|
4977
|
-
if (!mpInstance._Store.webviewBridgeEnabled) {
|
|
5040
|
+
if (!mpInstance._Store.webviewBridgeEnabled && !mpInstance._Store.getPrivacyFlag('SDKState')) {
|
|
4978
5041
|
if (mpInstance._Store.SDKConfig.useCookieStorage) {
|
|
4979
5042
|
self.setCookie();
|
|
4980
5043
|
}
|
|
@@ -5545,6 +5608,9 @@ var mParticle = (function () {
|
|
|
5545
5608
|
|
|
5546
5609
|
// https://go.mparticle.com/work/SQDSDKS-6021
|
|
5547
5610
|
this.savePersistence = function (persistence) {
|
|
5611
|
+
if (mpInstance._Store.getPrivacyFlag('SDKState')) {
|
|
5612
|
+
return;
|
|
5613
|
+
}
|
|
5548
5614
|
var encodedPersistence = self.encodePersistence(JSON.stringify(persistence)),
|
|
5549
5615
|
date = new Date(),
|
|
5550
5616
|
key = mpInstance._Store.storageName,
|
|
@@ -5566,6 +5632,9 @@ var mParticle = (function () {
|
|
|
5566
5632
|
}
|
|
5567
5633
|
};
|
|
5568
5634
|
this.getPersistence = function () {
|
|
5635
|
+
if (mpInstance._Store.getPrivacyFlag('SDKState')) {
|
|
5636
|
+
return null;
|
|
5637
|
+
}
|
|
5569
5638
|
var persistence = this.useLocalStorage() ? this.getLocalStorage() : this.getCookie();
|
|
5570
5639
|
return persistence;
|
|
5571
5640
|
};
|
|
@@ -7011,8 +7080,13 @@ var mParticle = (function () {
|
|
|
7011
7080
|
if (mpInstance._Store.sessionId || event.messageType === Types.MessageType.OptOut || mpInstance._Store.webviewBridgeEnabled) {
|
|
7012
7081
|
var customFlags = __assign({}, event.customFlags);
|
|
7013
7082
|
var integrationAttributes = mpInstance._Store.integrationAttributes;
|
|
7083
|
+
var getFeatureFlag = mpInstance._Helpers.getFeatureFlag;
|
|
7014
7084
|
// https://go.mparticle.com/work/SQDSDKS-5053
|
|
7015
|
-
|
|
7085
|
+
// https://go.mparticle.com/work/SQDSDKS-7639
|
|
7086
|
+
var integrationSpecificIds = getFeatureFlag && getFeatureFlag(Constants.FeatureFlags.CaptureIntegrationSpecificIds);
|
|
7087
|
+
var integrationSpecificIdsV2 = getFeatureFlag && (getFeatureFlag(Constants.FeatureFlags.CaptureIntegrationSpecificIdsV2) || '');
|
|
7088
|
+
var isIntegrationCaptureEnabled = integrationSpecificIdsV2 && integrationSpecificIdsV2 !== Constants.CaptureIntegrationSpecificIdsV2Modes.None || integrationSpecificIds === true;
|
|
7089
|
+
if (isIntegrationCaptureEnabled) {
|
|
7016
7090
|
// Attempt to recapture click IDs in case a third party integration
|
|
7017
7091
|
// has added or updated new click IDs since the last event was sent.
|
|
7018
7092
|
mpInstance._IntegrationCapture.capture();
|
|
@@ -9534,7 +9608,7 @@ var mParticle = (function () {
|
|
|
9534
9608
|
PARTNER_IDENTITIES: 'partner_identities',
|
|
9535
9609
|
INTEGRATION_ATTRIBUTES: 'integration_attributes'
|
|
9536
9610
|
};
|
|
9537
|
-
var
|
|
9611
|
+
var integrationMappingExternal = {
|
|
9538
9612
|
// Facebook / Meta
|
|
9539
9613
|
fbclid: {
|
|
9540
9614
|
mappedKey: 'Facebook.ClickId',
|
|
@@ -9562,6 +9636,23 @@ var mParticle = (function () {
|
|
|
9562
9636
|
mappedKey: 'GoogleEnhancedConversions.Wbraid',
|
|
9563
9637
|
output: IntegrationOutputs.CUSTOM_FLAGS
|
|
9564
9638
|
},
|
|
9639
|
+
// TIKTOK
|
|
9640
|
+
ttclid: {
|
|
9641
|
+
mappedKey: 'TikTok.Callback',
|
|
9642
|
+
output: IntegrationOutputs.CUSTOM_FLAGS
|
|
9643
|
+
},
|
|
9644
|
+
_ttp: {
|
|
9645
|
+
mappedKey: 'tiktok_cookie_id',
|
|
9646
|
+
output: IntegrationOutputs.PARTNER_IDENTITIES
|
|
9647
|
+
},
|
|
9648
|
+
// Snapchat
|
|
9649
|
+
// https://businesshelp.snapchat.com/s/article/troubleshooting-click-id?language=en_US
|
|
9650
|
+
ScCid: {
|
|
9651
|
+
mappedKey: 'SnapchatConversions.ClickId',
|
|
9652
|
+
output: IntegrationOutputs.CUSTOM_FLAGS
|
|
9653
|
+
}
|
|
9654
|
+
};
|
|
9655
|
+
var integrationMappingRokt = {
|
|
9565
9656
|
// Rokt
|
|
9566
9657
|
// https://docs.rokt.com/developers/integration-guides/web/advanced/rokt-id-tag/
|
|
9567
9658
|
// https://go.mparticle.com/work/SQDSDKS-7167
|
|
@@ -9579,26 +9670,12 @@ var mParticle = (function () {
|
|
|
9579
9670
|
mappedKey: 'passbackconversiontrackingid',
|
|
9580
9671
|
output: IntegrationOutputs.INTEGRATION_ATTRIBUTES,
|
|
9581
9672
|
moduleId: 1277
|
|
9582
|
-
},
|
|
9583
|
-
// TIKTOK
|
|
9584
|
-
ttclid: {
|
|
9585
|
-
mappedKey: 'TikTok.Callback',
|
|
9586
|
-
output: IntegrationOutputs.CUSTOM_FLAGS
|
|
9587
|
-
},
|
|
9588
|
-
_ttp: {
|
|
9589
|
-
mappedKey: 'tiktok_cookie_id',
|
|
9590
|
-
output: IntegrationOutputs.PARTNER_IDENTITIES
|
|
9591
|
-
},
|
|
9592
|
-
// Snapchat
|
|
9593
|
-
// https://businesshelp.snapchat.com/s/article/troubleshooting-click-id?language=en_US
|
|
9594
|
-
ScCid: {
|
|
9595
|
-
mappedKey: 'SnapchatConversions.ClickId',
|
|
9596
|
-
output: IntegrationOutputs.CUSTOM_FLAGS
|
|
9597
9673
|
}
|
|
9598
9674
|
};
|
|
9599
9675
|
var IntegrationCapture = /** @class */function () {
|
|
9600
|
-
function IntegrationCapture() {
|
|
9676
|
+
function IntegrationCapture(captureMode) {
|
|
9601
9677
|
this.initialTimestamp = Date.now();
|
|
9678
|
+
this.captureMode = captureMode;
|
|
9602
9679
|
// Cache filtered mappings for faster access
|
|
9603
9680
|
this.filteredPartnerIdentityMappings = this.filterMappings(IntegrationOutputs.PARTNER_IDENTITIES);
|
|
9604
9681
|
this.filteredCustomFlagMappings = this.filterMappings(IntegrationOutputs.CUSTOM_FLAGS);
|
|
@@ -9643,7 +9720,8 @@ var mParticle = (function () {
|
|
|
9643
9720
|
* Captures cookies based on the integration ID mapping.
|
|
9644
9721
|
*/
|
|
9645
9722
|
IntegrationCapture.prototype.captureCookies = function () {
|
|
9646
|
-
var
|
|
9723
|
+
var integrationKeys = this.getAllowedKeysForMode();
|
|
9724
|
+
var cookies = getCookies(integrationKeys);
|
|
9647
9725
|
return this.applyProcessors(cookies, getHref(), this.initialTimestamp);
|
|
9648
9726
|
};
|
|
9649
9727
|
/**
|
|
@@ -9657,8 +9735,10 @@ var mParticle = (function () {
|
|
|
9657
9735
|
* Captures local storage based on the integration ID mapping.
|
|
9658
9736
|
*/
|
|
9659
9737
|
IntegrationCapture.prototype.captureLocalStorage = function () {
|
|
9738
|
+
var integrationKeys = this.getAllowedKeysForMode();
|
|
9660
9739
|
var localStorageItems = {};
|
|
9661
|
-
for (var
|
|
9740
|
+
for (var _i = 0, integrationKeys_1 = integrationKeys; _i < integrationKeys_1.length; _i++) {
|
|
9741
|
+
var key = integrationKeys_1[_i];
|
|
9662
9742
|
var localStorageItem = localStorage.getItem(key);
|
|
9663
9743
|
if (localStorageItem) {
|
|
9664
9744
|
localStorageItems[key] = localStorageItem;
|
|
@@ -9671,7 +9751,8 @@ var mParticle = (function () {
|
|
|
9671
9751
|
* @returns {Dictionary<string>} The query parameters.
|
|
9672
9752
|
*/
|
|
9673
9753
|
IntegrationCapture.prototype.getQueryParams = function () {
|
|
9674
|
-
|
|
9754
|
+
var integrationKeys = this.getAllowedKeysForMode();
|
|
9755
|
+
return queryStringParser(getHref(), integrationKeys);
|
|
9675
9756
|
};
|
|
9676
9757
|
/**
|
|
9677
9758
|
* Converts captured click IDs to custom flags for SDK events.
|
|
@@ -9737,10 +9818,11 @@ var mParticle = (function () {
|
|
|
9737
9818
|
IntegrationCapture.prototype.applyProcessors = function (clickIds, url, timestamp) {
|
|
9738
9819
|
var _a;
|
|
9739
9820
|
var processedClickIds = {};
|
|
9821
|
+
var integrationKeys = this.getActiveIntegrationMapping();
|
|
9740
9822
|
for (var key in clickIds) {
|
|
9741
9823
|
if (clickIds.hasOwnProperty(key)) {
|
|
9742
9824
|
var value = clickIds[key];
|
|
9743
|
-
var processor = (_a =
|
|
9825
|
+
var processor = (_a = integrationKeys[key]) === null || _a === void 0 ? void 0 : _a.processor;
|
|
9744
9826
|
processedClickIds[key] = processor ? processor(value, url, timestamp) : value;
|
|
9745
9827
|
}
|
|
9746
9828
|
}
|
|
@@ -9748,13 +9830,36 @@ var mParticle = (function () {
|
|
|
9748
9830
|
};
|
|
9749
9831
|
IntegrationCapture.prototype.filterMappings = function (outputType) {
|
|
9750
9832
|
var filteredMappings = {};
|
|
9751
|
-
|
|
9752
|
-
|
|
9753
|
-
|
|
9833
|
+
var integrationKeys = this.getActiveIntegrationMapping();
|
|
9834
|
+
for (var key in integrationKeys) {
|
|
9835
|
+
if (integrationKeys[key].output === outputType) {
|
|
9836
|
+
filteredMappings[key] = integrationKeys[key];
|
|
9754
9837
|
}
|
|
9755
9838
|
}
|
|
9756
9839
|
return filteredMappings;
|
|
9757
9840
|
};
|
|
9841
|
+
/**
|
|
9842
|
+
* Returns the allowed keys to capture based on the current mode.
|
|
9843
|
+
* For RoktOnly, limit capture to Rokt keys; for All, capture all mapped keys.
|
|
9844
|
+
*/
|
|
9845
|
+
IntegrationCapture.prototype.getAllowedKeysForMode = function () {
|
|
9846
|
+
return Object.keys(this.getActiveIntegrationMapping());
|
|
9847
|
+
};
|
|
9848
|
+
/**
|
|
9849
|
+
* Selects the active integration mapping for the current captureMode.
|
|
9850
|
+
* - 'roktonly': only Rokt IDs are considered
|
|
9851
|
+
* - 'all': both External and Rokt IDs are considered
|
|
9852
|
+
* - else: returns an empty mapping and nothing will be captured
|
|
9853
|
+
*/
|
|
9854
|
+
IntegrationCapture.prototype.getActiveIntegrationMapping = function () {
|
|
9855
|
+
if (this.captureMode === Constants.CaptureIntegrationSpecificIdsV2Modes.RoktOnly) {
|
|
9856
|
+
return integrationMappingRokt;
|
|
9857
|
+
}
|
|
9858
|
+
if (this.captureMode === Constants.CaptureIntegrationSpecificIdsV2Modes.All) {
|
|
9859
|
+
return __assign(__assign({}, integrationMappingExternal), integrationMappingRokt);
|
|
9860
|
+
}
|
|
9861
|
+
return {};
|
|
9862
|
+
};
|
|
9758
9863
|
return IntegrationCapture;
|
|
9759
9864
|
}();
|
|
9760
9865
|
|
|
@@ -9982,13 +10087,13 @@ var mParticle = (function () {
|
|
|
9982
10087
|
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.verbose("RoktManager: Processing ".concat(this.messageQueue.size, " queued messages"));
|
|
9983
10088
|
this.messageQueue.forEach(function (message) {
|
|
9984
10089
|
var _a, _b, _c;
|
|
9985
|
-
if (!(message.methodName in _this
|
|
9986
|
-
(_a = _this.logger) === null || _a === void 0 ? void 0 : _a.error("RoktManager: Method ".concat(message.methodName, " not found
|
|
10090
|
+
if (!(message.methodName in _this) || !isFunction(_this[message.methodName])) {
|
|
10091
|
+
(_a = _this.logger) === null || _a === void 0 ? void 0 : _a.error("RoktManager: Method ".concat(message.methodName, " not found"));
|
|
9987
10092
|
return;
|
|
9988
10093
|
}
|
|
9989
10094
|
(_b = _this.logger) === null || _b === void 0 ? void 0 : _b.verbose("RoktManager: Processing queued message: ".concat(message.methodName, " with payload: ").concat(JSON.stringify(message.payload)));
|
|
9990
10095
|
try {
|
|
9991
|
-
var result = _this
|
|
10096
|
+
var result = _this[message.methodName](message.payload);
|
|
9992
10097
|
_this.completePendingPromise(message.messageId, result);
|
|
9993
10098
|
} catch (error) {
|
|
9994
10099
|
var errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -9996,6 +10101,8 @@ var mParticle = (function () {
|
|
|
9996
10101
|
_this.completePendingPromise(message.messageId, Promise.reject(error));
|
|
9997
10102
|
}
|
|
9998
10103
|
});
|
|
10104
|
+
// Clear the queue after processing all messages
|
|
10105
|
+
this.messageQueue.clear();
|
|
9999
10106
|
};
|
|
10000
10107
|
RoktManager.prototype.queueMessage = function (message) {
|
|
10001
10108
|
this.messageQueue.set(message.messageId, message);
|
|
@@ -10032,9 +10139,11 @@ var mParticle = (function () {
|
|
|
10032
10139
|
|
|
10033
10140
|
var Messages = Constants.Messages,
|
|
10034
10141
|
HTTPCodes = Constants.HTTPCodes,
|
|
10035
|
-
FeatureFlags = Constants.FeatureFlags
|
|
10142
|
+
FeatureFlags = Constants.FeatureFlags,
|
|
10143
|
+
CaptureIntegrationSpecificIdsV2Modes = Constants.CaptureIntegrationSpecificIdsV2Modes;
|
|
10036
10144
|
var ReportBatching = FeatureFlags.ReportBatching,
|
|
10037
|
-
CaptureIntegrationSpecificIds = FeatureFlags.CaptureIntegrationSpecificIds
|
|
10145
|
+
CaptureIntegrationSpecificIds = FeatureFlags.CaptureIntegrationSpecificIds,
|
|
10146
|
+
CaptureIntegrationSpecificIdsV2 = FeatureFlags.CaptureIntegrationSpecificIdsV2;
|
|
10038
10147
|
var StartingInitialization = Messages.InformationMessages.StartingInitialization;
|
|
10039
10148
|
/**
|
|
10040
10149
|
* <p>All of the following methods can be called on the primary mParticle class. In version 2.10.0, we introduced <a href="https://docs.mparticle.com/developers/sdk/web/multiple-instances/">multiple instances</a>. If you are using multiple instances (self hosted environments only), you should call these methods on each instance.</p>
|
|
@@ -10068,7 +10177,6 @@ var mParticle = (function () {
|
|
|
10068
10177
|
integrationDelays: {},
|
|
10069
10178
|
forwarderConstructors: []
|
|
10070
10179
|
};
|
|
10071
|
-
this._IntegrationCapture = new IntegrationCapture();
|
|
10072
10180
|
this._RoktManager = new RoktManager();
|
|
10073
10181
|
// required for forwarders once they reference the mparticle instance
|
|
10074
10182
|
this.IdentityType = IdentityType;
|
|
@@ -10971,6 +11079,7 @@ var mParticle = (function () {
|
|
|
10971
11079
|
// Some (server) config settings need to be returned before they are set on SDKConfig in a self hosted environment
|
|
10972
11080
|
function completeSDKInitialization(apiKey, config, mpInstance) {
|
|
10973
11081
|
var kitBlocker = createKitBlocker(config, mpInstance);
|
|
11082
|
+
var getFeatureFlag = mpInstance._Helpers.getFeatureFlag;
|
|
10974
11083
|
mpInstance._APIClient = new APIClient(mpInstance, kitBlocker);
|
|
10975
11084
|
mpInstance._Forwarders = new Forwarders(mpInstance, kitBlocker);
|
|
10976
11085
|
mpInstance._Store.processConfig(config);
|
|
@@ -10994,10 +11103,21 @@ var mParticle = (function () {
|
|
|
10994
11103
|
mpInstance._Store.SDKConfig.identifyRequest = mpInstance._Store.hasInvalidIdentifyRequest() ? {
|
|
10995
11104
|
userIdentities: currentUserIdentities
|
|
10996
11105
|
} : mpInstance._Store.SDKConfig.identifyRequest;
|
|
10997
|
-
if (
|
|
11106
|
+
if (getFeatureFlag(ReportBatching)) {
|
|
10998
11107
|
mpInstance._ForwardingStatsUploader.startForwardingStatsTimer();
|
|
10999
11108
|
}
|
|
11000
|
-
|
|
11109
|
+
// https://go.mparticle.com/work/SQDSDKS-7639
|
|
11110
|
+
var integrationSpecificIds = getFeatureFlag(CaptureIntegrationSpecificIds);
|
|
11111
|
+
var integrationSpecificIdsV2 = getFeatureFlag(CaptureIntegrationSpecificIdsV2);
|
|
11112
|
+
var isIntegrationCaptureEnabled = integrationSpecificIdsV2 && integrationSpecificIdsV2 !== CaptureIntegrationSpecificIdsV2Modes.None || integrationSpecificIds === true;
|
|
11113
|
+
if (isIntegrationCaptureEnabled) {
|
|
11114
|
+
var captureMode = void 0;
|
|
11115
|
+
if (integrationSpecificIds || integrationSpecificIdsV2 === CaptureIntegrationSpecificIdsV2Modes.All) {
|
|
11116
|
+
captureMode = 'all';
|
|
11117
|
+
} else if (integrationSpecificIdsV2 === CaptureIntegrationSpecificIdsV2Modes.RoktOnly) {
|
|
11118
|
+
captureMode = 'roktonly';
|
|
11119
|
+
}
|
|
11120
|
+
mpInstance._IntegrationCapture = new IntegrationCapture(captureMode);
|
|
11001
11121
|
mpInstance._IntegrationCapture.capture();
|
|
11002
11122
|
}
|
|
11003
11123
|
// Configure Rokt Manager with user and filtered user
|
|
@@ -11094,7 +11214,13 @@ var mParticle = (function () {
|
|
|
11094
11214
|
return kitBlocker;
|
|
11095
11215
|
}
|
|
11096
11216
|
function createIdentityCache(mpInstance) {
|
|
11097
|
-
|
|
11217
|
+
var cacheKey = "".concat(mpInstance._Store.storageName, "-id-cache");
|
|
11218
|
+
if (mpInstance._Store.getPrivacyFlag('IdentityCache')) {
|
|
11219
|
+
return new DisabledVault(cacheKey, {
|
|
11220
|
+
logger: mpInstance.Logger
|
|
11221
|
+
});
|
|
11222
|
+
}
|
|
11223
|
+
return new LocalStorageVault(cacheKey, {
|
|
11098
11224
|
logger: mpInstance.Logger
|
|
11099
11225
|
});
|
|
11100
11226
|
}
|
package/package.json
CHANGED
package/src/batchUploader.ts
CHANGED
|
@@ -72,7 +72,9 @@ export class BatchUploader {
|
|
|
72
72
|
|
|
73
73
|
// Cache Offline Storage Availability boolean
|
|
74
74
|
// so that we don't have to check it every time
|
|
75
|
-
this.offlineStorageEnabled =
|
|
75
|
+
this.offlineStorageEnabled =
|
|
76
|
+
this.isOfflineStorageAvailable() &&
|
|
77
|
+
!mpInstance._Store.getPrivacyFlag('OfflineEvents');
|
|
76
78
|
|
|
77
79
|
if (this.offlineStorageEnabled) {
|
|
78
80
|
this.eventVault = new SessionStorageVault<SDKEvent[]>(
|
|
@@ -173,9 +175,12 @@ export class BatchUploader {
|
|
|
173
175
|
|
|
174
176
|
let customFlags: SDKEventCustomFlags = {...event.CustomFlags};
|
|
175
177
|
let integrationAttributes: IntegrationAttributes = _Store.integrationAttributes;
|
|
178
|
+
const integrationSpecificIds = getFeatureFlag(Constants.FeatureFlags.CaptureIntegrationSpecificIds) as boolean;
|
|
179
|
+
const integrationSpecificIdsV2 = getFeatureFlag(Constants.FeatureFlags.CaptureIntegrationSpecificIdsV2) as string || '';
|
|
180
|
+
const isIntegrationCaptureEnabled = (integrationSpecificIdsV2 && integrationSpecificIdsV2 !== Constants.CaptureIntegrationSpecificIdsV2Modes.None) || integrationSpecificIds === true;
|
|
176
181
|
|
|
177
182
|
// https://go.mparticle.com/work/SQDSDKS-5053
|
|
178
|
-
if (
|
|
183
|
+
if (isIntegrationCaptureEnabled) {
|
|
179
184
|
|
|
180
185
|
// Attempt to recapture click IDs in case a third party integration
|
|
181
186
|
// has added or updated new click IDs since the last event was sent.
|
package/src/constants.ts
CHANGED
|
@@ -184,7 +184,15 @@ const Constants = {
|
|
|
184
184
|
DirectUrlRouting: 'directURLRouting',
|
|
185
185
|
CacheIdentity: 'cacheIdentity',
|
|
186
186
|
AudienceAPI: 'audienceAPI',
|
|
187
|
+
// CaptureIntegrationSpecificIds (legacy): boolean flag from server/UI
|
|
188
|
+
// - 'True' → capture all integration-specific IDs
|
|
189
|
+
// - 'False' → capture none
|
|
187
190
|
CaptureIntegrationSpecificIds: 'captureIntegrationSpecificIds',
|
|
191
|
+
// CaptureIntegrationSpecificIdsV2 (new): string mode from server
|
|
192
|
+
// - 'all' → capture all IDs
|
|
193
|
+
// - 'none' → capture none
|
|
194
|
+
// - 'roktonly' → capture only Rokt-related IDs
|
|
195
|
+
CaptureIntegrationSpecificIdsV2: 'captureIntegrationSpecificIdsV2',
|
|
188
196
|
AstBackgroundEvents: 'astBackgroundEvents',
|
|
189
197
|
},
|
|
190
198
|
DefaultInstance: 'default_instance',
|
|
@@ -200,6 +208,11 @@ const Constants = {
|
|
|
200
208
|
Development: 'development',
|
|
201
209
|
Production: 'production',
|
|
202
210
|
},
|
|
211
|
+
CaptureIntegrationSpecificIdsV2Modes: {
|
|
212
|
+
All: 'all',
|
|
213
|
+
None: 'none',
|
|
214
|
+
RoktOnly: 'roktonly',
|
|
215
|
+
},
|
|
203
216
|
} as const;
|
|
204
217
|
|
|
205
218
|
export default Constants;
|
|
@@ -216,3 +229,15 @@ export const HTTP_UNAUTHORIZED = 401 as const;
|
|
|
216
229
|
export const HTTP_FORBIDDEN = 403 as const;
|
|
217
230
|
export const HTTP_NOT_FOUND = 404 as const;
|
|
218
231
|
export const HTTP_SERVER_ERROR = 500 as const;
|
|
232
|
+
|
|
233
|
+
export type PrivacyControl = 'functional' | 'targeting';
|
|
234
|
+
|
|
235
|
+
export type StorageTypes = 'SDKState' | 'Products' | 'OfflineEvents' | 'IdentityCache' | 'TimeOnSite';
|
|
236
|
+
|
|
237
|
+
export const StoragePrivacyMap: Record<StorageTypes, PrivacyControl> = {
|
|
238
|
+
SDKState: 'functional',
|
|
239
|
+
Products: 'targeting',
|
|
240
|
+
OfflineEvents: 'functional',
|
|
241
|
+
IdentityCache: 'functional',
|
|
242
|
+
TimeOnSite: 'targeting',
|
|
243
|
+
};
|