@blotoutio/edgetag-sdk-js 0.61.0 → 0.62.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.js +12 -4
  2. package/index.mjs +12 -4
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -484,7 +484,8 @@ const parseCookies = (cookie) => {
484
484
  return Object.fromEntries(cookie
485
485
  .split(/;\s+/)
486
486
  .map((r) => r.split('=').map((str) => str.trim()))
487
- .map(([cookieKey, cookieValue]) => {
487
+ .map(([cookieKey, ...cookieValues]) => {
488
+ const cookieValue = cookieValues.join('=');
488
489
  if (!cookieKey) {
489
490
  return [];
490
491
  }
@@ -560,7 +561,7 @@ const getStandardPayload = (destination, payload) => {
560
561
  referrer: getReferrer(destination),
561
562
  search: getSearch(destination),
562
563
  locale: getLocale(),
563
- sdkVersion: "0.61.0" ,
564
+ sdkVersion: "0.62.1" ,
564
565
  ...(payload || {}),
565
566
  };
566
567
  let storage = {};
@@ -614,11 +615,14 @@ const generateUrl = (destination, path) => {
614
615
  }
615
616
  return `${destination}${path}`;
616
617
  };
617
- const getTagURL = (destination, options) => {
618
+ const getTagURL = (destination, eventName, options) => {
618
619
  const parsedUrl = new URL(generateUrl(destination, '/tag'));
619
620
  if (options === null || options === void 0 ? void 0 : options.sync) {
620
621
  parsedUrl.searchParams.set('sync', 'true');
621
622
  }
623
+ if (eventName) {
624
+ parsedUrl.searchParams.set('name', eventName);
625
+ }
622
626
  return parsedUrl.toString();
623
627
  };
624
628
  const getInitURL = (destination) => {
@@ -680,7 +684,7 @@ const sendTag = (destination, { eventName, eventId, data, providerData, provider
680
684
  if (providers) {
681
685
  payload.providers = providers;
682
686
  }
683
- postRequest(getTagURL(destination, options), payload, options).catch(error);
687
+ postRequest(getTagURL(destination, eventName, options), payload, options).catch(error);
684
688
  };
685
689
  const processTag = (destination, eventName, data = {}, providers, options) => {
686
690
  if (!getSetting(destination, 'initialized')) {
@@ -727,6 +731,7 @@ const processTag = (destination, eventName, data = {}, providers, options) => {
727
731
  sendTag: sendTag.bind(null, destination),
728
732
  manifestVariables: variable.variableSet,
729
733
  executionContext,
734
+ destination,
730
735
  });
731
736
  }
732
737
  providerData[pkg.name] = result;
@@ -1152,6 +1157,9 @@ const handleInit = (preferences) => {
1152
1157
  error('Initialization failed');
1153
1158
  return;
1154
1159
  }
1160
+ if (result.isNewUser && result.consent) {
1161
+ saveConsent(preferences.edgeURL, result.consent);
1162
+ }
1155
1163
  const providers = {};
1156
1164
  (_a = result.result) === null || _a === void 0 ? void 0 : _a.forEach((pkg) => {
1157
1165
  const provider = browserPackages[pkg.package];
package/index.mjs CHANGED
@@ -482,7 +482,8 @@ const parseCookies = (cookie) => {
482
482
  return Object.fromEntries(cookie
483
483
  .split(/;\s+/)
484
484
  .map((r) => r.split('=').map((str) => str.trim()))
485
- .map(([cookieKey, cookieValue]) => {
485
+ .map(([cookieKey, ...cookieValues]) => {
486
+ const cookieValue = cookieValues.join('=');
486
487
  if (!cookieKey) {
487
488
  return [];
488
489
  }
@@ -558,7 +559,7 @@ const getStandardPayload = (destination, payload) => {
558
559
  referrer: getReferrer(destination),
559
560
  search: getSearch(destination),
560
561
  locale: getLocale(),
561
- sdkVersion: "0.61.0" ,
562
+ sdkVersion: "0.62.1" ,
562
563
  ...(payload || {}),
563
564
  };
564
565
  let storage = {};
@@ -612,11 +613,14 @@ const generateUrl = (destination, path) => {
612
613
  }
613
614
  return `${destination}${path}`;
614
615
  };
615
- const getTagURL = (destination, options) => {
616
+ const getTagURL = (destination, eventName, options) => {
616
617
  const parsedUrl = new URL(generateUrl(destination, '/tag'));
617
618
  if (options === null || options === void 0 ? void 0 : options.sync) {
618
619
  parsedUrl.searchParams.set('sync', 'true');
619
620
  }
621
+ if (eventName) {
622
+ parsedUrl.searchParams.set('name', eventName);
623
+ }
620
624
  return parsedUrl.toString();
621
625
  };
622
626
  const getInitURL = (destination) => {
@@ -678,7 +682,7 @@ const sendTag = (destination, { eventName, eventId, data, providerData, provider
678
682
  if (providers) {
679
683
  payload.providers = providers;
680
684
  }
681
- postRequest(getTagURL(destination, options), payload, options).catch(error);
685
+ postRequest(getTagURL(destination, eventName, options), payload, options).catch(error);
682
686
  };
683
687
  const processTag = (destination, eventName, data = {}, providers, options) => {
684
688
  if (!getSetting(destination, 'initialized')) {
@@ -725,6 +729,7 @@ const processTag = (destination, eventName, data = {}, providers, options) => {
725
729
  sendTag: sendTag.bind(null, destination),
726
730
  manifestVariables: variable.variableSet,
727
731
  executionContext,
732
+ destination,
728
733
  });
729
734
  }
730
735
  providerData[pkg.name] = result;
@@ -1150,6 +1155,9 @@ const handleInit = (preferences) => {
1150
1155
  error('Initialization failed');
1151
1156
  return;
1152
1157
  }
1158
+ if (result.isNewUser && result.consent) {
1159
+ saveConsent(preferences.edgeURL, result.consent);
1160
+ }
1153
1161
  const providers = {};
1154
1162
  (_a = result.result) === null || _a === void 0 ? void 0 : _a.forEach((pkg) => {
1155
1163
  const provider = browserPackages[pkg.package];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-js",
3
- "version": "0.61.0",
3
+ "version": "0.62.1",
4
4
  "description": "JS SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",