@blotoutio/edgetag-sdk-js 0.4.0 → 0.4.3

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/api/data.d.ts CHANGED
@@ -1,2 +1 @@
1
- import { DataValue } from '../typings';
2
- export declare const handleData: (data: Record<string, DataValue>) => void;
1
+ export declare const handleData: (data: Record<string, string>) => void;
package/api/getData.d.ts CHANGED
@@ -1,2 +1 @@
1
- import { DataValue } from '../typings';
2
- export declare const handleGetData: (keys: string[], callback: (data: Record<string, DataValue>) => void) => void;
1
+ export declare const handleGetData: (keys: string[], callback: (data: Record<string, string>) => void) => void;
@@ -1,8 +1,7 @@
1
1
  import { PersistType } from '../typings/internal';
2
- import { DataValue } from '../typings';
3
2
  export declare const saveDataPerKey: (persistType: PersistType, provider: string, value: unknown, key: string) => void;
4
3
  export declare const savePerKey: (persistType: PersistType, provider: string, value: unknown, key: string) => void;
5
4
  export declare const getDataPerKey: (persistType: PersistType, provider: string, key: string) => unknown;
6
5
  export declare const saveData: (persistType: PersistType, value: unknown, key?: string) => void;
7
6
  export declare const getData: (persistType: PersistType, key?: string) => Record<string, Record<string, unknown>>;
8
- export declare const saveDataAPI: (data: Record<string, DataValue>) => void;
7
+ export declare const saveKV: (data: Record<string, string>) => void;
package/index.cjs CHANGED
@@ -81,18 +81,18 @@ const getData$1 = (persistType, key = initKey) => {
81
81
 
82
82
  return getLocal(key);
83
83
  };
84
- const saveDataAPI = data => {
84
+ const saveKV = data => {
85
85
  let currentSession = getData$1('session');
86
86
 
87
87
  if (!currentSession) {
88
88
  currentSession = {};
89
89
  }
90
90
 
91
- if (!currentSession['data']) {
92
- currentSession['data'] = {};
91
+ if (!currentSession['kv']) {
92
+ currentSession['kv'] = {};
93
93
  }
94
94
 
95
- currentSession['data'] = Object.assign(Object.assign({}, currentSession['data']), data);
95
+ currentSession['kv'] = Object.assign(Object.assign({}, currentSession['kv']), data);
96
96
  saveData('session', currentSession);
97
97
  };
98
98
 
@@ -478,7 +478,7 @@ const handleUser = (key, value) => {
478
478
  return;
479
479
  }
480
480
 
481
- saveDataAPI({
481
+ saveKV({
482
482
  [key]: value
483
483
  });
484
484
  postRequest(getUserURL(), {
@@ -493,7 +493,7 @@ const handleData = data => {
493
493
  return;
494
494
  }
495
495
 
496
- saveDataAPI(data);
496
+ saveKV(data);
497
497
  postRequest(getDataURL(), {
498
498
  data
499
499
  }).catch(info);
package/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Data, DataValue, InitPreferences, UserKey } from './typings';
1
+ import { Data, InitPreferences, UserKey } from './typings';
2
2
  export declare const init: (preferences: InitPreferences) => void;
3
3
  export declare const tag: (name: string, data?: Data, providers?: Data) => void;
4
4
  export declare const consent: (consent: Data) => void;
5
5
  export declare const user: (key: UserKey, value: string) => void;
6
- export declare const data: (data: Record<string, DataValue>) => void;
7
- export declare const getData: (keys: string[], callback: (data: Record<string, DataValue>) => void) => void;
6
+ export declare const data: (data: Record<string, string>) => void;
7
+ export declare const getData: (keys: string[], callback: (data: Record<string, string>) => void) => void;
8
8
  export declare const keys: (callback: (keys: string[]) => void) => void;
package/index.js CHANGED
@@ -77,18 +77,18 @@ const getData$1 = (persistType, key = initKey) => {
77
77
 
78
78
  return getLocal(key);
79
79
  };
80
- const saveDataAPI = data => {
80
+ const saveKV = data => {
81
81
  let currentSession = getData$1('session');
82
82
 
83
83
  if (!currentSession) {
84
84
  currentSession = {};
85
85
  }
86
86
 
87
- if (!currentSession['data']) {
88
- currentSession['data'] = {};
87
+ if (!currentSession['kv']) {
88
+ currentSession['kv'] = {};
89
89
  }
90
90
 
91
- currentSession['data'] = Object.assign(Object.assign({}, currentSession['data']), data);
91
+ currentSession['kv'] = Object.assign(Object.assign({}, currentSession['kv']), data);
92
92
  saveData('session', currentSession);
93
93
  };
94
94
 
@@ -474,7 +474,7 @@ const handleUser = (key, value) => {
474
474
  return;
475
475
  }
476
476
 
477
- saveDataAPI({
477
+ saveKV({
478
478
  [key]: value
479
479
  });
480
480
  postRequest(getUserURL(), {
@@ -489,7 +489,7 @@ const handleData = data => {
489
489
  return;
490
490
  }
491
491
 
492
- saveDataAPI(data);
492
+ saveKV(data);
493
493
  postRequest(getDataURL(), {
494
494
  data
495
495
  }).catch(info);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-js",
3
- "version": "0.4.0",
3
+ "version": "0.4.3",
4
4
  "description": "JS SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",
@@ -13,8 +13,6 @@ type UserKey =
13
13
 
14
14
  type Data = Record<string, unknown>
15
15
 
16
- type DataValue = string | number | boolean
17
-
18
16
  interface InitPreferences {
19
17
  edgeURL: string
20
18
  disableConsentCheck?: boolean
@@ -32,11 +30,11 @@ export declare const consent: (consent: Data) => void
32
30
 
33
31
  export declare const user: (key: UserKey, value: string) => void
34
32
 
35
- export declare const data: (data: Record<string, DataValue>) => void
33
+ export declare const data: (data: Record<string, string>) => void
36
34
 
37
35
  export declare const getData: (
38
36
  keys: string[],
39
- callback: (data: Record<string, DataValue>) => void
37
+ callback: (data: Record<string, string>) => void
40
38
  ) => void
41
39
 
42
40
  export declare const keys: (callback: (keys: string[]) => void) => void
@@ -1,4 +1,4 @@
1
- import { Data, DataValue, UserKey } from './index'
1
+ import { Data, UserKey } from './index'
2
2
 
3
3
  type PersistType = 'local' | 'session'
4
4
 
@@ -23,7 +23,7 @@ type UserPayload = {
23
23
  }
24
24
 
25
25
  type DataPayload = {
26
- data: Record<string, DataValue>
26
+ data: Record<string, string>
27
27
  }
28
28
 
29
29
  type PostPayload = {