@blotoutio/edgetag-sdk-js 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 (3) hide show
  1. package/index.cjs +2 -17
  2. package/index.esm.js +2 -17
  3. package/package.json +1 -1
package/index.cjs CHANGED
@@ -314,8 +314,6 @@ const allowProviderWithConsent = (providers, providerId) => {
314
314
  const tagStorage = 'edgeTag';
315
315
  const consentKey = 'consent';
316
316
  const keyPrefix = `_worker`;
317
- const backupCookieKey = `cookieId`;
318
- const cookieKey = 'tag_user_id';
319
317
 
320
318
  const initKey = `${keyPrefix}Store`;
321
319
  const saveDataPerKey = (persistType, provider, value, key) => {
@@ -494,11 +492,7 @@ const handleGetUserId = () => {
494
492
  if (initUserId) {
495
493
  return initUserId;
496
494
  }
497
- const data = getDataPerKey('local', tagStorage, backupCookieKey);
498
- if (!data || data.length < 10) {
499
- return getCookieValue(cookieKey);
500
- }
501
- return data;
495
+ return getCookieValue('tag_user_id');
502
496
  };
503
497
  const setUserId = (userId) => {
504
498
  initUserId = userId;
@@ -509,13 +503,6 @@ const getHeaders = () => ({
509
503
  Accept: 'application/json; charset=utf-8',
510
504
  EdgeTagUserId: handleGetUserId(),
511
505
  });
512
- const cookieIdFallback = () => {
513
- const data = getDataPerKey('local', tagStorage, backupCookieKey);
514
- if (data) {
515
- return;
516
- }
517
- savePerKey('local', tagStorage, getCookieValue(cookieKey), backupCookieKey);
518
- };
519
506
  const beacon = (url, payload) => {
520
507
  try {
521
508
  let blob;
@@ -537,7 +524,6 @@ const fallbackAjax = (method, url, payload) => __awaiter(void 0, void 0, void 0,
537
524
  return new Promise((resolve, reject) => {
538
525
  const req = https.request(url, options, (res) => {
539
526
  res.on('data', (data) => {
540
- cookieIdFallback();
541
527
  try {
542
528
  data = JSON.parse(data);
543
529
  }
@@ -583,7 +569,6 @@ const ajax = (method, url, payload) => __awaiter(void 0, void 0, void 0, functio
583
569
  if (data.status < 200 || data.status >= 300) {
584
570
  return Promise.reject(new Error(`Request failed with code ${data.status}: ${JSON.stringify(data.body)}`));
585
571
  }
586
- cookieIdFallback();
587
572
  return Promise.resolve(data.body);
588
573
  })
589
574
  .catch((error) => {
@@ -591,7 +576,7 @@ const ajax = (method, url, payload) => __awaiter(void 0, void 0, void 0, functio
591
576
  });
592
577
  });
593
578
  const getStandardPayload = (payload) => {
594
- const data = Object.assign({ pageUrl: getPageUrl(), pageTitle: getPageTitle(), userAgent: getUserAgent(), referrer: getReferrer(), search: getSearch(), sdkVersion: "0.10.2" }, (payload || {}));
579
+ const data = Object.assign({ pageUrl: getPageUrl(), pageTitle: getPageTitle(), userAgent: getUserAgent(), referrer: getReferrer(), search: getSearch(), sdkVersion: "0.10.3" }, (payload || {}));
595
580
  let storage = {};
596
581
  const session = getData$1('session');
597
582
  if (session) {
package/index.esm.js CHANGED
@@ -292,8 +292,6 @@ const allowProviderWithConsent = (providers, providerId) => {
292
292
  const tagStorage = 'edgeTag';
293
293
  const consentKey = 'consent';
294
294
  const keyPrefix = `_worker`;
295
- const backupCookieKey = `cookieId`;
296
- const cookieKey = 'tag_user_id';
297
295
 
298
296
  const initKey = `${keyPrefix}Store`;
299
297
  const saveDataPerKey = (persistType, provider, value, key) => {
@@ -472,11 +470,7 @@ const handleGetUserId = () => {
472
470
  if (initUserId) {
473
471
  return initUserId;
474
472
  }
475
- const data = getDataPerKey('local', tagStorage, backupCookieKey);
476
- if (!data || data.length < 10) {
477
- return getCookieValue(cookieKey);
478
- }
479
- return data;
473
+ return getCookieValue('tag_user_id');
480
474
  };
481
475
  const setUserId = (userId) => {
482
476
  initUserId = userId;
@@ -487,13 +481,6 @@ const getHeaders = () => ({
487
481
  Accept: 'application/json; charset=utf-8',
488
482
  EdgeTagUserId: handleGetUserId(),
489
483
  });
490
- const cookieIdFallback = () => {
491
- const data = getDataPerKey('local', tagStorage, backupCookieKey);
492
- if (data) {
493
- return;
494
- }
495
- savePerKey('local', tagStorage, getCookieValue(cookieKey), backupCookieKey);
496
- };
497
484
  const beacon = (url, payload) => {
498
485
  try {
499
486
  let blob;
@@ -515,7 +502,6 @@ const fallbackAjax = (method, url, payload) => __awaiter(void 0, void 0, void 0,
515
502
  return new Promise((resolve, reject) => {
516
503
  const req = https.request(url, options, (res) => {
517
504
  res.on('data', (data) => {
518
- cookieIdFallback();
519
505
  try {
520
506
  data = JSON.parse(data);
521
507
  }
@@ -561,7 +547,6 @@ const ajax = (method, url, payload) => __awaiter(void 0, void 0, void 0, functio
561
547
  if (data.status < 200 || data.status >= 300) {
562
548
  return Promise.reject(new Error(`Request failed with code ${data.status}: ${JSON.stringify(data.body)}`));
563
549
  }
564
- cookieIdFallback();
565
550
  return Promise.resolve(data.body);
566
551
  })
567
552
  .catch((error) => {
@@ -569,7 +554,7 @@ const ajax = (method, url, payload) => __awaiter(void 0, void 0, void 0, functio
569
554
  });
570
555
  });
571
556
  const getStandardPayload = (payload) => {
572
- const data = Object.assign({ pageUrl: getPageUrl(), pageTitle: getPageTitle(), userAgent: getUserAgent(), referrer: getReferrer(), search: getSearch(), sdkVersion: "0.10.2" }, (payload || {}));
557
+ const data = Object.assign({ pageUrl: getPageUrl(), pageTitle: getPageTitle(), userAgent: getUserAgent(), referrer: getReferrer(), search: getSearch(), sdkVersion: "0.10.3" }, (payload || {}));
573
558
  let storage = {};
574
559
  const session = getData$1('session');
575
560
  if (session) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-js",
3
- "version": "0.10.2",
3
+ "version": "0.10.4-beta.1",
4
4
  "description": "JS SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",