@mparticle/web-optimizely-kit 2.1.3 → 2.1.4

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/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ ## Releases
2
+
3
+ --
4
+
5
+ #### 2.1.4 - 2022-03-31
6
+ * fix - update datafile loading callback
7
+
8
+ #### 2.1.3 - 202108-09
9
+ * fix - correct casing for customerid
10
+
11
+ #### 2.1.2 - 2020-09-02
12
+ * fix - remove other instances of settings.useFullStack
13
+
14
+ #### 2.1.1 - 2020-09-01
15
+ * fix - turn useFullStack into a boolean on common module
16
+
17
+ #### 2.1.0 - 2020-08-26
18
+ * feat - implement Optimizely Full Stack
@@ -340,6 +340,10 @@ IdentityHandler.prototype.onSetUserIdentity = function(
340
340
 
341
341
  var identityHandler = IdentityHandler;
342
342
 
343
+ var optimizelyFsSdkUrl = 'https://unpkg.com/@optimizely/optimizely-sdk@3.5.0/dist/optimizely.browser.umd.min.js',
344
+ dataFilePrefix = 'https://cdn.optimizely.com/datafiles/',
345
+ dataFileURLending = '.json/tag.js';
346
+
343
347
  var initialization = {
344
348
  name: 'Optimizely',
345
349
  moduleId: 54,
@@ -388,8 +392,16 @@ var initialization = {
388
392
  });
389
393
  };
390
394
 
391
- helpers_1.loadScript('https://unpkg.com/@optimizely/optimizely-sdk/dist/optimizely.browser.umd.min.js',
392
- helpers_1.loadScript('https://cdn.optimizely.com/datafiles/' + settings.projectId + '.json/tag.js', instantiateFSClient));
395
+ helpers_1.loadScript(optimizelyFsSdkUrl,
396
+ function() {
397
+ helpers_1.loadScript(
398
+ dataFilePrefix +
399
+ settings.projectId +
400
+ dataFileURLending,
401
+ instantiateFSClient
402
+ );
403
+ }
404
+ );
393
405
 
394
406
  } else {
395
407
  loadFullStackEvents();
@@ -555,7 +567,10 @@ var constructor = function() {
555
567
  ) {
556
568
  forwarderSettings = settings;
557
569
 
558
- if (window.mParticle.isTestEnvironment) {
570
+ if (
571
+ typeof window !== 'undefined' &&
572
+ window.mParticle.isTestEnvironment
573
+ ) {
559
574
  reportingService = function() {};
560
575
  } else {
561
576
  reportingService = service;
@@ -971,14 +986,14 @@ function isObject(val) {
971
986
 
972
987
  function register(config) {
973
988
  if (!config) {
974
- window.console.log(
989
+ console.log(
975
990
  'You must pass a config object to register the kit ' + name
976
991
  );
977
992
  return;
978
993
  }
979
994
 
980
995
  if (!isObject(config)) {
981
- window.console.log(
996
+ console.log(
982
997
  "'config' must be an object. You passed in a " + typeof config
983
998
  );
984
999
  return;
@@ -994,17 +1009,19 @@ function register(config) {
994
1009
  constructor: constructor,
995
1010
  };
996
1011
  }
997
- window.console.log(
1012
+ console.log(
998
1013
  'Successfully registered ' + name + ' to your mParticle configuration'
999
1014
  );
1000
1015
  }
1001
1016
 
1002
- if (window && window.mParticle && window.mParticle.addForwarder) {
1003
- window.mParticle.addForwarder({
1004
- name: name,
1005
- constructor: constructor,
1006
- getId: getId,
1007
- });
1017
+ if (typeof window !== 'undefined') {
1018
+ if (window && window.mParticle && window.mParticle.addForwarder) {
1019
+ window.mParticle.addForwarder({
1020
+ name: name,
1021
+ constructor: constructor,
1022
+ getId: getId,
1023
+ });
1024
+ }
1008
1025
  }
1009
1026
 
1010
1027
  var webKitWrapper = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mparticle/web-optimizely-kit",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
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",