@blotoutio/edgetag-sdk-js 0.4.3 → 0.5.0

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 +1,2 @@
1
- export declare const handleData: (data: Record<string, string>) => void;
1
+ import { EventOptions } from '../typings';
2
+ export declare const handleData: (data: Record<string, string>, options?: EventOptions) => void;
package/api/tag.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { Data } from '../typings';
2
- export declare const handleTag: (name: string, data?: Data, providers?: Data) => void;
1
+ import { Data, EventOptions } from '../typings';
2
+ export declare const handleTag: (name: string, data?: Data, providers?: Data, options?: EventOptions) => void;
package/api/user.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { UserKey } from '../typings';
2
- export declare const handleUser: (key: UserKey, value: string) => void;
1
+ import { EventOptions, UserKey } from '../typings';
2
+ export declare const handleUser: (key: UserKey, value: string, options?: EventOptions) => void;
package/index.cjs CHANGED
@@ -330,7 +330,7 @@ const handleConsent = consent => {
330
330
  postRequest(getConsentURL(), payload).catch(info);
331
331
  };
332
332
 
333
- const handleTag = (name, data, providers) => {
333
+ const handleTag = (name, data, providers, options) => {
334
334
  const payload = {
335
335
  eventName: name
336
336
  };
@@ -348,7 +348,7 @@ const handleTag = (name, data, providers) => {
348
348
  return;
349
349
  }
350
350
 
351
- postRequest(getTagURL(), payload).catch(info);
351
+ postRequest(getTagURL(), payload, options).catch(info);
352
352
  };
353
353
 
354
354
  const getCookieValue = key => {
@@ -472,7 +472,7 @@ const handleInit = preferences => {
472
472
  }).catch(info);
473
473
  };
474
474
 
475
- const handleUser = (key, value) => {
475
+ const handleUser = (key, value, options) => {
476
476
  if (!key || !value) {
477
477
  console.error('Key or Value is missing in user API.');
478
478
  return;
@@ -484,10 +484,10 @@ const handleUser = (key, value) => {
484
484
  postRequest(getUserURL(), {
485
485
  key,
486
486
  value
487
- }).catch(info);
487
+ }, options).catch(info);
488
488
  };
489
489
 
490
- const handleData = data => {
490
+ const handleData = (data, options) => {
491
491
  if (!data || Object.keys(data).length === 0) {
492
492
  console.error('Provide data for data API.');
493
493
  return;
@@ -496,7 +496,7 @@ const handleData = data => {
496
496
  saveKV(data);
497
497
  postRequest(getDataURL(), {
498
498
  data
499
- }).catch(info);
499
+ }, options).catch(info);
500
500
  };
501
501
 
502
502
  const handleGetData = (keys, callback) => {
@@ -519,17 +519,17 @@ const handleKeys = callback => {
519
519
  const init = preferences => {
520
520
  handleInit(preferences);
521
521
  };
522
- const tag = (name, data, providers) => {
523
- handleTag(name, data, providers);
522
+ const tag = (name, data, providers, options) => {
523
+ handleTag(name, data, providers, options);
524
524
  };
525
525
  const consent = consent => {
526
526
  handleConsent(consent);
527
527
  };
528
- const user = (key, value) => {
529
- handleUser(key, value);
528
+ const user = (key, value, options) => {
529
+ handleUser(key, value, options);
530
530
  };
531
- const data = data => {
532
- handleData(data);
531
+ const data = (data, options) => {
532
+ handleData(data, options);
533
533
  };
534
534
  const getData = (keys, callback) => {
535
535
  handleGetData(keys, callback);
package/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Data, InitPreferences, UserKey } from './typings';
1
+ import { Data, EventOptions, InitPreferences, UserKey } from './typings';
2
2
  export declare const init: (preferences: InitPreferences) => void;
3
- export declare const tag: (name: string, data?: Data, providers?: Data) => void;
3
+ export declare const tag: (name: string, data?: Data, providers?: Data, options?: EventOptions) => void;
4
4
  export declare const consent: (consent: Data) => void;
5
- export declare const user: (key: UserKey, value: string) => void;
6
- export declare const data: (data: Record<string, string>) => void;
5
+ export declare const user: (key: UserKey, value: string, options?: EventOptions) => void;
6
+ export declare const data: (data: Record<string, string>, options?: EventOptions) => void;
7
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
@@ -326,7 +326,7 @@ const handleConsent = consent => {
326
326
  postRequest(getConsentURL(), payload).catch(info);
327
327
  };
328
328
 
329
- const handleTag = (name, data, providers) => {
329
+ const handleTag = (name, data, providers, options) => {
330
330
  const payload = {
331
331
  eventName: name
332
332
  };
@@ -344,7 +344,7 @@ const handleTag = (name, data, providers) => {
344
344
  return;
345
345
  }
346
346
 
347
- postRequest(getTagURL(), payload).catch(info);
347
+ postRequest(getTagURL(), payload, options).catch(info);
348
348
  };
349
349
 
350
350
  const getCookieValue = key => {
@@ -468,7 +468,7 @@ const handleInit = preferences => {
468
468
  }).catch(info);
469
469
  };
470
470
 
471
- const handleUser = (key, value) => {
471
+ const handleUser = (key, value, options) => {
472
472
  if (!key || !value) {
473
473
  console.error('Key or Value is missing in user API.');
474
474
  return;
@@ -480,10 +480,10 @@ const handleUser = (key, value) => {
480
480
  postRequest(getUserURL(), {
481
481
  key,
482
482
  value
483
- }).catch(info);
483
+ }, options).catch(info);
484
484
  };
485
485
 
486
- const handleData = data => {
486
+ const handleData = (data, options) => {
487
487
  if (!data || Object.keys(data).length === 0) {
488
488
  console.error('Provide data for data API.');
489
489
  return;
@@ -492,7 +492,7 @@ const handleData = data => {
492
492
  saveKV(data);
493
493
  postRequest(getDataURL(), {
494
494
  data
495
- }).catch(info);
495
+ }, options).catch(info);
496
496
  };
497
497
 
498
498
  const handleGetData = (keys, callback) => {
@@ -515,17 +515,17 @@ const handleKeys = callback => {
515
515
  const init = preferences => {
516
516
  handleInit(preferences);
517
517
  };
518
- const tag = (name, data, providers) => {
519
- handleTag(name, data, providers);
518
+ const tag = (name, data, providers, options) => {
519
+ handleTag(name, data, providers, options);
520
520
  };
521
521
  const consent = consent => {
522
522
  handleConsent(consent);
523
523
  };
524
- const user = (key, value) => {
525
- handleUser(key, value);
524
+ const user = (key, value, options) => {
525
+ handleUser(key, value, options);
526
526
  };
527
- const data = data => {
528
- handleData(data);
527
+ const data = (data, options) => {
528
+ handleData(data, options);
529
529
  };
530
530
  const getData = (keys, callback) => {
531
531
  handleGetData(keys, callback);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-js",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "description": "JS SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",