saasco-sdk 0.1.39 → 0.1.41

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.js CHANGED
@@ -4,10 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib = require('tslib');
6
6
  var psl = require('psl');
7
+ var jsSha256 = require('js-sha256');
7
8
  var uuid$1 = require('@lukeed/uuid');
8
9
  var zod = require('zod');
9
10
 
10
- var version = "0.1.39";
11
+ var version = "0.1.41";
11
12
 
12
13
  const timezones = {
13
14
  'Asia/Barnaul': 'RU',
@@ -639,7 +640,7 @@ function createFacebookPixelIntegration(config) {
639
640
  window.fbq(trackType, fbEventName);
640
641
  }
641
642
  },
642
- identify: (userId, properties, context) => tslib.__awaiter(this, void 0, void 0, function* () {
643
+ identify: (userId, properties, context) => {
643
644
  try {
644
645
  if (typeof window !== 'undefined' && window.fbq) {
645
646
  const amValues = coerceMetaConversionsAmValues(Object.assign(Object.assign({}, properties || {}), userId ? {
@@ -647,7 +648,7 @@ function createFacebookPixelIntegration(config) {
647
648
  } : {}));
648
649
  const am = {};
649
650
  if (amValues.external_id) am['external_id'] = amValues.external_id;
650
- if (amValues.em) am['em'] = yield sha256Hex(amValues.em);
651
+ if (amValues.em) am['em'] = jsSha256.sha256(amValues.em);
651
652
  if (amValues.fn) am['fn'] = amValues.fn;
652
653
  if (amValues.ln) am['ln'] = amValues.ln;
653
654
  if (amValues.ph) am['ph'] = amValues.ph;
@@ -664,7 +665,7 @@ function createFacebookPixelIntegration(config) {
664
665
  } catch (error) {
665
666
  console.error('Error identifying user in Meta Pixel:', error);
666
667
  }
667
- })
668
+ }
668
669
  };
669
670
  }
670
671
  function getFacebookEventName(eventName, eventMapping) {
@@ -805,14 +806,6 @@ function findFirstProperty(properties, keys) {
805
806
  }
806
807
  return null;
807
808
  }
808
- const toHex = buf => [...new Uint8Array(buf)].map(b => b.toString(16).padStart(2, '0')).join('');
809
- function sha256Hex(input) {
810
- return tslib.__awaiter(this, void 0, void 0, function* () {
811
- const enc = new TextEncoder().encode(input);
812
- const digest = yield crypto.subtle.digest('SHA-256', enc);
813
- return toHex(digest);
814
- });
815
- }
816
809
 
817
810
  /* eslint-disable @typescript-eslint/no-explicit-any */
818
811
  class AnalyticsLogger {
package/index.esm.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { __awaiter } from 'tslib';
2
2
  import { isValid, parse } from 'psl';
3
+ import { sha256 } from 'js-sha256';
3
4
  import { v4 } from '@lukeed/uuid';
4
5
  import { z } from 'zod';
5
6
 
6
- var version = "0.1.39";
7
+ var version = "0.1.41";
7
8
 
8
9
  const timezones = {
9
10
  'Asia/Barnaul': 'RU',
@@ -635,7 +636,7 @@ function createFacebookPixelIntegration(config) {
635
636
  window.fbq(trackType, fbEventName);
636
637
  }
637
638
  },
638
- identify: (userId, properties, context) => __awaiter(this, void 0, void 0, function* () {
639
+ identify: (userId, properties, context) => {
639
640
  try {
640
641
  if (typeof window !== 'undefined' && window.fbq) {
641
642
  const amValues = coerceMetaConversionsAmValues(Object.assign(Object.assign({}, properties || {}), userId ? {
@@ -643,7 +644,7 @@ function createFacebookPixelIntegration(config) {
643
644
  } : {}));
644
645
  const am = {};
645
646
  if (amValues.external_id) am['external_id'] = amValues.external_id;
646
- if (amValues.em) am['em'] = yield sha256Hex(amValues.em);
647
+ if (amValues.em) am['em'] = sha256(amValues.em);
647
648
  if (amValues.fn) am['fn'] = amValues.fn;
648
649
  if (amValues.ln) am['ln'] = amValues.ln;
649
650
  if (amValues.ph) am['ph'] = amValues.ph;
@@ -660,7 +661,7 @@ function createFacebookPixelIntegration(config) {
660
661
  } catch (error) {
661
662
  console.error('Error identifying user in Meta Pixel:', error);
662
663
  }
663
- })
664
+ }
664
665
  };
665
666
  }
666
667
  function getFacebookEventName(eventName, eventMapping) {
@@ -801,14 +802,6 @@ function findFirstProperty(properties, keys) {
801
802
  }
802
803
  return null;
803
804
  }
804
- const toHex = buf => [...new Uint8Array(buf)].map(b => b.toString(16).padStart(2, '0')).join('');
805
- function sha256Hex(input) {
806
- return __awaiter(this, void 0, void 0, function* () {
807
- const enc = new TextEncoder().encode(input);
808
- const digest = yield crypto.subtle.digest('SHA-256', enc);
809
- return toHex(digest);
810
- });
811
- }
812
805
 
813
806
  /* eslint-disable @typescript-eslint/no-explicit-any */
814
807
  class AnalyticsLogger {
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "saasco-sdk",
3
- "version": "0.1.39",
3
+ "version": "0.1.41",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0",
6
6
  "@lukeed/uuid": "^2.0.1",
7
7
  "zod": "^3.22.4",
8
- "psl": "^1.9.0"
8
+ "psl": "^1.9.0",
9
+ "js-sha256": "^0.11.1"
9
10
  },
10
11
  "main": "./index.cjs.js",
11
12
  "typings": "./src/index.d.ts",