@mparticle/web-sdk 2.44.0 → 2.46.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/README.md +1 -2
- package/dist/mparticle.common.js +38 -28
- package/dist/mparticle.esm.js +38 -28
- package/dist/mparticle.js +136 -34
- package/package.json +1 -1
- package/src/batchUploader.ts +4 -1
- package/src/constants.ts +13 -0
- package/src/integrationCapture.ts +61 -28
- package/src/mp-instance.ts +18 -7
- package/src/roktManager.ts +14 -0
- package/src/sdkRuntimeModels.ts +3 -0
- package/src/sdkToEventsApiConverter.ts +8 -5
- package/src/serverModel.ts +9 -5
- package/src/store.ts +31 -1
package/src/sdkRuntimeModels.ts
CHANGED
|
@@ -270,6 +270,9 @@ export interface SDKInitConfig
|
|
|
270
270
|
extends Omit<MPConfiguration, 'dataPlan' | 'logLevel'> {
|
|
271
271
|
dataPlan?: DataPlanConfig | KitBlockerDataPlan; // TODO: These should be eventually split into two different attributes
|
|
272
272
|
logLevel?: LogLevelType;
|
|
273
|
+
|
|
274
|
+
noFunctional?: boolean;
|
|
275
|
+
noTargeting?: boolean;
|
|
273
276
|
|
|
274
277
|
kitConfigs?: IKitConfigs[];
|
|
275
278
|
kits?: Dictionary<UnregisteredKit>;
|
|
@@ -18,11 +18,10 @@ import { SDKIdentityTypeEnum } from './identity.interfaces';
|
|
|
18
18
|
import Constants from './constants';
|
|
19
19
|
import { IMParticleWebSDKInstance } from './mp-instance';
|
|
20
20
|
|
|
21
|
-
const {
|
|
22
|
-
FeatureFlags
|
|
23
|
-
} = Constants;
|
|
21
|
+
const { FeatureFlags } = Constants;
|
|
24
22
|
const {
|
|
25
|
-
CaptureIntegrationSpecificIds
|
|
23
|
+
CaptureIntegrationSpecificIds,
|
|
24
|
+
CaptureIntegrationSpecificIdsV2,
|
|
26
25
|
} = FeatureFlags;
|
|
27
26
|
|
|
28
27
|
type PartnerIdentities = Dictionary<string>;
|
|
@@ -127,8 +126,12 @@ export function convertEvents(
|
|
|
127
126
|
},
|
|
128
127
|
};
|
|
129
128
|
}
|
|
129
|
+
// https://go.mparticle.com/work/SQDSDKS-7639
|
|
130
|
+
const integrationSpecificIds = getFeatureFlag && Boolean(getFeatureFlag(CaptureIntegrationSpecificIds));
|
|
131
|
+
const integrationSpecificIdsV2 = getFeatureFlag && (getFeatureFlag(CaptureIntegrationSpecificIdsV2) as string);
|
|
132
|
+
|
|
133
|
+
const isIntegrationCaptureEnabled = (integrationSpecificIdsV2 && integrationSpecificIdsV2 !== Constants.CaptureIntegrationSpecificIdsV2Modes.None) || integrationSpecificIds === true;
|
|
130
134
|
|
|
131
|
-
const isIntegrationCaptureEnabled: boolean = getFeatureFlag && Boolean(getFeatureFlag(CaptureIntegrationSpecificIds));
|
|
132
135
|
if (isIntegrationCaptureEnabled) {
|
|
133
136
|
const capturedPartnerIdentities: PartnerIdentities = _IntegrationCapture?.getClickIdsAsPartnerIdentities();
|
|
134
137
|
if (!isEmpty(capturedPartnerIdentities)) {
|
package/src/serverModel.ts
CHANGED
|
@@ -276,18 +276,22 @@ export default function ServerModel(
|
|
|
276
276
|
let customFlags: SDKEventCustomFlags = {...event.customFlags};
|
|
277
277
|
let integrationAttributes: IntegrationAttributes = mpInstance._Store.integrationAttributes;
|
|
278
278
|
|
|
279
|
+
const { getFeatureFlag } = mpInstance._Helpers;
|
|
279
280
|
// https://go.mparticle.com/work/SQDSDKS-5053
|
|
280
|
-
|
|
281
|
-
|
|
281
|
+
// https://go.mparticle.com/work/SQDSDKS-7639
|
|
282
|
+
const integrationSpecificIds = getFeatureFlag && (getFeatureFlag(Constants.FeatureFlags.CaptureIntegrationSpecificIds) as boolean);
|
|
283
|
+
const integrationSpecificIdsV2 = getFeatureFlag && ((getFeatureFlag(Constants.FeatureFlags.CaptureIntegrationSpecificIdsV2) as string) || '');
|
|
284
|
+
const isIntegrationCaptureEnabled = (integrationSpecificIdsV2 && integrationSpecificIdsV2 !== Constants.CaptureIntegrationSpecificIdsV2Modes.None) || integrationSpecificIds === true;
|
|
285
|
+
if (isIntegrationCaptureEnabled) {
|
|
282
286
|
// Attempt to recapture click IDs in case a third party integration
|
|
283
287
|
// has added or updated new click IDs since the last event was sent.
|
|
284
288
|
mpInstance._IntegrationCapture.capture();
|
|
285
289
|
const transformedClickIDs = mpInstance._IntegrationCapture.getClickIdsAsCustomFlags();
|
|
286
|
-
customFlags = {...transformedClickIDs, ...customFlags};
|
|
287
|
-
|
|
290
|
+
customFlags = { ...transformedClickIDs, ...customFlags };
|
|
288
291
|
const transformedIntegrationAttributes = mpInstance._IntegrationCapture.getClickIdsAsIntegrationAttributes();
|
|
289
|
-
integrationAttributes = {...transformedIntegrationAttributes, ...integrationAttributes};
|
|
292
|
+
integrationAttributes = { ...transformedIntegrationAttributes, ...integrationAttributes };
|
|
290
293
|
}
|
|
294
|
+
|
|
291
295
|
|
|
292
296
|
if (event.hasOwnProperty('toEventAPIObject')) {
|
|
293
297
|
eventObject = event.toEventAPIObject();
|
package/src/store.ts
CHANGED
|
@@ -145,6 +145,7 @@ export interface IFeatureFlags {
|
|
|
145
145
|
directURLRouting?: boolean;
|
|
146
146
|
cacheIdentity?: boolean;
|
|
147
147
|
captureIntegrationSpecificIds?: boolean;
|
|
148
|
+
captureIntegrationSpecificIdsV2?: string;
|
|
148
149
|
astBackgroundEvents?: boolean;
|
|
149
150
|
}
|
|
150
151
|
|
|
@@ -152,6 +153,8 @@ export interface IFeatureFlags {
|
|
|
152
153
|
export interface IStore {
|
|
153
154
|
isEnabled: boolean;
|
|
154
155
|
isInitialized: boolean;
|
|
156
|
+
noFunctional: boolean;
|
|
157
|
+
noTargeting: boolean;
|
|
155
158
|
|
|
156
159
|
// Session Attributes are persistent attributes that are tied to the current session and
|
|
157
160
|
// are uploaded then cleared when the session ends.
|
|
@@ -209,6 +212,11 @@ export interface IStore {
|
|
|
209
212
|
_getFromPersistence?<T>(mpid: MPID, key: string): T;
|
|
210
213
|
_setPersistence?<T>(mpid: MPID, key: string, value: T): void;
|
|
211
214
|
|
|
215
|
+
getNoFunctional?(): boolean;
|
|
216
|
+
setNoFunctional?(noFunctional: boolean): void;
|
|
217
|
+
getNoTargeting?(): boolean;
|
|
218
|
+
setNoTargeting?(noTargeting: boolean): void;
|
|
219
|
+
|
|
212
220
|
getDeviceId?(): string;
|
|
213
221
|
setDeviceId?(deviceId: string): void;
|
|
214
222
|
getFirstSeenTime?(mpid: MPID): number;
|
|
@@ -245,6 +253,8 @@ export default function Store(
|
|
|
245
253
|
|
|
246
254
|
const defaultStore: Partial<IStore> = {
|
|
247
255
|
isEnabled: true,
|
|
256
|
+
noFunctional: false,
|
|
257
|
+
noTargeting: false,
|
|
248
258
|
sessionAttributes: {},
|
|
249
259
|
localSessionAttributes: {},
|
|
250
260
|
currentSessionMPIDs: [],
|
|
@@ -588,6 +598,16 @@ export default function Store(
|
|
|
588
598
|
}
|
|
589
599
|
};
|
|
590
600
|
|
|
601
|
+
this.getNoFunctional = (): boolean => this.noFunctional;
|
|
602
|
+
this.setNoFunctional = (noFunctional: boolean): void => {
|
|
603
|
+
this.noFunctional = noFunctional;
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
this.getNoTargeting = (): boolean => this.noTargeting;
|
|
607
|
+
this.setNoTargeting = (noTargeting: boolean): void => {
|
|
608
|
+
this.noTargeting = noTargeting;
|
|
609
|
+
};
|
|
610
|
+
|
|
591
611
|
this.getDeviceId = () => this.deviceId;
|
|
592
612
|
this.setDeviceId = (deviceId: string) => {
|
|
593
613
|
this.deviceId = deviceId;
|
|
@@ -720,6 +740,15 @@ export default function Store(
|
|
|
720
740
|
this.storageName = createMainStorageName(workspaceToken);
|
|
721
741
|
this.prodStorageName = createProductStorageName(workspaceToken);
|
|
722
742
|
|
|
743
|
+
// Extract privacy flags directly from config into Store
|
|
744
|
+
if (config.hasOwnProperty('noFunctional')) {
|
|
745
|
+
this.setNoFunctional(config.noFunctional);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
if (config.hasOwnProperty('noTargeting')) {
|
|
749
|
+
this.setNoTargeting(config.noTargeting);
|
|
750
|
+
}
|
|
751
|
+
|
|
723
752
|
this.SDKConfig.requiredWebviewBridgeName =
|
|
724
753
|
requiredWebviewBridgeName || workspaceToken;
|
|
725
754
|
|
|
@@ -743,6 +772,7 @@ export function processFlags(config: SDKInitConfig): IFeatureFlags {
|
|
|
743
772
|
CacheIdentity,
|
|
744
773
|
AudienceAPI,
|
|
745
774
|
CaptureIntegrationSpecificIds,
|
|
775
|
+
CaptureIntegrationSpecificIdsV2,
|
|
746
776
|
AstBackgroundEvents
|
|
747
777
|
} = Constants.FeatureFlags;
|
|
748
778
|
|
|
@@ -762,8 +792,8 @@ export function processFlags(config: SDKInitConfig): IFeatureFlags {
|
|
|
762
792
|
flags[CacheIdentity] = config.flags[CacheIdentity] === 'True';
|
|
763
793
|
flags[AudienceAPI] = config.flags[AudienceAPI] === 'True';
|
|
764
794
|
flags[CaptureIntegrationSpecificIds] = config.flags[CaptureIntegrationSpecificIds] === 'True';
|
|
795
|
+
flags[CaptureIntegrationSpecificIdsV2] = (config.flags[CaptureIntegrationSpecificIdsV2] || 'none');
|
|
765
796
|
flags[AstBackgroundEvents] = config.flags[AstBackgroundEvents] === 'True';
|
|
766
|
-
|
|
767
797
|
return flags;
|
|
768
798
|
}
|
|
769
799
|
|