@blotoutio/edgetag-sdk-js 0.24.0 → 0.24.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.
package/index.cjs CHANGED
@@ -512,7 +512,7 @@ const getStandardPayload = (payload) => {
512
512
  referrer: getReferrer(),
513
513
  search: getSearch(),
514
514
  locale: getLocale(),
515
- sdkVersion: "0.24.0" ,
515
+ sdkVersion: "0.24.1" ,
516
516
  ...(payload || {}),
517
517
  };
518
518
  let storage = {};
@@ -582,12 +582,10 @@ const getConsent = () => {
582
582
 
583
583
  const manifestVariables = {};
584
584
  const addProviderVariable = (name, variables, tagName) => {
585
- if (variables) {
586
- manifestVariables[name] = {
587
- ...manifestVariables[name],
588
- [tagName]: variables,
589
- };
590
- }
585
+ manifestVariables[name] = {
586
+ ...manifestVariables[name],
587
+ [tagName]: variables || {},
588
+ };
591
589
  };
592
590
  const getProviderVariables = (name) => {
593
591
  if (!name) {
@@ -665,20 +663,18 @@ const handleTag = (eventName, data = {}, providers, options) => {
665
663
  return;
666
664
  }
667
665
  const variables = getProviderVariables(pkg.name);
668
- const result = [];
669
- for (const variableSet of Object.values(variables)) {
670
- result.push(pkg.tag({
666
+ const result = {};
667
+ for (const [tagName, variableSet] of Object.entries(variables)) {
668
+ result[tagName] = pkg.tag({
671
669
  userId,
672
670
  eventName,
673
671
  eventId,
674
672
  data: JSON.parse(JSON.stringify(data)),
675
673
  sendTag,
676
674
  manifestVariables: variableSet,
677
- }));
678
- }
679
- if (result.length) {
680
- providerData[pkg.name] = result;
675
+ });
681
676
  }
677
+ providerData[pkg.name] = result;
682
678
  });
683
679
  }
684
680
  sendTag({
package/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  // TODO this all located in '@blotoutio/shared/utility-sdk'
2
2
 
3
+ import { Library } from '@blotoutio/cdn/types'
4
+
3
5
  type PersistType = 'local' | 'session' | 'edge'
4
6
 
5
7
  type EventOptions = {
@@ -12,7 +14,7 @@ export type SendTag = {
12
14
  eventName: string
13
15
  eventId: string
14
16
  data: Data
15
- providerData?: Data
17
+ providerData?: Partial<Record<Library, Record<string, Data>>>
16
18
  providers?: Data
17
19
  options?: EventOptions
18
20
  }
package/index.esm.js CHANGED
@@ -510,7 +510,7 @@ const getStandardPayload = (payload) => {
510
510
  referrer: getReferrer(),
511
511
  search: getSearch(),
512
512
  locale: getLocale(),
513
- sdkVersion: "0.24.0" ,
513
+ sdkVersion: "0.24.1" ,
514
514
  ...(payload || {}),
515
515
  };
516
516
  let storage = {};
@@ -580,12 +580,10 @@ const getConsent = () => {
580
580
 
581
581
  const manifestVariables = {};
582
582
  const addProviderVariable = (name, variables, tagName) => {
583
- if (variables) {
584
- manifestVariables[name] = {
585
- ...manifestVariables[name],
586
- [tagName]: variables,
587
- };
588
- }
583
+ manifestVariables[name] = {
584
+ ...manifestVariables[name],
585
+ [tagName]: variables || {},
586
+ };
589
587
  };
590
588
  const getProviderVariables = (name) => {
591
589
  if (!name) {
@@ -663,20 +661,18 @@ const handleTag = (eventName, data = {}, providers, options) => {
663
661
  return;
664
662
  }
665
663
  const variables = getProviderVariables(pkg.name);
666
- const result = [];
667
- for (const variableSet of Object.values(variables)) {
668
- result.push(pkg.tag({
664
+ const result = {};
665
+ for (const [tagName, variableSet] of Object.entries(variables)) {
666
+ result[tagName] = pkg.tag({
669
667
  userId,
670
668
  eventName,
671
669
  eventId,
672
670
  data: JSON.parse(JSON.stringify(data)),
673
671
  sendTag,
674
672
  manifestVariables: variableSet,
675
- }));
676
- }
677
- if (result.length) {
678
- providerData[pkg.name] = result;
673
+ });
679
674
  }
675
+ providerData[pkg.name] = result;
680
676
  });
681
677
  }
682
678
  sendTag({
package/internal.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Library } from '@blotoutio/cdn/types'
1
2
  import { UserKey, Data } from './index'
2
3
 
3
4
  type Navigator = {
@@ -8,7 +9,7 @@ type TagPayload = {
8
9
  eventName: string
9
10
  eventId: string
10
11
  timestamp: number
11
- providerData?: Data
12
+ providerData?: Partial<Record<Library, Record<string, Data>>>
12
13
  data?: Data
13
14
  providers?: Data
14
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-js",
3
- "version": "0.24.0",
3
+ "version": "0.24.1",
4
4
  "description": "JS SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",