@blotoutio/edgetag-sdk-browser 0.62.1 → 0.63.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 +17 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -279,6 +279,7 @@
279
279
  const keyPrefix = `_worker`;
280
280
  const cookieKey = 'tag_user_id';
281
281
  const fallbackSessionKey = 'fallback_tag_user_id';
282
+ const storageIdKey = 'storageId';
282
283
 
283
284
  const getMessage = (error) => {
284
285
  if (error instanceof Error) {
@@ -562,7 +563,7 @@
562
563
  referrer: getReferrer(destination),
563
564
  search: getSearch(destination),
564
565
  locale: getLocale(),
565
- sdkVersion: "0.62.1" ,
566
+ sdkVersion: "0.63.0" ,
566
567
  ...(payload || {}),
567
568
  };
568
569
  let storage = {};
@@ -844,11 +845,11 @@
844
845
 
845
846
  const handleConsent = (consent, options) => {
846
847
  if (options === null || options === void 0 ? void 0 : options.destination) {
847
- processConsent(options.destination, consent, options === null || options === void 0 ? void 0 : options.localSave);
848
+ processConsent(options.destination, consent, options);
848
849
  return;
849
850
  }
850
851
  getInstances().forEach((destination) => {
851
- processConsent(destination, consent, options === null || options === void 0 ? void 0 : options.localSave);
852
+ processConsent(destination, consent, options);
852
853
  });
853
854
  };
854
855
  const saveConsent = (destination, consent) => {
@@ -857,16 +858,23 @@
857
858
  });
858
859
  savePerKey(destination, 'local', tagStorage, consent, consentKey);
859
860
  };
860
- const processConsent = (destination, consent, localSave) => {
861
+ const processConsent = (destination, consent, options) => {
861
862
  const existingConsent = getConsent$1(destination);
862
863
  if (areEqual(existingConsent, consent)) {
863
864
  return;
864
865
  }
866
+ if (!getSetting(destination, 'initialized')) {
867
+ addStub(destination, {
868
+ name: 'consent',
869
+ arguments: [consent, options],
870
+ });
871
+ return;
872
+ }
865
873
  const payload = {
866
874
  consentString: consent,
867
875
  };
868
876
  saveConsent(destination, consent);
869
- if (!localSave) {
877
+ if (!(options === null || options === void 0 ? void 0 : options.localSave)) {
870
878
  postRequest(getConsentURL(destination), payload).catch(error);
871
879
  }
872
880
  const userId = getUserId$1(destination);
@@ -1175,7 +1183,11 @@
1175
1183
  userId: result.userId,
1176
1184
  manifest: result.result,
1177
1185
  browserPackages: Object.values(providers),
1186
+ storageId: result.storageId,
1178
1187
  });
1188
+ if (result.storageId != null) {
1189
+ savePerKey(preferences.edgeURL, 'local', tagStorage, result.storageId, storageIdKey);
1190
+ }
1179
1191
  handleManifest(preferences.edgeURL, result);
1180
1192
  try {
1181
1193
  window.dispatchEvent(new CustomEvent('edgetag-initialized', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-browser",
3
- "version": "0.62.1",
3
+ "version": "0.63.0",
4
4
  "description": "Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",