@useblu/blu-lytics 1.0.4 → 1.0.6
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":"index.d.ts","sourceRoot":"","sources":["../../src/initializers/index.ts"],"names":[],"mappings":"
|
|
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;AAyG1E;;;;;;;GAOG;AACH,QAAA,IAAI,uBAAuB,EAAE,eAAe,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,gBACjB,iBAAiB,GAAG,iBAAiB,EAAE;iBAC5B,eAAe;MACtC,IAsCF,CAAC;AAEF,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { init } from '@fullstory/browser';
|
|
|
4
4
|
import mixpanel from 'mixpanel-browser';
|
|
5
5
|
import { BrowserTracing } from '@sentry/tracing';
|
|
6
6
|
import { CaptureConsole } from '@sentry/integrations';
|
|
7
|
-
import { clarity } from '
|
|
7
|
+
import { clarity } from 'clarity-js';
|
|
8
8
|
/**
|
|
9
9
|
* Checks if the environment is set to 'production'.
|
|
10
10
|
* @param {EnvironmentType} environment - The environment (e.g., 'production', 'development').
|
|
@@ -18,8 +18,14 @@ var isProduction = function (environment) { return environment === 'production';
|
|
|
18
18
|
* @returns {void}
|
|
19
19
|
*/
|
|
20
20
|
var clarityInitializer = function (environment, apiKey) {
|
|
21
|
-
if (isProduction(environment))
|
|
22
|
-
clarity.
|
|
21
|
+
if (isProduction(environment)) {
|
|
22
|
+
clarity.start({
|
|
23
|
+
projectId: apiKey,
|
|
24
|
+
upload: 'https://m.clarity.ms/collect',
|
|
25
|
+
track: true,
|
|
26
|
+
content: true
|
|
27
|
+
});
|
|
28
|
+
}
|
|
23
29
|
};
|
|
24
30
|
/**
|
|
25
31
|
* Initializes FullStory for error tracking in a web environment.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { clarity } from '
|
|
1
|
+
import { clarity } from 'clarity-js';
|
|
2
2
|
var dispatchUserIdentification = function (id, userProperties) {
|
|
3
|
-
clarity.identify(id
|
|
3
|
+
clarity.identify(id);
|
|
4
4
|
};
|
|
5
5
|
var dispatchCustomEvent = function (event, properties) {
|
|
6
|
-
clarity.
|
|
6
|
+
clarity.set(event, 'customEvent');
|
|
7
7
|
};
|
|
8
8
|
var dispatchScreenEvent = function (screen) {
|
|
9
|
-
clarity.
|
|
9
|
+
clarity.set(screen, 'screen');
|
|
10
10
|
};
|
|
11
11
|
var ClarityProvider = {
|
|
12
12
|
name: 'Clarity',
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { clarity } from '
|
|
1
|
+
import { clarity } from 'clarity-js';
|
|
2
2
|
import ClarityProvider from './clarity';
|
|
3
|
-
jest.mock('
|
|
3
|
+
jest.mock('clarity-js', function () { return ({
|
|
4
4
|
clarity: {
|
|
5
5
|
identify: jest.fn(),
|
|
6
|
-
|
|
6
|
+
set: jest.fn()
|
|
7
7
|
}
|
|
8
8
|
}); });
|
|
9
9
|
describe('ClarityProvider', function () {
|
|
10
10
|
it('dispatchUserIdentification should call clarity.identify with correct arguments', function () {
|
|
11
11
|
var userId = 'user123';
|
|
12
|
-
ClarityProvider.userIdentification(userId,
|
|
13
|
-
expect(clarity.identify).toHaveBeenCalledWith(userId
|
|
12
|
+
ClarityProvider.userIdentification(userId, '');
|
|
13
|
+
expect(clarity.identify).toHaveBeenCalledWith(userId);
|
|
14
14
|
});
|
|
15
|
-
it('dispatchCustomEvent should call clarity.
|
|
15
|
+
it('dispatchCustomEvent should call clarity.set with correct arguments', function () {
|
|
16
16
|
var eventName = 'clickEvent';
|
|
17
17
|
var properties = { key: 'value' };
|
|
18
18
|
ClarityProvider.customEvent(eventName, properties);
|
|
19
|
-
expect(clarity.
|
|
19
|
+
expect(clarity.set).toHaveBeenCalledWith(eventName, 'customEvent');
|
|
20
20
|
});
|
|
21
|
-
it('dispatchScreenEvent should call clarity.
|
|
21
|
+
it('dispatchScreenEvent should call clarity.set with correct arguments', function () {
|
|
22
22
|
var screenName = 'HomeScreen';
|
|
23
23
|
ClarityProvider.screenEvent(screenName);
|
|
24
|
-
expect(clarity.
|
|
24
|
+
expect(clarity.set).toHaveBeenCalledWith(screenName, 'screen');
|
|
25
25
|
});
|
|
26
26
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useblu/blu-lytics",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"@sentry/integrations": "^6.19.7",
|
|
21
21
|
"@sentry/react": "^6.19.7",
|
|
22
22
|
"@sentry/tracing": "^6.19.7",
|
|
23
|
+
"clarity-js": "^0.7.24",
|
|
23
24
|
"jest-environment-jsdom": "^29.7.0",
|
|
24
25
|
"mixpanel-browser": "^2.48.1",
|
|
25
|
-
"react": "^18.2.0"
|
|
26
|
-
"react-microsoft-clarity": "^1.2.0"
|
|
26
|
+
"react": "^18.2.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/babel__core": "^7.20.5",
|