react-native-clarity 0.0.1 → 0.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/android/build.gradle +1 -1
- package/lib/commonjs/index.js +15 -16
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +15 -16
- package/lib/module/index.js.map +1 -1
- package/package.json +1 -2
- package/src/index.tsx +13 -13
package/android/build.gradle
CHANGED
|
@@ -69,7 +69,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
|
69
69
|
dependencies {
|
|
70
70
|
implementation "com.facebook.react:react-native:+"
|
|
71
71
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
72
|
-
implementation "com.microsoft.clarity:clarity:1.2.
|
|
72
|
+
implementation "com.microsoft.clarity:clarity:1.2.4"
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
if (isNewArchitectureEnabled()) {
|
package/lib/commonjs/index.js
CHANGED
|
@@ -7,10 +7,9 @@ exports.getCurrentSessionId = getCurrentSessionId;
|
|
|
7
7
|
exports.initialize = initialize;
|
|
8
8
|
exports.setCustomUserId = setCustomUserId;
|
|
9
9
|
var _reactNative = require("react-native");
|
|
10
|
-
const LINKING_ERROR = `The package 'react-native-clarity' doesn't seem to be linked. Make sure: \n\n` +
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
10
|
+
const LINKING_ERROR = `The package 'react-native-clarity' doesn't seem to be linked. Make sure: \n\n` +
|
|
11
|
+
// Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + TODO: add back when iOS is supported.
|
|
12
|
+
'- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
14
13
|
const Clarity = _reactNative.NativeModules.Clarity;
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -33,14 +32,14 @@ function initialize(projectId, userId) {
|
|
|
33
32
|
let allowMeteredNetworkUsage = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
34
33
|
let enableWebViewCapture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
35
34
|
let allowedDomains = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : ["*"];
|
|
36
|
-
if (Clarity === null) {
|
|
37
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
35
|
if (_reactNative.Platform.OS !== 'android') {
|
|
41
36
|
console.warn("Clarity supports Android only for now.");
|
|
42
37
|
return;
|
|
43
38
|
}
|
|
39
|
+
if (Clarity === null) {
|
|
40
|
+
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
44
43
|
Clarity.initialize(projectId, userId, logLevel, allowMeteredNetworkUsage, enableWebViewCapture, allowedDomains);
|
|
45
44
|
}
|
|
46
45
|
|
|
@@ -55,14 +54,14 @@ function initialize(projectId, userId) {
|
|
|
55
54
|
* @param customUserId The custom user id to set.
|
|
56
55
|
*/
|
|
57
56
|
function setCustomUserId(customUserId) {
|
|
58
|
-
if (Clarity === null) {
|
|
59
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
57
|
if (_reactNative.Platform.OS !== 'android') {
|
|
63
58
|
console.warn("Clarity supports Android only for now.");
|
|
64
59
|
return;
|
|
65
60
|
}
|
|
61
|
+
if (Clarity === null) {
|
|
62
|
+
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
66
65
|
Clarity.setCustomUserId(customUserId);
|
|
67
66
|
}
|
|
68
67
|
|
|
@@ -72,14 +71,14 @@ function setCustomUserId(customUserId) {
|
|
|
72
71
|
* @returns a promise that resolves to the current session id.
|
|
73
72
|
*/
|
|
74
73
|
function getCurrentSessionId() {
|
|
75
|
-
if (
|
|
76
|
-
console.
|
|
74
|
+
if (_reactNative.Platform.OS !== 'android') {
|
|
75
|
+
console.warn("Clarity supports Android only for now.");
|
|
77
76
|
return new Promise(resolve => {
|
|
78
77
|
resolve("Undefined");
|
|
79
78
|
});
|
|
80
79
|
}
|
|
81
|
-
if (
|
|
82
|
-
console.
|
|
80
|
+
if (Clarity === null) {
|
|
81
|
+
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
83
82
|
return new Promise(resolve => {
|
|
84
83
|
resolve("Undefined");
|
|
85
84
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LINKING_ERROR","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Clarity","NativeModules","initialize","projectId","userId","logLevel","arguments","length","undefined","allowMeteredNetworkUsage","enableWebViewCapture","allowedDomains","Platform","OS","console","warn","error","setCustomUserId","customUserId","getCurrentSessionId","Promise","resolve"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GAChB,+EAA8E;AAC/E;AACA,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,OAAO,GAAGC,0BAAa,CAACD,OAAO;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,UAAUA,CACxBC,SAAiB,EACjBC,MAAe,EAImB;EAAA,IAHlCC,QAAgB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,MAAM;EAAA,IACzBG,wBAAiC,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAAA,IACzCI,oBAA6B,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EAAA,IACpCK,cAAwB,GAAAL,SAAA,CAAAC,MA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AOrB,OAAO,CAACmB,mBAAmB,CAAC,CAAC;AACtC"}
|
package/lib/module/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { NativeModules, Platform } from 'react-native';
|
|
2
|
-
const LINKING_ERROR = `The package 'react-native-clarity' doesn't seem to be linked. Make sure: \n\n` +
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
2
|
+
const LINKING_ERROR = `The package 'react-native-clarity' doesn't seem to be linked. Make sure: \n\n` +
|
|
3
|
+
// Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + TODO: add back when iOS is supported.
|
|
4
|
+
'- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
6
5
|
const Clarity = NativeModules.Clarity;
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -25,14 +24,14 @@ export function initialize(projectId, userId) {
|
|
|
25
24
|
let allowMeteredNetworkUsage = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
26
25
|
let enableWebViewCapture = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
27
26
|
let allowedDomains = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : ["*"];
|
|
28
|
-
if (Clarity === null) {
|
|
29
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
27
|
if (Platform.OS !== 'android') {
|
|
33
28
|
console.warn("Clarity supports Android only for now.");
|
|
34
29
|
return;
|
|
35
30
|
}
|
|
31
|
+
if (Clarity === null) {
|
|
32
|
+
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
36
35
|
Clarity.initialize(projectId, userId, logLevel, allowMeteredNetworkUsage, enableWebViewCapture, allowedDomains);
|
|
37
36
|
}
|
|
38
37
|
|
|
@@ -47,14 +46,14 @@ export function initialize(projectId, userId) {
|
|
|
47
46
|
* @param customUserId The custom user id to set.
|
|
48
47
|
*/
|
|
49
48
|
export function setCustomUserId(customUserId) {
|
|
50
|
-
if (Clarity === null) {
|
|
51
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
49
|
if (Platform.OS !== 'android') {
|
|
55
50
|
console.warn("Clarity supports Android only for now.");
|
|
56
51
|
return;
|
|
57
52
|
}
|
|
53
|
+
if (Clarity === null) {
|
|
54
|
+
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
58
57
|
Clarity.setCustomUserId(customUserId);
|
|
59
58
|
}
|
|
60
59
|
|
|
@@ -64,14 +63,14 @@ export function setCustomUserId(customUserId) {
|
|
|
64
63
|
* @returns a promise that resolves to the current session id.
|
|
65
64
|
*/
|
|
66
65
|
export function getCurrentSessionId() {
|
|
67
|
-
if (
|
|
68
|
-
console.
|
|
66
|
+
if (Platform.OS !== 'android') {
|
|
67
|
+
console.warn("Clarity supports Android only for now.");
|
|
69
68
|
return new Promise(resolve => {
|
|
70
69
|
resolve("Undefined");
|
|
71
70
|
});
|
|
72
71
|
}
|
|
73
|
-
if (
|
|
74
|
-
console.
|
|
72
|
+
if (Clarity === null) {
|
|
73
|
+
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
75
74
|
return new Promise(resolve => {
|
|
76
75
|
resolve("Undefined");
|
|
77
76
|
});
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","Clarity","initialize","projectId","userId","logLevel","arguments","length","undefined","allowMeteredNetworkUsage","enableWebViewCapture","allowedDomains","OS","console","warn","error","setCustomUserId","customUserId","getCurrentSessionId","Promise","resolve"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,Q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OAAO,KAAK,IAAI,EAAE;IACpBY,OAAO,CAACE,KAAK,CAAC,sCAAsC,EAAEf,aAAa,CAAC;IACpE;EACF;EAEAC,OAAO,CAACe,eAAe,CAACC,YAAY,CAAC;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAA,EAAoB;EACrD,IAAInB,QAAQ,CAACa,EAAE,KAAK,SAAS,EAAE;IAC7BC,OAAO,CAACC,IAAI,CAAC,wCAAwC,CAAC;IACtD,OAAO,IAAIK,OAAO,CAAEC,OAAO,IAAK;MAC9BA,OAAO,CAAC,WAAW,CAAC;IACtB,CAAC,CAAC;EACJ;EAEA,IAAInB,OAAO,KAAK,IAAI,EAAE;IACpBY,OAAO,CAACE,KAAK,CAAC,sCAAsC,EAAEf,aAAa,CAAC;IACpE,OAAO,IAAImB,OAAO,CAAEC,OAAO,IAAK;MAC9BA,OAAO,CAAC,WAAW,CAAC;IACtB,CAAC,CAAC;EACJ;EAEA,OAAOnB,OAAO,CAACiB,mBAAmB,CAAC,CAAC;AACtC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-clarity",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "A plugin to provide the Clarity experience for the React Native applications.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
},
|
|
39
39
|
"keywords": [
|
|
40
40
|
"react-native",
|
|
41
|
-
"ios",
|
|
42
41
|
"android"
|
|
43
42
|
],
|
|
44
43
|
"repository": "https://github.com/microsoft/clarity-apps",
|
package/src/index.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { NativeModules, Platform } from 'react-native';
|
|
|
2
2
|
|
|
3
3
|
const LINKING_ERROR =
|
|
4
4
|
`The package 'react-native-clarity' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
-
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
5
|
+
// Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) + TODO: add back when iOS is supported.
|
|
6
6
|
'- You rebuilt the app after installing the package\n' +
|
|
7
7
|
'- You are not using Expo Go\n';
|
|
8
8
|
|
|
@@ -30,13 +30,13 @@ export function initialize(
|
|
|
30
30
|
allowMeteredNetworkUsage: boolean = false,
|
|
31
31
|
enableWebViewCapture: boolean = true,
|
|
32
32
|
allowedDomains: string[] = ["*"]) {
|
|
33
|
-
if (
|
|
34
|
-
console.
|
|
33
|
+
if (Platform.OS !== 'android') {
|
|
34
|
+
console.warn("Clarity supports Android only for now.");
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
if (
|
|
39
|
-
console.
|
|
38
|
+
if (Clarity === null) {
|
|
39
|
+
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -54,13 +54,13 @@ export function initialize(
|
|
|
54
54
|
* @param customUserId The custom user id to set.
|
|
55
55
|
*/
|
|
56
56
|
export function setCustomUserId(customUserId: string) {
|
|
57
|
-
if (
|
|
58
|
-
console.
|
|
57
|
+
if (Platform.OS !== 'android') {
|
|
58
|
+
console.warn("Clarity supports Android only for now.");
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
if (
|
|
63
|
-
console.
|
|
62
|
+
if (Clarity === null) {
|
|
63
|
+
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -73,15 +73,15 @@ export function setCustomUserId(customUserId: string) {
|
|
|
73
73
|
* @returns a promise that resolves to the current session id.
|
|
74
74
|
*/
|
|
75
75
|
export function getCurrentSessionId(): Promise<string> {
|
|
76
|
-
if (
|
|
77
|
-
console.
|
|
76
|
+
if (Platform.OS !== 'android') {
|
|
77
|
+
console.warn("Clarity supports Android only for now.");
|
|
78
78
|
return new Promise((resolve) => {
|
|
79
79
|
resolve("Undefined");
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
if (
|
|
84
|
-
console.
|
|
83
|
+
if (Clarity === null) {
|
|
84
|
+
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
85
85
|
return new Promise((resolve) => {
|
|
86
86
|
resolve("Undefined");
|
|
87
87
|
});
|