@useblu/blu-lytics 1.0.15 → 1.1.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/lib/dispatchers/index.d.ts +2 -1
- package/lib/dispatchers/index.d.ts.map +1 -1
- package/lib/dispatchers/index.js +15 -6
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/initializers/index.d.ts +4 -0
- package/lib/initializers/index.d.ts.map +1 -1
- package/lib/initializers/index.js +10 -4
- package/lib/providers/provider.types.d.ts +1 -0
- package/lib/providers/provider.types.d.ts.map +1 -1
- package/lib/providers/setups/mixpanel/mixpanel.d.ts.map +1 -1
- package/lib/providers/setups/mixpanel/mixpanel.js +10 -1
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +5 -2
- package/package.json +5 -2
|
@@ -10,5 +10,6 @@ declare const sendScreenEvent: (screen: string) => void;
|
|
|
10
10
|
declare const setDefaultProperties: (properties: PropertiesType) => void;
|
|
11
11
|
declare const sendCustomEvent: (event: string, properties: PropertiesType) => void;
|
|
12
12
|
declare const sendUserIdentification: (id: string, userProperties: UserPropertiesType) => void;
|
|
13
|
-
|
|
13
|
+
declare const resetMixpanel: () => void;
|
|
14
|
+
export { sendCustomEvent, sendScreenEvent, sendUserIdentification, setDefaultProperties, resetMixpanel, };
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dispatchers/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,cAAc,EACd,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAG7B;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,cAAe,SAAS,KAAG,IAkClE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dispatchers/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,cAAc,EACd,kBAAkB,EACnB,MAAM,qBAAqB,CAAC;AAG7B;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,cAAe,SAAS,KAAG,IAkClE,CAAC;AAOF,QAAA,MAAM,eAAe,WAAY,MAAM,KAAG,IAMzC,CAAC;AAeF,QAAA,MAAM,oBAAoB,eAAgB,cAAc,KAAG,IAG1D,CAAC;AAEF,QAAA,MAAM,eAAe,UAAW,MAAM,cAAc,cAAc,KAAG,IAyBpE,CAAC;AAEF,QAAA,MAAM,sBAAsB,OACtB,MAAM,kBACM,kBAAkB,KACjC,IAUF,CAAC;AAEF,QAAA,MAAM,aAAa,QAAO,IAMzB,CAAC;AAEF,OAAO,EACL,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,aAAa,GACd,CAAC"}
|
package/lib/dispatchers/index.js
CHANGED
|
@@ -51,10 +51,12 @@ export var dispatchEventToAllProviders = function (eventData) {
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
var
|
|
55
|
-
var
|
|
54
|
+
var getIsDevelopment = function () {
|
|
55
|
+
var currentEnvironment = localStorage.getItem('_bl_env') || 'development';
|
|
56
|
+
return currentEnvironment === 'development';
|
|
57
|
+
};
|
|
56
58
|
var sendScreenEvent = function (screen) {
|
|
57
|
-
if (
|
|
59
|
+
if (getIsDevelopment()) {
|
|
58
60
|
console.log("[blu-lytics]: Screen event: ".concat(screen));
|
|
59
61
|
}
|
|
60
62
|
else {
|
|
@@ -84,7 +86,7 @@ var sendCustomEvent = function (event, properties) {
|
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
var mergedProperties = __assign(__assign({}, defaultProperties), properties);
|
|
87
|
-
if (
|
|
89
|
+
if (getIsDevelopment()) {
|
|
88
90
|
console.log("[blu-lytics]: Custom event: ".concat(event, " - ").concat(JSON.stringify(mergedProperties)));
|
|
89
91
|
}
|
|
90
92
|
else {
|
|
@@ -92,11 +94,18 @@ var sendCustomEvent = function (event, properties) {
|
|
|
92
94
|
}
|
|
93
95
|
};
|
|
94
96
|
var sendUserIdentification = function (id, userProperties) {
|
|
95
|
-
if (
|
|
97
|
+
if (getIsDevelopment()) {
|
|
96
98
|
console.log("[blu-lytics]: User identification: ".concat(id, " - ").concat(JSON.stringify(userProperties)));
|
|
97
99
|
}
|
|
98
100
|
else {
|
|
99
101
|
dispatchEventToAllProviders({ id: id, userProperties: userProperties });
|
|
100
102
|
}
|
|
101
103
|
};
|
|
102
|
-
|
|
104
|
+
var resetMixpanel = function () {
|
|
105
|
+
var provider = providersList.find(function (item) { return item.name === 'MixPanel'; });
|
|
106
|
+
if (provider === null || provider === void 0 ? void 0 : provider.reset) {
|
|
107
|
+
checkIfMixPanelIsInitialized(provider.name);
|
|
108
|
+
provider.reset();
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
export { sendCustomEvent, sendScreenEvent, sendUserIdentification, setDefaultProperties, resetMixpanel, };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { initializeProviders } from './initializers';
|
|
2
|
-
export { sendCustomEvent, sendScreenEvent, sendUserIdentification, setDefaultProperties, } from './dispatchers';
|
|
2
|
+
export { sendCustomEvent, sendScreenEvent, sendUserIdentification, setDefaultProperties, resetMixpanel, } from './dispatchers';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACL,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACL,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,aAAa,GACd,MAAM,eAAe,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { initializeProviders } from './initializers';
|
|
2
|
-
export { sendCustomEvent, sendScreenEvent, sendUserIdentification, setDefaultProperties, } from './dispatchers';
|
|
2
|
+
export { sendCustomEvent, sendScreenEvent, sendUserIdentification, setDefaultProperties, resetMixpanel, } from './dispatchers';
|
|
@@ -16,6 +16,10 @@ declare let userSelectedEnvironment: EnvironmentType;
|
|
|
16
16
|
*/
|
|
17
17
|
export declare const initializeProviders: (paramsArray: IInitializeParams | IInitializeParams[], options?: {
|
|
18
18
|
environment: EnvironmentType;
|
|
19
|
+
mixPanelOptions?: {
|
|
20
|
+
recordSessionPercent: number;
|
|
21
|
+
recordIdleTimeoutMs: number;
|
|
22
|
+
} | undefined;
|
|
19
23
|
}) => void;
|
|
20
24
|
export { userSelectedEnvironment };
|
|
21
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/initializers/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/initializers/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAmH1E;;;;;;;GAOG;AACH,QAAA,IAAI,uBAAuB,EAAE,eAAe,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,gBACjB,iBAAiB,GAAG,iBAAiB,EAAE;iBAErC,eAAe;;8BAEJ,MAAM;6BACP,MAAM;;MAG9B,IAsCF,CAAC;AAEF,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -10,7 +10,9 @@ import { clarity } from 'clarity-js';
|
|
|
10
10
|
* @param {EnvironmentType} environment - The environment (e.g., 'production', 'development').
|
|
11
11
|
* @returns {boolean} - True if the environment is 'production', false otherwise.
|
|
12
12
|
*/
|
|
13
|
-
var isProduction = function (environment) {
|
|
13
|
+
var isProduction = function (environment) {
|
|
14
|
+
return environment === 'production';
|
|
15
|
+
};
|
|
14
16
|
/**
|
|
15
17
|
* Initializes Microsoft Clarity for error tracking in a web environment.
|
|
16
18
|
* @param {EnvironmentType} environment - The environment (e.g., 'production', 'development').
|
|
@@ -48,10 +50,14 @@ var fullStoryInitializer = function (environment, apiKey) {
|
|
|
48
50
|
* @param {string} credential - The MixPanel project token.
|
|
49
51
|
* @returns {void}
|
|
50
52
|
*/
|
|
51
|
-
var mixPanelInitializer = function (environment, apiKey) {
|
|
53
|
+
var mixPanelInitializer = function (environment, apiKey, options) {
|
|
52
54
|
if (isProduction(environment)) {
|
|
53
55
|
localStorage.setItem('_bl_mp', apiKey);
|
|
54
|
-
|
|
56
|
+
localStorage.setItem('_bl_mp_options', JSON.stringify(options));
|
|
57
|
+
mixpanel.init(apiKey, {
|
|
58
|
+
record_sessions_percent: options === null || options === void 0 ? void 0 : options.recordSessionPercent,
|
|
59
|
+
record_idle_timeout_ms: options === null || options === void 0 ? void 0 : options.recordIdleTimeoutMs
|
|
60
|
+
});
|
|
55
61
|
localStorage.removeItem('_bl_init');
|
|
56
62
|
}
|
|
57
63
|
};
|
|
@@ -119,7 +125,7 @@ export var initializeProviders = function (paramsArray, options) {
|
|
|
119
125
|
sentryInitializer(environment, apiKey, tracesSampleRate);
|
|
120
126
|
break;
|
|
121
127
|
case 'MixPanel':
|
|
122
|
-
mixPanelInitializer(environment, apiKey);
|
|
128
|
+
mixPanelInitializer(environment, apiKey, options.mixPanelOptions);
|
|
123
129
|
break;
|
|
124
130
|
default:
|
|
125
131
|
break;
|
|
@@ -4,5 +4,6 @@ export type ProviderType = {
|
|
|
4
4
|
userIdentification: (id: string, userProperties: any) => void;
|
|
5
5
|
customEvent: (event: string, properties: PropertiesType) => void;
|
|
6
6
|
screenEvent: (screen: string) => void;
|
|
7
|
+
reset?: () => void;
|
|
7
8
|
};
|
|
8
9
|
//# sourceMappingURL=provider.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.types.d.ts","sourceRoot":"","sources":["../../src/providers/provider.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"provider.types.d.ts","sourceRoot":"","sources":["../../src/providers/provider.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,CAAC;IACtD,kBAAkB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,KAAK,IAAI,CAAC;IAC9D,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,KAAK,IAAI,CAAC;IACjE,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC"}
|
|
@@ -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;AAkEpD,QAAA,MAAM,gBAAgB,EAAE,YAMvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -53,10 +53,19 @@ var dispatchScreenEvent = function (screen) {
|
|
|
53
53
|
console.error('Error tracking screen event:', error);
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
+
var dispatchReset = function () {
|
|
57
|
+
try {
|
|
58
|
+
mixpanel.reset();
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
console.error('Error resetting Mixpanel:', error);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
56
64
|
var MixPanelProvider = {
|
|
57
65
|
name: 'MixPanel',
|
|
58
66
|
userIdentification: dispatchUserIdentification,
|
|
59
67
|
customEvent: dispatchCustomEvent,
|
|
60
|
-
screenEvent: dispatchScreenEvent
|
|
68
|
+
screenEvent: dispatchScreenEvent,
|
|
69
|
+
reset: dispatchReset
|
|
61
70
|
};
|
|
62
71
|
export default MixPanelProvider;
|
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,
|
|
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,kBAAmB,YAAY,EAAE,KAAG,OACX,CAAC;AAE3D,eAAO,MAAM,4BAA4B,aAAc,MAAM,KAAG,IAa/D,CAAC"}
|
package/lib/utils/index.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import mixpanel from 'mixpanel-browser';
|
|
2
|
-
export var isValidProvidersList = function (providersList) {
|
|
2
|
+
export var isValidProvidersList = function (providersList) {
|
|
3
|
+
return Array.isArray(providersList) && providersList.length > 0;
|
|
4
|
+
};
|
|
3
5
|
export var checkIfMixPanelIsInitialized = function (provider) {
|
|
4
6
|
var isMixPanelProvider = provider === 'MixPanel';
|
|
5
7
|
if (isMixPanelProvider) {
|
|
6
8
|
var apiKey = localStorage === null || localStorage === void 0 ? void 0 : localStorage.getItem('_bl_mp');
|
|
9
|
+
var options = localStorage === null || localStorage === void 0 ? void 0 : localStorage.getItem('_bl_mp_options');
|
|
7
10
|
var wasInitialized = localStorage.getItem('_bl_init');
|
|
8
11
|
if (!wasInitialized) {
|
|
9
|
-
mixpanel.init(apiKey);
|
|
12
|
+
mixpanel.init(apiKey, options && options !== 'undefined' ? JSON.parse(options) : undefined);
|
|
10
13
|
localStorage.removeItem('_bl_mp');
|
|
11
14
|
localStorage.setItem('_bl_init', 'init');
|
|
12
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useblu/blu-lytics",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -23,6 +23,9 @@
|
|
|
23
23
|
"react": "^18.2.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
27
|
+
"@semantic-release/git": "^10.0.1",
|
|
28
|
+
"semantic-release": "^24.0.0",
|
|
26
29
|
"@types/babel__core": "^7.20.5",
|
|
27
30
|
"@types/jest": "^29.2.3",
|
|
28
31
|
"@types/mixpanel-browser": "^2.47.5",
|
|
@@ -61,4 +64,4 @@
|
|
|
61
64
|
"access": "public"
|
|
62
65
|
},
|
|
63
66
|
"sideEffects": false
|
|
64
|
-
}
|
|
67
|
+
}
|