@blotoutio/edgetag-sdk-js 0.22.0 → 0.22.2

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 +11 -5
  2. package/index.esm.js +11 -5
  3. package/package.json +1 -1
package/index.cjs CHANGED
@@ -509,7 +509,7 @@ const getStandardPayload = (payload) => {
509
509
  referrer: getReferrer(),
510
510
  search: getSearch(),
511
511
  locale: getLocale(),
512
- sdkVersion: "0.22.0" ,
512
+ sdkVersion: "0.22.2" ,
513
513
  ...(payload || {}),
514
514
  };
515
515
  let storage = {};
@@ -557,12 +557,14 @@ const saveConsent = (consent) => {
557
557
  setConsent(consent);
558
558
  savePerKey('local', tagStorage, consent, consentKey);
559
559
  };
560
- const handleConsent = (consent) => {
560
+ const handleConsent = (consent, options) => {
561
561
  const payload = {
562
562
  consentString: consent,
563
563
  };
564
564
  saveConsent(consent);
565
- postRequest(getConsentURL(), payload).catch(error);
565
+ if (!(options === null || options === void 0 ? void 0 : options.localSave)) {
566
+ postRequest(getConsentURL(), payload).catch(error);
567
+ }
566
568
  };
567
569
  const setConsent = (newConsent) => {
568
570
  memoryConsent = newConsent;
@@ -857,6 +859,10 @@ const handleInit = (preferences) => {
857
859
  if (result.userId) {
858
860
  setUserId(result.userId);
859
861
  }
862
+ const consent = getConsent();
863
+ if (result.consent && !consent) {
864
+ saveConsent(result.consent);
865
+ }
860
866
  handleManifest(result.result);
861
867
  })
862
868
  .catch(error);
@@ -908,8 +914,8 @@ const init = (preferences) => {
908
914
  const tag = (name, data, providers, options) => {
909
915
  handleTag(name, data, providers, options);
910
916
  };
911
- const consent = (consent) => {
912
- handleConsent(consent);
917
+ const consent = (consent, options) => {
918
+ handleConsent(consent, options);
913
919
  };
914
920
  const user = (key, value, providers, options) => {
915
921
  handleUser(key, value, providers, options);
package/index.esm.js CHANGED
@@ -507,7 +507,7 @@ const getStandardPayload = (payload) => {
507
507
  referrer: getReferrer(),
508
508
  search: getSearch(),
509
509
  locale: getLocale(),
510
- sdkVersion: "0.22.0" ,
510
+ sdkVersion: "0.22.2" ,
511
511
  ...(payload || {}),
512
512
  };
513
513
  let storage = {};
@@ -555,12 +555,14 @@ const saveConsent = (consent) => {
555
555
  setConsent(consent);
556
556
  savePerKey('local', tagStorage, consent, consentKey);
557
557
  };
558
- const handleConsent = (consent) => {
558
+ const handleConsent = (consent, options) => {
559
559
  const payload = {
560
560
  consentString: consent,
561
561
  };
562
562
  saveConsent(consent);
563
- postRequest(getConsentURL(), payload).catch(error);
563
+ if (!(options === null || options === void 0 ? void 0 : options.localSave)) {
564
+ postRequest(getConsentURL(), payload).catch(error);
565
+ }
564
566
  };
565
567
  const setConsent = (newConsent) => {
566
568
  memoryConsent = newConsent;
@@ -855,6 +857,10 @@ const handleInit = (preferences) => {
855
857
  if (result.userId) {
856
858
  setUserId(result.userId);
857
859
  }
860
+ const consent = getConsent();
861
+ if (result.consent && !consent) {
862
+ saveConsent(result.consent);
863
+ }
858
864
  handleManifest(result.result);
859
865
  })
860
866
  .catch(error);
@@ -906,8 +912,8 @@ const init = (preferences) => {
906
912
  const tag = (name, data, providers, options) => {
907
913
  handleTag(name, data, providers, options);
908
914
  };
909
- const consent = (consent) => {
910
- handleConsent(consent);
915
+ const consent = (consent, options) => {
916
+ handleConsent(consent, options);
911
917
  };
912
918
  const user = (key, value, providers, options) => {
913
919
  handleUser(key, value, providers, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-js",
3
- "version": "0.22.0",
3
+ "version": "0.22.2",
4
4
  "description": "JS SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",