@blotoutio/edgetag-sdk-js 1.34.2 → 1.35.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.
Files changed (3) hide show
  1. package/index.cjs.js +23 -13
  2. package/index.mjs +23 -13
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -664,6 +664,15 @@ const areEqual = (a, b) => {
664
664
  }
665
665
  return true;
666
666
  };
667
+ const getInitData = (edgeURL, manifestResult) => ({
668
+ destination: edgeURL,
669
+ userId: manifestResult.userId,
670
+ isNewUser: manifestResult.isNewUser,
671
+ consent: manifestResult.consent,
672
+ consentCategories: manifestResult.consentCategories,
673
+ consentSetting: manifestResult.consentSetting,
674
+ session: manifestResult.session,
675
+ });
667
676
 
668
677
  const tagStorage = 'edgeTag';
669
678
  const consentKey = 'consent';
@@ -955,7 +964,7 @@ const getStandardPayload = (destination, payload) => {
955
964
  referrer: getReferrer(destination),
956
965
  search: getSearch(destination),
957
966
  locale: getLocale(),
958
- sdkVersion: "1.34.2" ,
967
+ sdkVersion: "1.35.1" ,
959
968
  ...(payload || {}),
960
969
  };
961
970
  let storage = {};
@@ -1622,6 +1631,17 @@ const handleManifest = (destination, response) => {
1622
1631
  setSetting(destination, {
1623
1632
  initialized: true,
1624
1633
  });
1634
+ // we fire this event to process the initial consent settings before firing
1635
+ // the rest of the stubs. this will provide the ability to enqueue the consent
1636
+ // call before the rest of the events so that consent is applied correctly for
1637
+ // queued events.
1638
+ try {
1639
+ const detail = getInitData(destination, response);
1640
+ window.dispatchEvent(new CustomEvent('edgetag-boot', { detail }));
1641
+ }
1642
+ catch {
1643
+ // do nothing
1644
+ }
1625
1645
  processStubs(destination);
1626
1646
  };
1627
1647
 
@@ -1752,18 +1772,8 @@ const handleInit = (preferences) => {
1752
1772
  }
1753
1773
  handleManifest(preferences.edgeURL, result);
1754
1774
  try {
1755
- const detail = {
1756
- destination: preferences.edgeURL,
1757
- userId: result.userId,
1758
- isNewUser: result.isNewUser,
1759
- consent: result.consent,
1760
- consentCategories: result.consentCategories,
1761
- consentSetting: result.consentSetting,
1762
- session: result.session,
1763
- };
1764
- window.dispatchEvent(new CustomEvent('edgetag-initialized', {
1765
- detail,
1766
- }));
1775
+ const detail = getInitData(preferences.edgeURL, result);
1776
+ window.dispatchEvent(new CustomEvent('edgetag-initialized', { detail }));
1767
1777
  onReady(detail);
1768
1778
  }
1769
1779
  catch {
package/index.mjs CHANGED
@@ -662,6 +662,15 @@ const areEqual = (a, b) => {
662
662
  }
663
663
  return true;
664
664
  };
665
+ const getInitData = (edgeURL, manifestResult) => ({
666
+ destination: edgeURL,
667
+ userId: manifestResult.userId,
668
+ isNewUser: manifestResult.isNewUser,
669
+ consent: manifestResult.consent,
670
+ consentCategories: manifestResult.consentCategories,
671
+ consentSetting: manifestResult.consentSetting,
672
+ session: manifestResult.session,
673
+ });
665
674
 
666
675
  const tagStorage = 'edgeTag';
667
676
  const consentKey = 'consent';
@@ -953,7 +962,7 @@ const getStandardPayload = (destination, payload) => {
953
962
  referrer: getReferrer(destination),
954
963
  search: getSearch(destination),
955
964
  locale: getLocale(),
956
- sdkVersion: "1.34.2" ,
965
+ sdkVersion: "1.35.1" ,
957
966
  ...(payload || {}),
958
967
  };
959
968
  let storage = {};
@@ -1620,6 +1629,17 @@ const handleManifest = (destination, response) => {
1620
1629
  setSetting(destination, {
1621
1630
  initialized: true,
1622
1631
  });
1632
+ // we fire this event to process the initial consent settings before firing
1633
+ // the rest of the stubs. this will provide the ability to enqueue the consent
1634
+ // call before the rest of the events so that consent is applied correctly for
1635
+ // queued events.
1636
+ try {
1637
+ const detail = getInitData(destination, response);
1638
+ window.dispatchEvent(new CustomEvent('edgetag-boot', { detail }));
1639
+ }
1640
+ catch {
1641
+ // do nothing
1642
+ }
1623
1643
  processStubs(destination);
1624
1644
  };
1625
1645
 
@@ -1750,18 +1770,8 @@ const handleInit = (preferences) => {
1750
1770
  }
1751
1771
  handleManifest(preferences.edgeURL, result);
1752
1772
  try {
1753
- const detail = {
1754
- destination: preferences.edgeURL,
1755
- userId: result.userId,
1756
- isNewUser: result.isNewUser,
1757
- consent: result.consent,
1758
- consentCategories: result.consentCategories,
1759
- consentSetting: result.consentSetting,
1760
- session: result.session,
1761
- };
1762
- window.dispatchEvent(new CustomEvent('edgetag-initialized', {
1763
- detail,
1764
- }));
1773
+ const detail = getInitData(preferences.edgeURL, result);
1774
+ window.dispatchEvent(new CustomEvent('edgetag-initialized', { detail }));
1765
1775
  onReady(detail);
1766
1776
  }
1767
1777
  catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-js",
3
- "version": "1.34.2",
3
+ "version": "1.35.1",
4
4
  "description": "JS SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",