@useblu/blu-lytics 1.0.2 → 1.0.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/lib/dispatchers/dispatchers.types.d.ts +2 -2
- package/lib/dispatchers/dispatchers.types.d.ts.map +1 -1
- package/lib/initializers/index.d.ts.map +1 -1
- package/lib/initializers/index.js +1 -3
- package/lib/providers/setups/mixpanel/mixpanel.d.ts.map +1 -1
- package/lib/providers/setups/mixpanel/mixpanel.js +13 -1
- package/lib/providers/setups/mixpanel/mixpanel.spec.js +16 -2
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +1 -3
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export type EventType = 'customEvent' | 'screenEvent' | 'userIdentification';
|
|
2
2
|
export type PropertiesType = {
|
|
3
|
-
[key: string]: string;
|
|
3
|
+
[key: string]: string | boolean | number | string[] | undefined;
|
|
4
4
|
};
|
|
5
5
|
export type UserPropertiesType = {
|
|
6
6
|
email?: string;
|
|
7
7
|
name?: string;
|
|
8
|
-
[key: string]: string | undefined;
|
|
8
|
+
[key: string]: string | boolean | number | any[] | undefined;
|
|
9
9
|
};
|
|
10
10
|
export type EventData = {
|
|
11
11
|
screen?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatchers.types.d.ts","sourceRoot":"","sources":["../../src/dispatchers/dispatchers.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,aAAa,GAAG,oBAAoB,CAAC;AAC7E,MAAM,MAAM,cAAc,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"dispatchers.types.d.ts","sourceRoot":"","sources":["../../src/dispatchers/dispatchers.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,aAAa,GAAG,oBAAoB,CAAC;AAC7E,MAAM,MAAM,cAAc,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;CAAE,CAAC;AAClG,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,GAAG,EAAE,GAAG,SAAS,CAAC;CAC9D,CAAC;AACF,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,cAAc,CAAC,EAAE,kBAAkB,CAAC;CACrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/initializers/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/initializers/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AA8F1E;;;;;;;GAOG;AACH,QAAA,IAAI,uBAAuB,EAAE,eAAe,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,gBACjB,iBAAiB,GAAG,iBAAiB,EAAE;iBAC5B,eAAe;MACtC,IA0CF,CAAC;AAEF,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -40,9 +40,7 @@ var fullStoryInitializer = function (environment, apiKey) {
|
|
|
40
40
|
var mixPanelInitializer = function (environment, apiKey) {
|
|
41
41
|
if (isProduction(environment)) {
|
|
42
42
|
localStorage.setItem('_bl_mp', apiKey);
|
|
43
|
-
mixpanel.init(apiKey
|
|
44
|
-
track_pageview: true
|
|
45
|
-
});
|
|
43
|
+
mixpanel.init(apiKey);
|
|
46
44
|
localStorage.removeItem('_bl_init');
|
|
47
45
|
}
|
|
48
46
|
};
|
|
@@ -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;
|
|
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;AA2CpD,QAAA,MAAM,gBAAgB,EAAE,YAKvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import mixpanel from 'mixpanel-browser';
|
|
2
13
|
var dispatchUserIdentification = function (id, userProperties) {
|
|
3
14
|
mixpanel.identify(id);
|
|
@@ -21,7 +32,8 @@ var dispatchUserIdentification = function (id, userProperties) {
|
|
|
21
32
|
mixpanel.people.set(peopleProperties);
|
|
22
33
|
};
|
|
23
34
|
var dispatchCustomEvent = function (event, properties) {
|
|
24
|
-
|
|
35
|
+
var rest = __rest(properties, []);
|
|
36
|
+
mixpanel.track(event, rest);
|
|
25
37
|
};
|
|
26
38
|
var dispatchScreenEvent = function (screen) {
|
|
27
39
|
mixpanel.track(screen);
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import mixpanel from 'mixpanel-browser';
|
|
2
13
|
import MixPanelProvider from './mixpanel';
|
|
3
14
|
jest.mock('mixpanel-browser', function () { return ({
|
|
@@ -26,9 +37,12 @@ describe('MixPanelProvider', function () {
|
|
|
26
37
|
});
|
|
27
38
|
test('dispatchCustomEvent should call mixpanel.track with event and properties', function () {
|
|
28
39
|
var event = 'testEvent';
|
|
29
|
-
var properties = {
|
|
40
|
+
var properties = {
|
|
41
|
+
key1: 'value1', key2: true, key3: 9.9, key4: ['value1', 'value2']
|
|
42
|
+
};
|
|
30
43
|
MixPanelProvider.customEvent(event, properties);
|
|
31
|
-
|
|
44
|
+
var rest = __rest(properties, []);
|
|
45
|
+
expect(mixpanel.track).toHaveBeenCalledWith(event, rest);
|
|
32
46
|
});
|
|
33
47
|
test('dispatchScreenEvent should call mixpanel.track with screen', function () {
|
|
34
48
|
var screen = 'testScreen';
|
package/lib/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,eAAO,MAAM,oBAAoB,kBAChB,YAAY,EAAE,KAC5B,OAAmE,CAAC;AAEvE,eAAO,MAAM,4BAA4B,aAAc,MAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,eAAO,MAAM,oBAAoB,kBAChB,YAAY,EAAE,KAC5B,OAAmE,CAAC;AAEvE,eAAO,MAAM,4BAA4B,aAAc,MAAM,KAAG,IAY/D,CAAC"}
|
package/lib/utils/index.js
CHANGED
|
@@ -6,9 +6,7 @@ export var checkIfMixPanelIsInitialized = function (provider) {
|
|
|
6
6
|
var apiKey = localStorage === null || localStorage === void 0 ? void 0 : localStorage.getItem('_bl_mp');
|
|
7
7
|
var wasInitialized = localStorage.getItem('_bl_init');
|
|
8
8
|
if (!wasInitialized) {
|
|
9
|
-
mixpanel.init(apiKey
|
|
10
|
-
track_pageview: true
|
|
11
|
-
});
|
|
9
|
+
mixpanel.init(apiKey);
|
|
12
10
|
localStorage.removeItem('_bl_mp');
|
|
13
11
|
localStorage.setItem('_bl_init', 'init');
|
|
14
12
|
}
|