@blotoutio/edgetag-sdk-js 0.61.0 → 0.62.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 (3) hide show
  1. package/index.cjs.js +10 -3
  2. package/index.mjs +10 -3
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -560,7 +560,7 @@ const getStandardPayload = (destination, payload) => {
560
560
  referrer: getReferrer(destination),
561
561
  search: getSearch(destination),
562
562
  locale: getLocale(),
563
- sdkVersion: "0.61.0" ,
563
+ sdkVersion: "0.62.0" ,
564
564
  ...(payload || {}),
565
565
  };
566
566
  let storage = {};
@@ -614,11 +614,14 @@ const generateUrl = (destination, path) => {
614
614
  }
615
615
  return `${destination}${path}`;
616
616
  };
617
- const getTagURL = (destination, options) => {
617
+ const getTagURL = (destination, eventName, options) => {
618
618
  const parsedUrl = new URL(generateUrl(destination, '/tag'));
619
619
  if (options === null || options === void 0 ? void 0 : options.sync) {
620
620
  parsedUrl.searchParams.set('sync', 'true');
621
621
  }
622
+ if (eventName) {
623
+ parsedUrl.searchParams.set('name', eventName);
624
+ }
622
625
  return parsedUrl.toString();
623
626
  };
624
627
  const getInitURL = (destination) => {
@@ -680,7 +683,7 @@ const sendTag = (destination, { eventName, eventId, data, providerData, provider
680
683
  if (providers) {
681
684
  payload.providers = providers;
682
685
  }
683
- postRequest(getTagURL(destination, options), payload, options).catch(error);
686
+ postRequest(getTagURL(destination, eventName, options), payload, options).catch(error);
684
687
  };
685
688
  const processTag = (destination, eventName, data = {}, providers, options) => {
686
689
  if (!getSetting(destination, 'initialized')) {
@@ -727,6 +730,7 @@ const processTag = (destination, eventName, data = {}, providers, options) => {
727
730
  sendTag: sendTag.bind(null, destination),
728
731
  manifestVariables: variable.variableSet,
729
732
  executionContext,
733
+ destination,
730
734
  });
731
735
  }
732
736
  providerData[pkg.name] = result;
@@ -1152,6 +1156,9 @@ const handleInit = (preferences) => {
1152
1156
  error('Initialization failed');
1153
1157
  return;
1154
1158
  }
1159
+ if (result.isNewUser && result.consent) {
1160
+ saveConsent(preferences.edgeURL, result.consent);
1161
+ }
1155
1162
  const providers = {};
1156
1163
  (_a = result.result) === null || _a === void 0 ? void 0 : _a.forEach((pkg) => {
1157
1164
  const provider = browserPackages[pkg.package];
package/index.mjs CHANGED
@@ -558,7 +558,7 @@ const getStandardPayload = (destination, payload) => {
558
558
  referrer: getReferrer(destination),
559
559
  search: getSearch(destination),
560
560
  locale: getLocale(),
561
- sdkVersion: "0.61.0" ,
561
+ sdkVersion: "0.62.0" ,
562
562
  ...(payload || {}),
563
563
  };
564
564
  let storage = {};
@@ -612,11 +612,14 @@ const generateUrl = (destination, path) => {
612
612
  }
613
613
  return `${destination}${path}`;
614
614
  };
615
- const getTagURL = (destination, options) => {
615
+ const getTagURL = (destination, eventName, options) => {
616
616
  const parsedUrl = new URL(generateUrl(destination, '/tag'));
617
617
  if (options === null || options === void 0 ? void 0 : options.sync) {
618
618
  parsedUrl.searchParams.set('sync', 'true');
619
619
  }
620
+ if (eventName) {
621
+ parsedUrl.searchParams.set('name', eventName);
622
+ }
620
623
  return parsedUrl.toString();
621
624
  };
622
625
  const getInitURL = (destination) => {
@@ -678,7 +681,7 @@ const sendTag = (destination, { eventName, eventId, data, providerData, provider
678
681
  if (providers) {
679
682
  payload.providers = providers;
680
683
  }
681
- postRequest(getTagURL(destination, options), payload, options).catch(error);
684
+ postRequest(getTagURL(destination, eventName, options), payload, options).catch(error);
682
685
  };
683
686
  const processTag = (destination, eventName, data = {}, providers, options) => {
684
687
  if (!getSetting(destination, 'initialized')) {
@@ -725,6 +728,7 @@ const processTag = (destination, eventName, data = {}, providers, options) => {
725
728
  sendTag: sendTag.bind(null, destination),
726
729
  manifestVariables: variable.variableSet,
727
730
  executionContext,
731
+ destination,
728
732
  });
729
733
  }
730
734
  providerData[pkg.name] = result;
@@ -1150,6 +1154,9 @@ const handleInit = (preferences) => {
1150
1154
  error('Initialization failed');
1151
1155
  return;
1152
1156
  }
1157
+ if (result.isNewUser && result.consent) {
1158
+ saveConsent(preferences.edgeURL, result.consent);
1159
+ }
1153
1160
  const providers = {};
1154
1161
  (_a = result.result) === null || _a === void 0 ? void 0 : _a.forEach((pkg) => {
1155
1162
  const provider = browserPackages[pkg.package];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-js",
3
- "version": "0.61.0",
3
+ "version": "0.62.0",
4
4
  "description": "JS SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",