@blotoutio/edgetag-sdk-browser 0.62.0 → 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 +19 -6
  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) {
@@ -485,7 +486,8 @@
485
486
  return Object.fromEntries(cookie
486
487
  .split(/;\s+/)
487
488
  .map((r) => r.split('=').map((str) => str.trim()))
488
- .map(([cookieKey, cookieValue]) => {
489
+ .map(([cookieKey, ...cookieValues]) => {
490
+ const cookieValue = cookieValues.join('=');
489
491
  if (!cookieKey) {
490
492
  return [];
491
493
  }
@@ -561,7 +563,7 @@
561
563
  referrer: getReferrer(destination),
562
564
  search: getSearch(destination),
563
565
  locale: getLocale(),
564
- sdkVersion: "0.62.0" ,
566
+ sdkVersion: "0.63.0" ,
565
567
  ...(payload || {}),
566
568
  };
567
569
  let storage = {};
@@ -843,11 +845,11 @@
843
845
 
844
846
  const handleConsent = (consent, options) => {
845
847
  if (options === null || options === void 0 ? void 0 : options.destination) {
846
- processConsent(options.destination, consent, options === null || options === void 0 ? void 0 : options.localSave);
848
+ processConsent(options.destination, consent, options);
847
849
  return;
848
850
  }
849
851
  getInstances().forEach((destination) => {
850
- processConsent(destination, consent, options === null || options === void 0 ? void 0 : options.localSave);
852
+ processConsent(destination, consent, options);
851
853
  });
852
854
  };
853
855
  const saveConsent = (destination, consent) => {
@@ -856,16 +858,23 @@
856
858
  });
857
859
  savePerKey(destination, 'local', tagStorage, consent, consentKey);
858
860
  };
859
- const processConsent = (destination, consent, localSave) => {
861
+ const processConsent = (destination, consent, options) => {
860
862
  const existingConsent = getConsent$1(destination);
861
863
  if (areEqual(existingConsent, consent)) {
862
864
  return;
863
865
  }
866
+ if (!getSetting(destination, 'initialized')) {
867
+ addStub(destination, {
868
+ name: 'consent',
869
+ arguments: [consent, options],
870
+ });
871
+ return;
872
+ }
864
873
  const payload = {
865
874
  consentString: consent,
866
875
  };
867
876
  saveConsent(destination, consent);
868
- if (!localSave) {
877
+ if (!(options === null || options === void 0 ? void 0 : options.localSave)) {
869
878
  postRequest(getConsentURL(destination), payload).catch(error);
870
879
  }
871
880
  const userId = getUserId$1(destination);
@@ -1174,7 +1183,11 @@
1174
1183
  userId: result.userId,
1175
1184
  manifest: result.result,
1176
1185
  browserPackages: Object.values(providers),
1186
+ storageId: result.storageId,
1177
1187
  });
1188
+ if (result.storageId != null) {
1189
+ savePerKey(preferences.edgeURL, 'local', tagStorage, result.storageId, storageIdKey);
1190
+ }
1178
1191
  handleManifest(preferences.edgeURL, result);
1179
1192
  try {
1180
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.0",
3
+ "version": "0.63.0",
4
4
  "description": "Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",