@blotoutio/edgetag-sdk-browser 0.22.1 → 0.22.3

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 +17 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -277,6 +277,9 @@
277
277
  }
278
278
  return true;
279
279
  };
280
+ const checkProviderConsent = (providerId) => {
281
+ return checkConsent({ [providerId]: true });
282
+ };
280
283
 
281
284
  const tagStorage = 'edgeTag';
282
285
  const consentKey = 'consent';
@@ -510,7 +513,7 @@
510
513
  referrer: getReferrer(),
511
514
  search: getSearch(),
512
515
  locale: getLocale(),
513
- sdkVersion: "0.22.1" ,
516
+ sdkVersion: "0.22.3" ,
514
517
  ...(payload || {}),
515
518
  };
516
519
  let storage = {};
@@ -558,12 +561,14 @@
558
561
  setConsent(consent);
559
562
  savePerKey('local', tagStorage, consent, consentKey);
560
563
  };
561
- const handleConsent = (consent) => {
564
+ const handleConsent = (consent, options) => {
562
565
  const payload = {
563
566
  consentString: consent,
564
567
  };
565
568
  saveConsent(consent);
566
- postRequest(getConsentURL(), payload).catch(error);
569
+ if (!(options === null || options === void 0 ? void 0 : options.localSave)) {
570
+ postRequest(getConsentURL(), payload).catch(error);
571
+ }
567
572
  };
568
573
  const setConsent = (newConsent) => {
569
574
  memoryConsent = newConsent;
@@ -651,6 +656,7 @@
651
656
  if (!pkg ||
652
657
  !pkg.name ||
653
658
  !pkg.tag ||
659
+ !checkProviderConsent(pkg.name) ||
654
660
  !allowProviderWithConsent(providers, pkg.name)) {
655
661
  return;
656
662
  }
@@ -858,6 +864,10 @@
858
864
  if (result.userId) {
859
865
  setUserId(result.userId);
860
866
  }
867
+ const consent = getConsent();
868
+ if (result.consent && !consent) {
869
+ saveConsent(result.consent);
870
+ }
861
871
  handleManifest(result.result);
862
872
  })
863
873
  .catch(error);
@@ -909,8 +919,8 @@
909
919
  const tag = (name, data, providers, options) => {
910
920
  handleTag(name, data, providers, options);
911
921
  };
912
- const consent = (consent) => {
913
- handleConsent(consent);
922
+ const consent = (consent, options) => {
923
+ handleConsent(consent, options);
914
924
  };
915
925
  const user = (key, value, providers, options) => {
916
926
  handleUser(key, value, providers, options);
@@ -939,8 +949,8 @@
939
949
  tag(name, data, providers, options);
940
950
  }
941
951
 
942
- consent(consentString) {
943
- consent(consentString);
952
+ consent(consentString, consentOptions) {
953
+ consent(consentString, consentOptions);
944
954
  }
945
955
 
946
956
  user(key, value, providers, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-browser",
3
- "version": "0.22.1",
3
+ "version": "0.22.3",
4
4
  "description": "Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",