@blotoutio/edgetag-sdk-browser 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.
Files changed (2) hide show
  1. package/index.js +15 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -132,6 +132,15 @@
132
132
  ...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'),
133
133
  ]);
134
134
 
135
+ const isZeroPurchaseEvent = (payload) => {
136
+ var _a;
137
+ if (payload.eventName != 'Purchase') {
138
+ return false;
139
+ }
140
+ const value = parseFloat((_a = payload.data) === null || _a === void 0 ? void 0 : _a.value);
141
+ return value === 0;
142
+ };
143
+
135
144
  // eslint-disable-next-line @nx/enforce-module-boundaries
136
145
  let edgeTagSettings;
137
146
  const initSettings = (destination, options) => {
@@ -563,7 +572,7 @@
563
572
  referrer: getReferrer(destination),
564
573
  search: getSearch(destination),
565
574
  locale: getLocale(),
566
- sdkVersion: "0.70.1" ,
575
+ sdkVersion: "0.71.0" ,
567
576
  ...(payload || {}),
568
577
  };
569
578
  let storage = {};
@@ -730,9 +739,13 @@
730
739
  }
731
740
  const providerPackages = getSetting(destination, 'browserPackages');
732
741
  const configuredTags = getSetting(destination, 'channels');
742
+ const skipZeroPurchaseEvent = getSetting(destination, 'skipZeroPurchaseEvent') || false;
733
743
  const userId = getUserId$1(destination);
734
744
  const providerData = {};
735
745
  const consent = getConsent$1(destination);
746
+ if (skipZeroPurchaseEvent && isZeroPurchaseEvent({ eventName, data })) {
747
+ return;
748
+ }
736
749
  const conversion = preparePayloadWithConversion(JSON.parse(JSON.stringify(data)), getSetting(destination, 'currency'));
737
750
  for (const pkg of providerPackages) {
738
751
  if (!pkg || !pkg.name || !pkg.tag) {
@@ -1225,6 +1238,7 @@
1225
1238
  browserPackages: Object.values(providers),
1226
1239
  storageId: result.storageId,
1227
1240
  currency: result.currency,
1241
+ skipZeroPurchaseEvent: result.skipZeroPurchaseEvent,
1228
1242
  });
1229
1243
  if (result.storageId != null) {
1230
1244
  savePerKey(preferences.edgeURL, 'local', tagStorage, result.storageId, storageIdKey);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-browser",
3
- "version": "0.70.1",
3
+ "version": "0.71.0",
4
4
  "description": "Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",