@blotoutio/edgetag-sdk-browser 0.10.2 → 0.10.4-beta.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 (2) hide show
  1. package/index.js +2 -17
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -295,8 +295,6 @@
295
295
  const tagStorage = 'edgeTag';
296
296
  const consentKey = 'consent';
297
297
  const keyPrefix = `_worker`;
298
- const backupCookieKey = `cookieId`;
299
- const cookieKey = 'tag_user_id';
300
298
 
301
299
  const initKey = `${keyPrefix}Store`;
302
300
  const saveDataPerKey = (persistType, provider, value, key) => {
@@ -475,11 +473,7 @@
475
473
  if (initUserId) {
476
474
  return initUserId;
477
475
  }
478
- const data = getDataPerKey('local', tagStorage, backupCookieKey);
479
- if (!data || data.length < 10) {
480
- return getCookieValue(cookieKey);
481
- }
482
- return data;
476
+ return getCookieValue('tag_user_id');
483
477
  };
484
478
  const setUserId = (userId) => {
485
479
  initUserId = userId;
@@ -490,13 +484,6 @@
490
484
  Accept: 'application/json; charset=utf-8',
491
485
  EdgeTagUserId: handleGetUserId(),
492
486
  });
493
- const cookieIdFallback = () => {
494
- const data = getDataPerKey('local', tagStorage, backupCookieKey);
495
- if (data) {
496
- return;
497
- }
498
- savePerKey('local', tagStorage, getCookieValue(cookieKey), backupCookieKey);
499
- };
500
487
  const beacon = (url, payload) => {
501
488
  try {
502
489
  let blob;
@@ -518,7 +505,6 @@
518
505
  return new Promise((resolve, reject) => {
519
506
  const req = https.request(url, options, (res) => {
520
507
  res.on('data', (data) => {
521
- cookieIdFallback();
522
508
  try {
523
509
  data = JSON.parse(data);
524
510
  }
@@ -564,7 +550,6 @@
564
550
  if (data.status < 200 || data.status >= 300) {
565
551
  return Promise.reject(new Error(`Request failed with code ${data.status}: ${JSON.stringify(data.body)}`));
566
552
  }
567
- cookieIdFallback();
568
553
  return Promise.resolve(data.body);
569
554
  })
570
555
  .catch((error) => {
@@ -572,7 +557,7 @@
572
557
  });
573
558
  });
574
559
  const getStandardPayload = (payload) => {
575
- const data = Object.assign({ pageUrl: getPageUrl(), pageTitle: getPageTitle(), userAgent: getUserAgent(), referrer: getReferrer(), search: getSearch(), sdkVersion: "0.10.2" }, (payload || {}));
560
+ const data = Object.assign({ pageUrl: getPageUrl(), pageTitle: getPageTitle(), userAgent: getUserAgent(), referrer: getReferrer(), search: getSearch(), sdkVersion: "0.10.3" }, (payload || {}));
576
561
  let storage = {};
577
562
  const session = getData$1('session');
578
563
  if (session) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-browser",
3
- "version": "0.10.2",
3
+ "version": "0.10.4-beta.1",
4
4
  "description": "Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",