@blotoutio/providers-google-analytics-4-sdk 1.36.1 → 1.36.2

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/index.cjs.js CHANGED
@@ -112,6 +112,18 @@ new Set([
112
112
  ...expand('911,921,922,923,924,926,927,932,933,935,942,944,946,950,953,955,957-958,960-969,974,975,976,977,981-982,987,988,990-999'),
113
113
  ]);
114
114
 
115
+ function tryParse(json, fallbackValue) {
116
+ try {
117
+ if (json) {
118
+ return JSON.parse(json);
119
+ }
120
+ }
121
+ catch {
122
+ /* do nothing */
123
+ }
124
+ return fallbackValue;
125
+ }
126
+
115
127
  /**
116
128
  * ISO-3166 2-leter country codes and their names
117
129
  * @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
@@ -439,7 +451,7 @@ new Set([...isoCountries.keys(), ...usStates.keys()]);
439
451
  * this function when cloning user-provided objects since structuredClone
440
452
  * will throw an error if given an object with functions.
441
453
  */
442
- const jsonClone = (json) => JSON.parse(JSON.stringify(json));
454
+ const jsonClone = (json) => tryParse(JSON.stringify(json), undefined);
443
455
 
444
456
  // eslint-disable-next-line @nx/enforce-module-boundaries
445
457
  const getGoogleConsentFromCategories = (categories) => {
@@ -783,7 +795,7 @@ const tag = ({ data, eventName, manifestVariables, eventId }) => {
783
795
  }
784
796
  return {
785
797
  loaded: isLoaded,
786
- sdkVersion: "1.36.1" ,
798
+ sdkVersion: "1.36.2" ,
787
799
  };
788
800
  };
789
801
 
package/index.js CHANGED
@@ -113,6 +113,18 @@ var ProvidersGoogleAnalytics4Sdk = (function () {
113
113
  ...expand('911,921,922,923,924,926,927,932,933,935,942,944,946,950,953,955,957-958,960-969,974,975,976,977,981-982,987,988,990-999'),
114
114
  ]);
115
115
 
116
+ function tryParse(json, fallbackValue) {
117
+ try {
118
+ if (json) {
119
+ return JSON.parse(json);
120
+ }
121
+ }
122
+ catch {
123
+ /* do nothing */
124
+ }
125
+ return fallbackValue;
126
+ }
127
+
116
128
  /**
117
129
  * ISO-3166 2-leter country codes and their names
118
130
  * @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
@@ -440,7 +452,7 @@ var ProvidersGoogleAnalytics4Sdk = (function () {
440
452
  * this function when cloning user-provided objects since structuredClone
441
453
  * will throw an error if given an object with functions.
442
454
  */
443
- const jsonClone = (json) => JSON.parse(JSON.stringify(json));
455
+ const jsonClone = (json) => tryParse(JSON.stringify(json), undefined);
444
456
 
445
457
  // eslint-disable-next-line @nx/enforce-module-boundaries
446
458
  const getGoogleConsentFromCategories = (categories) => {
@@ -784,7 +796,7 @@ var ProvidersGoogleAnalytics4Sdk = (function () {
784
796
  }
785
797
  return {
786
798
  loaded: isLoaded,
787
- sdkVersion: "1.36.1" ,
799
+ sdkVersion: "1.36.2" ,
788
800
  };
789
801
  };
790
802
 
package/index.mjs CHANGED
@@ -110,6 +110,18 @@ new Set([
110
110
  ...expand('911,921,922,923,924,926,927,932,933,935,942,944,946,950,953,955,957-958,960-969,974,975,976,977,981-982,987,988,990-999'),
111
111
  ]);
112
112
 
113
+ function tryParse(json, fallbackValue) {
114
+ try {
115
+ if (json) {
116
+ return JSON.parse(json);
117
+ }
118
+ }
119
+ catch {
120
+ /* do nothing */
121
+ }
122
+ return fallbackValue;
123
+ }
124
+
113
125
  /**
114
126
  * ISO-3166 2-leter country codes and their names
115
127
  * @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
@@ -437,7 +449,7 @@ new Set([...isoCountries.keys(), ...usStates.keys()]);
437
449
  * this function when cloning user-provided objects since structuredClone
438
450
  * will throw an error if given an object with functions.
439
451
  */
440
- const jsonClone = (json) => JSON.parse(JSON.stringify(json));
452
+ const jsonClone = (json) => tryParse(JSON.stringify(json), undefined);
441
453
 
442
454
  // eslint-disable-next-line @nx/enforce-module-boundaries
443
455
  const getGoogleConsentFromCategories = (categories) => {
@@ -781,7 +793,7 @@ const tag = ({ data, eventName, manifestVariables, eventId }) => {
781
793
  }
782
794
  return {
783
795
  loaded: isLoaded,
784
- sdkVersion: "1.36.1" ,
796
+ sdkVersion: "1.36.2" ,
785
797
  };
786
798
  };
787
799
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/providers-google-analytics-4-sdk",
3
- "version": "1.36.1",
3
+ "version": "1.36.2",
4
4
  "description": "Google Analytics 4 Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",