@blotoutio/edgetag-sdk-js 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.
Files changed (3) hide show
  1. package/index.cjs.js +14 -2
  2. package/index.mjs +14 -2
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -131,6 +131,18 @@ new Set([
131
131
  ...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'),
132
132
  ]);
133
133
 
134
+ function tryParse(json, fallbackValue) {
135
+ try {
136
+ if (json) {
137
+ return JSON.parse(json);
138
+ }
139
+ }
140
+ catch {
141
+ /* do nothing */
142
+ }
143
+ return fallbackValue;
144
+ }
145
+
134
146
  const isZeroPurchaseEvent = (payload) => {
135
147
  var _a;
136
148
  if (payload.eventName != 'Purchase') {
@@ -813,7 +825,7 @@ const evaluateEventRules = (rules, payload, providers, userData = {}) => {
813
825
  * this function when cloning user-provided objects since structuredClone
814
826
  * will throw an error if given an object with functions.
815
827
  */
816
- const jsonClone = (json) => JSON.parse(JSON.stringify(json));
828
+ const jsonClone = (json) => tryParse(JSON.stringify(json), undefined);
817
829
 
818
830
  // eslint-disable-next-line @nx/enforce-module-boundaries
819
831
  const getGlobalSettings = () => {
@@ -1271,7 +1283,7 @@ const getStandardPayload = (destination, payload) => {
1271
1283
  referrer: getReferrer(destination),
1272
1284
  search: getSearch(destination),
1273
1285
  locale: getLocale(),
1274
- sdkVersion: "1.36.1" ,
1286
+ sdkVersion: "1.36.2" ,
1275
1287
  ...(payload || {}),
1276
1288
  };
1277
1289
  let storage = {};
package/index.mjs CHANGED
@@ -129,6 +129,18 @@ new Set([
129
129
  ...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'),
130
130
  ]);
131
131
 
132
+ function tryParse(json, fallbackValue) {
133
+ try {
134
+ if (json) {
135
+ return JSON.parse(json);
136
+ }
137
+ }
138
+ catch {
139
+ /* do nothing */
140
+ }
141
+ return fallbackValue;
142
+ }
143
+
132
144
  const isZeroPurchaseEvent = (payload) => {
133
145
  var _a;
134
146
  if (payload.eventName != 'Purchase') {
@@ -811,7 +823,7 @@ const evaluateEventRules = (rules, payload, providers, userData = {}) => {
811
823
  * this function when cloning user-provided objects since structuredClone
812
824
  * will throw an error if given an object with functions.
813
825
  */
814
- const jsonClone = (json) => JSON.parse(JSON.stringify(json));
826
+ const jsonClone = (json) => tryParse(JSON.stringify(json), undefined);
815
827
 
816
828
  // eslint-disable-next-line @nx/enforce-module-boundaries
817
829
  const getGlobalSettings = () => {
@@ -1269,7 +1281,7 @@ const getStandardPayload = (destination, payload) => {
1269
1281
  referrer: getReferrer(destination),
1270
1282
  search: getSearch(destination),
1271
1283
  locale: getLocale(),
1272
- sdkVersion: "1.36.1" ,
1284
+ sdkVersion: "1.36.2" ,
1273
1285
  ...(payload || {}),
1274
1286
  };
1275
1287
  let storage = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-js",
3
- "version": "1.36.1",
3
+ "version": "1.36.2",
4
4
  "description": "JS SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",