@blotoutio/edgetag-sdk-js 0.26.2 → 0.26.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.
Files changed (3) hide show
  1. package/index.cjs +16 -2
  2. package/index.esm.js +16 -2
  3. package/package.json +1 -1
package/index.cjs CHANGED
@@ -89,7 +89,18 @@ const getMessage = (error) => {
89
89
  return error;
90
90
  }
91
91
  };
92
+ const allowLog = () => {
93
+ try {
94
+ return localStorage.getItem('edgeTagDebug') === '1';
95
+ }
96
+ catch {
97
+ return false;
98
+ }
99
+ };
92
100
  const log = (data) => {
101
+ if (!allowLog()) {
102
+ return;
103
+ }
93
104
  console.log('[EdgeTag]', getMessage(data));
94
105
  };
95
106
  const error = (data) => {
@@ -323,7 +334,7 @@ const getStandardPayload = (payload) => {
323
334
  referrer: getReferrer(),
324
335
  search: getSearch(),
325
336
  locale: getLocale(),
326
- sdkVersion: "0.26.2" ,
337
+ sdkVersion: "0.26.3" ,
327
338
  ...(payload || {}),
328
339
  };
329
340
  let storage = {};
@@ -600,6 +611,7 @@ const handleTag = (eventName, data = {}, providers, options) => {
600
611
  continue;
601
612
  }
602
613
  if (!configuredTags.has(pkg.name)) {
614
+ log(`Provider ${pkg.name} is not in allow list`);
603
615
  continue;
604
616
  }
605
617
  const variables = getProviderVariables(pkg.name);
@@ -666,6 +678,7 @@ const handleData = (data, providers, options) => {
666
678
  continue;
667
679
  }
668
680
  if (!configuredTags.has(pkg.name)) {
681
+ log(`Provider ${pkg.name} is not in allow list`);
669
682
  continue;
670
683
  }
671
684
  const variables = getProviderVariables(pkg.name);
@@ -834,7 +847,7 @@ const handleInit = (preferences) => {
834
847
  getRequest(url.href)
835
848
  .then((result) => {
836
849
  if (!result) {
837
- log('Initialization failed');
850
+ error('Initialization failed');
838
851
  return;
839
852
  }
840
853
  if (result.userId) {
@@ -866,6 +879,7 @@ const handleUser = (key, value, providers, options) => {
866
879
  continue;
867
880
  }
868
881
  if (!configuredTags.has(pkg.name)) {
882
+ log(`Provider ${pkg.name} is not in allow list`);
869
883
  continue;
870
884
  }
871
885
  const variables = getProviderVariables(pkg.name);
package/index.esm.js CHANGED
@@ -87,7 +87,18 @@ const getMessage = (error) => {
87
87
  return error;
88
88
  }
89
89
  };
90
+ const allowLog = () => {
91
+ try {
92
+ return localStorage.getItem('edgeTagDebug') === '1';
93
+ }
94
+ catch {
95
+ return false;
96
+ }
97
+ };
90
98
  const log = (data) => {
99
+ if (!allowLog()) {
100
+ return;
101
+ }
91
102
  console.log('[EdgeTag]', getMessage(data));
92
103
  };
93
104
  const error = (data) => {
@@ -321,7 +332,7 @@ const getStandardPayload = (payload) => {
321
332
  referrer: getReferrer(),
322
333
  search: getSearch(),
323
334
  locale: getLocale(),
324
- sdkVersion: "0.26.2" ,
335
+ sdkVersion: "0.26.3" ,
325
336
  ...(payload || {}),
326
337
  };
327
338
  let storage = {};
@@ -598,6 +609,7 @@ const handleTag = (eventName, data = {}, providers, options) => {
598
609
  continue;
599
610
  }
600
611
  if (!configuredTags.has(pkg.name)) {
612
+ log(`Provider ${pkg.name} is not in allow list`);
601
613
  continue;
602
614
  }
603
615
  const variables = getProviderVariables(pkg.name);
@@ -664,6 +676,7 @@ const handleData = (data, providers, options) => {
664
676
  continue;
665
677
  }
666
678
  if (!configuredTags.has(pkg.name)) {
679
+ log(`Provider ${pkg.name} is not in allow list`);
667
680
  continue;
668
681
  }
669
682
  const variables = getProviderVariables(pkg.name);
@@ -832,7 +845,7 @@ const handleInit = (preferences) => {
832
845
  getRequest(url.href)
833
846
  .then((result) => {
834
847
  if (!result) {
835
- log('Initialization failed');
848
+ error('Initialization failed');
836
849
  return;
837
850
  }
838
851
  if (result.userId) {
@@ -864,6 +877,7 @@ const handleUser = (key, value, providers, options) => {
864
877
  continue;
865
878
  }
866
879
  if (!configuredTags.has(pkg.name)) {
880
+ log(`Provider ${pkg.name} is not in allow list`);
867
881
  continue;
868
882
  }
869
883
  const variables = getProviderVariables(pkg.name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-js",
3
- "version": "0.26.2",
3
+ "version": "0.26.3",
4
4
  "description": "JS SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",