@blotoutio/edgetag-sdk-js 0.70.1 → 0.71.0
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 +15 -1
- package/index.d.ts +1 -0
- package/index.mjs +15 -1
- package/internal.d.ts +1 -0
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -131,6 +131,15 @@ 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
|
+
const isZeroPurchaseEvent = (payload) => {
|
|
135
|
+
var _a;
|
|
136
|
+
if (payload.eventName != 'Purchase') {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
const value = parseFloat((_a = payload.data) === null || _a === void 0 ? void 0 : _a.value);
|
|
140
|
+
return value === 0;
|
|
141
|
+
};
|
|
142
|
+
|
|
134
143
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
135
144
|
let edgeTagSettings;
|
|
136
145
|
const initSettings = (destination, options) => {
|
|
@@ -562,7 +571,7 @@ const getStandardPayload = (destination, payload) => {
|
|
|
562
571
|
referrer: getReferrer(destination),
|
|
563
572
|
search: getSearch(destination),
|
|
564
573
|
locale: getLocale(),
|
|
565
|
-
sdkVersion: "0.
|
|
574
|
+
sdkVersion: "0.71.0" ,
|
|
566
575
|
...(payload || {}),
|
|
567
576
|
};
|
|
568
577
|
let storage = {};
|
|
@@ -729,9 +738,13 @@ const processTag = (destination, eventName, data = {}, providers, options) => {
|
|
|
729
738
|
}
|
|
730
739
|
const providerPackages = getSetting(destination, 'browserPackages');
|
|
731
740
|
const configuredTags = getSetting(destination, 'channels');
|
|
741
|
+
const skipZeroPurchaseEvent = getSetting(destination, 'skipZeroPurchaseEvent') || false;
|
|
732
742
|
const userId = getUserId$1(destination);
|
|
733
743
|
const providerData = {};
|
|
734
744
|
const consent = getConsent$1(destination);
|
|
745
|
+
if (skipZeroPurchaseEvent && isZeroPurchaseEvent({ eventName, data })) {
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
735
748
|
const conversion = preparePayloadWithConversion(JSON.parse(JSON.stringify(data)), getSetting(destination, 'currency'));
|
|
736
749
|
for (const pkg of providerPackages) {
|
|
737
750
|
if (!pkg || !pkg.name || !pkg.tag) {
|
|
@@ -1224,6 +1237,7 @@ const handleInit = (preferences) => {
|
|
|
1224
1237
|
browserPackages: Object.values(providers),
|
|
1225
1238
|
storageId: result.storageId,
|
|
1226
1239
|
currency: result.currency,
|
|
1240
|
+
skipZeroPurchaseEvent: result.skipZeroPurchaseEvent,
|
|
1227
1241
|
});
|
|
1228
1242
|
if (result.storageId != null) {
|
|
1229
1243
|
savePerKey(preferences.edgeURL, 'local', tagStorage, result.storageId, storageIdKey);
|
package/index.d.ts
CHANGED
package/index.mjs
CHANGED
|
@@ -129,6 +129,15 @@ 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
|
+
const isZeroPurchaseEvent = (payload) => {
|
|
133
|
+
var _a;
|
|
134
|
+
if (payload.eventName != 'Purchase') {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
const value = parseFloat((_a = payload.data) === null || _a === void 0 ? void 0 : _a.value);
|
|
138
|
+
return value === 0;
|
|
139
|
+
};
|
|
140
|
+
|
|
132
141
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
133
142
|
let edgeTagSettings;
|
|
134
143
|
const initSettings = (destination, options) => {
|
|
@@ -560,7 +569,7 @@ const getStandardPayload = (destination, payload) => {
|
|
|
560
569
|
referrer: getReferrer(destination),
|
|
561
570
|
search: getSearch(destination),
|
|
562
571
|
locale: getLocale(),
|
|
563
|
-
sdkVersion: "0.
|
|
572
|
+
sdkVersion: "0.71.0" ,
|
|
564
573
|
...(payload || {}),
|
|
565
574
|
};
|
|
566
575
|
let storage = {};
|
|
@@ -727,9 +736,13 @@ const processTag = (destination, eventName, data = {}, providers, options) => {
|
|
|
727
736
|
}
|
|
728
737
|
const providerPackages = getSetting(destination, 'browserPackages');
|
|
729
738
|
const configuredTags = getSetting(destination, 'channels');
|
|
739
|
+
const skipZeroPurchaseEvent = getSetting(destination, 'skipZeroPurchaseEvent') || false;
|
|
730
740
|
const userId = getUserId$1(destination);
|
|
731
741
|
const providerData = {};
|
|
732
742
|
const consent = getConsent$1(destination);
|
|
743
|
+
if (skipZeroPurchaseEvent && isZeroPurchaseEvent({ eventName, data })) {
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
733
746
|
const conversion = preparePayloadWithConversion(JSON.parse(JSON.stringify(data)), getSetting(destination, 'currency'));
|
|
734
747
|
for (const pkg of providerPackages) {
|
|
735
748
|
if (!pkg || !pkg.name || !pkg.tag) {
|
|
@@ -1222,6 +1235,7 @@ const handleInit = (preferences) => {
|
|
|
1222
1235
|
browserPackages: Object.values(providers),
|
|
1223
1236
|
storageId: result.storageId,
|
|
1224
1237
|
currency: result.currency,
|
|
1238
|
+
skipZeroPurchaseEvent: result.skipZeroPurchaseEvent,
|
|
1225
1239
|
});
|
|
1226
1240
|
if (result.storageId != null) {
|
|
1227
1241
|
savePerKey(preferences.edgeURL, 'local', tagStorage, result.storageId, storageIdKey);
|
package/internal.d.ts
CHANGED