@useblu/blu-lytics 1.0.9 → 1.0.11

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.
@@ -1 +1 @@
1
- {"version":3,"file":"mixpanel.d.ts","sourceRoot":"","sources":["../../../../src/providers/setups/mixpanel/mixpanel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AA6CpD,QAAA,MAAM,gBAAgB,EAAE,YAKvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"mixpanel.d.ts","sourceRoot":"","sources":["../../../../src/providers/setups/mixpanel/mixpanel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AA0DpD,QAAA,MAAM,gBAAgB,EAAE,YAKvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -34,10 +34,24 @@ var dispatchUserIdentification = function (id, userProperties) {
34
34
  };
35
35
  var dispatchCustomEvent = function (event, properties) {
36
36
  var rest = __rest(properties, []);
37
- mixpanel.track(event, rest);
37
+ try {
38
+ setTimeout(function () {
39
+ mixpanel.track(event, rest);
40
+ }, 1000);
41
+ }
42
+ catch (error) {
43
+ console.error('Error tracking screen event:', error);
44
+ }
38
45
  };
39
46
  var dispatchScreenEvent = function (screen) {
40
- mixpanel.track(screen);
47
+ try {
48
+ setTimeout(function () {
49
+ mixpanel.track(screen);
50
+ }, 1000);
51
+ }
52
+ catch (error) {
53
+ console.error('Error tracking screen event:', error);
54
+ }
41
55
  };
42
56
  var MixPanelProvider = {
43
57
  name: 'MixPanel',
@@ -18,6 +18,8 @@ jest.mock('mixpanel-browser', function () { return ({
18
18
  set: jest.fn()
19
19
  }
20
20
  }); });
21
+ jest.useFakeTimers();
22
+ jest.spyOn(global, 'setTimeout');
21
23
  describe('MixPanelProvider', function () {
22
24
  afterEach(function () {
23
25
  jest.clearAllMocks();
@@ -38,15 +40,20 @@ describe('MixPanelProvider', function () {
38
40
  test('dispatchCustomEvent should call mixpanel.track with event and properties', function () {
39
41
  var event = 'testEvent';
40
42
  var properties = {
41
- key1: 'value1', key2: true, key3: 9.9, key4: ['value1', 'value2']
43
+ key1: 'value1',
44
+ key2: true,
45
+ key3: 9.9,
46
+ key4: ['value1', 'value2']
42
47
  };
43
48
  MixPanelProvider.customEvent(event, properties);
44
49
  var rest = __rest(properties, []);
50
+ jest.runAllTimers();
45
51
  expect(mixpanel.track).toHaveBeenCalledWith(event, rest);
46
52
  });
47
53
  test('dispatchScreenEvent should call mixpanel.track with screen', function () {
48
54
  var screen = 'testScreen';
49
55
  MixPanelProvider.screenEvent(screen);
56
+ jest.runAllTimers();
50
57
  expect(mixpanel.track).toHaveBeenCalledWith(screen);
51
58
  });
52
59
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useblu/blu-lytics",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",