@blotoutio/edgetag-sdk-browser 1.35.2 → 1.36.1
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.js +14 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -809,6 +809,13 @@
|
|
|
809
809
|
};
|
|
810
810
|
};
|
|
811
811
|
|
|
812
|
+
/** This function will create a deep copy using JSON stringify/parse
|
|
813
|
+
* that will also remove all methods from the incoming objects. Use
|
|
814
|
+
* this function when cloning user-provided objects since structuredClone
|
|
815
|
+
* will throw an error if given an object with functions.
|
|
816
|
+
*/
|
|
817
|
+
const jsonClone = (json) => JSON.parse(JSON.stringify(json));
|
|
818
|
+
|
|
812
819
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
813
820
|
const getGlobalSettings = () => {
|
|
814
821
|
var _a;
|
|
@@ -1265,7 +1272,7 @@
|
|
|
1265
1272
|
referrer: getReferrer(destination),
|
|
1266
1273
|
search: getSearch(destination),
|
|
1267
1274
|
locale: getLocale(),
|
|
1268
|
-
sdkVersion: "1.
|
|
1275
|
+
sdkVersion: "1.36.1" ,
|
|
1269
1276
|
...(payload || {}),
|
|
1270
1277
|
};
|
|
1271
1278
|
let storage = {};
|
|
@@ -1483,11 +1490,11 @@
|
|
|
1483
1490
|
if (skipZeroPurchaseEvent && isZeroPurchaseEvent({ eventName, data })) {
|
|
1484
1491
|
return;
|
|
1485
1492
|
}
|
|
1486
|
-
const originalData =
|
|
1487
|
-
const originalProviders =
|
|
1493
|
+
const originalData = jsonClone(data);
|
|
1494
|
+
const originalProviders = jsonClone(providers);
|
|
1488
1495
|
const rules = (getSetting(destination, 'configuratorSetting') ||
|
|
1489
1496
|
[]);
|
|
1490
|
-
const rulesResult = evaluateEventRules(rules,
|
|
1497
|
+
const rulesResult = evaluateEventRules(rules, jsonClone({ eventName, data }), providers !== null && providers !== void 0 ? providers : undefined, userProperties || {});
|
|
1491
1498
|
if (!rulesResult.skipEvent) {
|
|
1492
1499
|
if (rulesResult.updatedPayload) {
|
|
1493
1500
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -1498,7 +1505,7 @@
|
|
|
1498
1505
|
providers = rulesResult.updatedProviders;
|
|
1499
1506
|
}
|
|
1500
1507
|
if (!rulesResult.skipBrowserEvent) {
|
|
1501
|
-
const conversion = preparePayloadWithConversion(
|
|
1508
|
+
const conversion = preparePayloadWithConversion(jsonClone(data), getSetting(destination, 'currency'));
|
|
1502
1509
|
for (const pkg of providerPackages) {
|
|
1503
1510
|
if (!pkg || !pkg.name || !pkg.tag) {
|
|
1504
1511
|
continue;
|
|
@@ -1532,7 +1539,7 @@
|
|
|
1532
1539
|
sessionId,
|
|
1533
1540
|
eventName,
|
|
1534
1541
|
eventId,
|
|
1535
|
-
data:
|
|
1542
|
+
data: jsonClone(payload),
|
|
1536
1543
|
sendTag: sendTag.bind(null, destination),
|
|
1537
1544
|
getEdgeData: processGetData.bind(null, destination),
|
|
1538
1545
|
manifestVariables: variable.variableSet,
|
|
@@ -1564,7 +1571,7 @@
|
|
|
1564
1571
|
}
|
|
1565
1572
|
const additionalEvents = rulesResult.additionalEvents || [];
|
|
1566
1573
|
for (const additionalEventName of additionalEvents) {
|
|
1567
|
-
handleTag(additionalEventName,
|
|
1574
|
+
handleTag(additionalEventName, jsonClone(originalData || {}), originalProviders, options);
|
|
1568
1575
|
}
|
|
1569
1576
|
};
|
|
1570
1577
|
const handleTag = (eventName, data = {}, providers, options) => {
|