@mparticle/web-optimizely-kit 3.32.1 → 3.32.3
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/OptimizelyKit.common.js +17 -3
- package/package.json +1 -1
|
@@ -23,10 +23,15 @@ var helpers = {
|
|
|
23
23
|
}, {});
|
|
24
24
|
return newObj;
|
|
25
25
|
},
|
|
26
|
-
loadScript: function(src, callback) {
|
|
26
|
+
loadScript: function(src, callback, integrity) {
|
|
27
27
|
var script = document.createElement('script');
|
|
28
28
|
script.type = 'text/javascript';
|
|
29
29
|
script.onload = callback;
|
|
30
|
+
if (integrity) {
|
|
31
|
+
// The browser runs the script only if its bytes match this hash.
|
|
32
|
+
script.integrity = integrity;
|
|
33
|
+
script.crossOrigin = 'anonymous';
|
|
34
|
+
}
|
|
30
35
|
script.src = src;
|
|
31
36
|
document.head.appendChild(script);
|
|
32
37
|
},
|
|
@@ -379,6 +384,9 @@ var identityHandler = IdentityHandler;
|
|
|
379
384
|
|
|
380
385
|
var optimizelyFsSdkUrl =
|
|
381
386
|
'https://unpkg.com/@optimizely/optimizely-sdk@3.5.0/dist/optimizely.browser.umd.min.js',
|
|
387
|
+
// The Subresource Integrity hash of the file above. Update both together.
|
|
388
|
+
optimizelyFsSdkIntegrity =
|
|
389
|
+
'sha256-7xlyPsgKmldoP2Wgc+c48o92PeZn4vvrbO4JVh/ikAQ=',
|
|
382
390
|
dataFilePrefix = 'https://cdn.optimizely.com/datafiles/',
|
|
383
391
|
dataFileURLending = '.json/tag.js';
|
|
384
392
|
|
|
@@ -455,12 +463,18 @@ var initialization = {
|
|
|
455
463
|
});
|
|
456
464
|
};
|
|
457
465
|
|
|
458
|
-
|
|
466
|
+
var loadDatafile = function() {
|
|
459
467
|
helpers_1.loadScript(
|
|
460
468
|
dataFilePrefix + settings.projectId + dataFileURLending,
|
|
461
469
|
instantiateFSClient
|
|
462
470
|
);
|
|
463
|
-
}
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
helpers_1.loadScript(
|
|
474
|
+
optimizelyFsSdkUrl,
|
|
475
|
+
loadDatafile,
|
|
476
|
+
optimizelyFsSdkIntegrity
|
|
477
|
+
);
|
|
464
478
|
} else {
|
|
465
479
|
common.userIdField = settings.userIdField;
|
|
466
480
|
common.userAttributes = userAttributes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mparticle/web-optimizely-kit",
|
|
3
|
-
"version": "3.32.
|
|
3
|
+
"version": "3.32.3",
|
|
4
4
|
"author": "mParticle Developers <developers@mparticle.com> (https://www.mparticle.com)",
|
|
5
5
|
"description": "mParticle integration sdk for Optimizely",
|
|
6
6
|
"main": "dist/OptimizelyKit.common.js",
|