react-native-clarity 2.2.1 → 3.0.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/LICENSE +20 -20
- package/README.md +18 -3
- package/android/build.gradle +1 -1
- package/android/gradle.properties +0 -1
- package/android/src/main/java/com/microsoft/clarity/reactnative/ClarityModule.kt +20 -0
- package/ios/Clarity.h +12 -12
- package/ios/Clarity.m +131 -0
- package/ios/Clarity.xcodeproj/project.pbxproj +280 -274
- package/lib/commonjs/index.js +79 -61
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +74 -59
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +22 -5
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +8 -2
- package/react-native-clarity.podspec +36 -35
- package/src/index.tsx +104 -76
- package/ios/Clarity.mm +0 -15
- package/ios/Clarity.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
package/lib/commonjs/index.js
CHANGED
|
@@ -7,14 +7,18 @@ exports.LogLevel = void 0;
|
|
|
7
7
|
exports.getCurrentSessionId = getCurrentSessionId;
|
|
8
8
|
exports.getCurrentSessionUrl = getCurrentSessionUrl;
|
|
9
9
|
exports.initialize = initialize;
|
|
10
|
+
exports.isPaused = isPaused;
|
|
11
|
+
exports.pause = pause;
|
|
12
|
+
exports.resume = resume;
|
|
10
13
|
exports.setCurrentScreenName = setCurrentScreenName;
|
|
11
14
|
exports.setCustomSessionId = setCustomSessionId;
|
|
12
15
|
exports.setCustomTag = setCustomTag;
|
|
13
16
|
exports.setCustomUserId = setCustomUserId;
|
|
14
17
|
var _reactNative = require("react-native");
|
|
15
|
-
const LINKING_ERROR = `The package 'react-native-clarity' doesn't seem to be linked. Make sure: \n\n` +
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
const LINKING_ERROR = `The package 'react-native-clarity' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
19
|
+
ios: "- You have run 'pod install --repo-update'\n",
|
|
20
|
+
default: ''
|
|
21
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
18
22
|
const Clarity = _reactNative.NativeModules.Clarity;
|
|
19
23
|
const SupportedPlatforms = ['android'];
|
|
20
24
|
|
|
@@ -31,13 +35,16 @@ const SupportedPlatforms = ['android'];
|
|
|
31
35
|
* @param enableWebViewCapture [OPTIONAL default = true] Allows Clarity to capture the web views DOM content.
|
|
32
36
|
* @param allowedDomains [OPTIONAL default = ["*"]] The whitelisted domains to allow Clarity to capture their DOM content.
|
|
33
37
|
* If it contains "*" as an element, all domains will be captured.
|
|
38
|
+
* Note: iOS currently does not support allowedDomains feature.
|
|
34
39
|
* @param disableOnLowEndDevices [OPTIONAL default = false] Disable Clarity on low-end devices.
|
|
35
40
|
* @param maximumDailyNetworkUsageInMB [OPTIONAL default = null] Maximum daily network usage for Clarity (null = No limit). When the limit is reached, Clarity will turn on lean mode.
|
|
41
|
+
* Note: iOS currently does not support limiting network usage.
|
|
42
|
+
* @param enableIOS_experimental [OPTIONAL default = false] Experimental flag to enable Clarity on iOS platform.
|
|
36
43
|
*/
|
|
37
44
|
/**
|
|
38
45
|
* The level of logging to show in the device logcat stream.
|
|
39
46
|
*/
|
|
40
|
-
let LogLevel = /*#__PURE__*/function (LogLevel) {
|
|
47
|
+
let LogLevel = exports.LogLevel = /*#__PURE__*/function (LogLevel) {
|
|
41
48
|
LogLevel["Verbose"] = "Verbose";
|
|
42
49
|
LogLevel["Debug"] = "Debug";
|
|
43
50
|
LogLevel["Info"] = "Info";
|
|
@@ -46,15 +53,26 @@ let LogLevel = /*#__PURE__*/function (LogLevel) {
|
|
|
46
53
|
LogLevel["None"] = "None";
|
|
47
54
|
return LogLevel;
|
|
48
55
|
}({});
|
|
56
|
+
function isClarityUnavailable() {
|
|
57
|
+
if (!SupportedPlatforms.includes(_reactNative.Platform.OS)) {
|
|
58
|
+
console.warn('Clarity supports ' + SupportedPlatforms.join(', ') + ' only for now.');
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
if (Clarity === null) {
|
|
62
|
+
console.error('Clarity did not initialize properly.', LINKING_ERROR);
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
|
|
49
68
|
/**
|
|
50
69
|
* Initializes the Clarity SDK if the API level is supported.
|
|
51
70
|
* @param projectId [REQUIRED] The Clarity project id to send data to.
|
|
52
71
|
* @param config [OPTIONAL] The clarity config, if not provided default values are used.
|
|
53
|
-
*/
|
|
54
|
-
exports.LogLevel = LogLevel;
|
|
72
|
+
*/
|
|
55
73
|
function initialize(projectId, config) {
|
|
56
|
-
if (typeof projectId !==
|
|
57
|
-
throw Error(
|
|
74
|
+
if (typeof projectId !== 'string' || !(typeof config === 'object' || typeof config === 'undefined')) {
|
|
75
|
+
throw Error('Invalid Clarity initialization arguments. Please check the docs for assitance.');
|
|
58
76
|
}
|
|
59
77
|
|
|
60
78
|
// applying default values
|
|
@@ -63,16 +81,15 @@ function initialize(projectId, config) {
|
|
|
63
81
|
logLevel = LogLevel.None,
|
|
64
82
|
allowMeteredNetworkUsage = false,
|
|
65
83
|
enableWebViewCapture = true,
|
|
66
|
-
allowedDomains = [
|
|
84
|
+
allowedDomains = ['*'],
|
|
67
85
|
disableOnLowEndDevices = false,
|
|
68
|
-
maximumDailyNetworkUsageInMB = null
|
|
86
|
+
maximumDailyNetworkUsageInMB = null,
|
|
87
|
+
enableIOS_experimental = false
|
|
69
88
|
} = config ?? {};
|
|
70
|
-
if (!SupportedPlatforms.includes(
|
|
71
|
-
|
|
72
|
-
return;
|
|
89
|
+
if (enableIOS_experimental === true && !SupportedPlatforms.includes('ios')) {
|
|
90
|
+
SupportedPlatforms.push('ios');
|
|
73
91
|
}
|
|
74
|
-
if (
|
|
75
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
92
|
+
if (isClarityUnavailable()) {
|
|
76
93
|
return;
|
|
77
94
|
}
|
|
78
95
|
|
|
@@ -82,6 +99,37 @@ function initialize(projectId, config) {
|
|
|
82
99
|
Clarity.initialize(projectId, userId, logLevel, allowMeteredNetworkUsage, enableWebViewCapture, allowedDomains, disableOnLowEndDevices, enableDailyNetworkUsageLimit, refinedMaximumDailyNetworkUsageInMB);
|
|
83
100
|
}
|
|
84
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Pauses the Clarity capturing processes until the next resume() is called.
|
|
104
|
+
*/
|
|
105
|
+
function pause() {
|
|
106
|
+
if (isClarityUnavailable()) {
|
|
107
|
+
return Promise.resolve(undefined);
|
|
108
|
+
}
|
|
109
|
+
return Clarity.pause();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Resumes the Clarity capturing processes if they are not already resumed.
|
|
114
|
+
* Note: Clarity starts capturing data right on initialization.
|
|
115
|
+
*/
|
|
116
|
+
function resume() {
|
|
117
|
+
if (isClarityUnavailable()) {
|
|
118
|
+
return Promise.resolve(undefined);
|
|
119
|
+
}
|
|
120
|
+
return Clarity.resume();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Returns true if Clarity has been paused by the user.
|
|
125
|
+
*/
|
|
126
|
+
function isPaused() {
|
|
127
|
+
if (isClarityUnavailable()) {
|
|
128
|
+
return Promise.resolve(undefined);
|
|
129
|
+
}
|
|
130
|
+
return Clarity.isPaused();
|
|
131
|
+
}
|
|
132
|
+
|
|
85
133
|
/**
|
|
86
134
|
* Sets a custom user id that can be used to identify the user. It has less
|
|
87
135
|
* restrictions than the userId parameter. You can pass any string and
|
|
@@ -93,15 +141,10 @@ function initialize(projectId, config) {
|
|
|
93
141
|
* @param customUserId The custom user id to set.
|
|
94
142
|
*/
|
|
95
143
|
function setCustomUserId(customUserId) {
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
if (Clarity === null) {
|
|
101
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
102
|
-
return;
|
|
144
|
+
if (isClarityUnavailable()) {
|
|
145
|
+
return Promise.resolve(undefined);
|
|
103
146
|
}
|
|
104
|
-
Clarity.setCustomUserId(customUserId);
|
|
147
|
+
return Clarity.setCustomUserId(customUserId);
|
|
105
148
|
}
|
|
106
149
|
|
|
107
150
|
/**
|
|
@@ -112,15 +155,10 @@ function setCustomUserId(customUserId) {
|
|
|
112
155
|
* @param customSessionId The custom session id to set.
|
|
113
156
|
*/
|
|
114
157
|
function setCustomSessionId(customSessionId) {
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
return;
|
|
158
|
+
if (isClarityUnavailable()) {
|
|
159
|
+
return Promise.resolve(undefined);
|
|
118
160
|
}
|
|
119
|
-
|
|
120
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
Clarity.setCustomSessionId(customSessionId);
|
|
161
|
+
return Clarity.setCustomSessionId(customSessionId);
|
|
124
162
|
}
|
|
125
163
|
|
|
126
164
|
/**
|
|
@@ -129,15 +167,10 @@ function setCustomSessionId(customSessionId) {
|
|
|
129
167
|
* @param value The tag value to set.
|
|
130
168
|
*/
|
|
131
169
|
function setCustomTag(key, value) {
|
|
132
|
-
if (
|
|
133
|
-
|
|
134
|
-
return;
|
|
170
|
+
if (isClarityUnavailable()) {
|
|
171
|
+
return Promise.resolve(undefined);
|
|
135
172
|
}
|
|
136
|
-
|
|
137
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
Clarity.setCustomTag(key, value);
|
|
173
|
+
return Clarity.setCustomTag(key, value);
|
|
141
174
|
}
|
|
142
175
|
|
|
143
176
|
/**
|
|
@@ -148,15 +181,10 @@ function setCustomTag(key, value) {
|
|
|
148
181
|
* @param screenName The current screen name to set.
|
|
149
182
|
*/
|
|
150
183
|
function setCurrentScreenName(screenName) {
|
|
151
|
-
if (
|
|
152
|
-
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
if (Clarity === null) {
|
|
156
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
157
|
-
return;
|
|
184
|
+
if (isClarityUnavailable()) {
|
|
185
|
+
return Promise.resolve(undefined);
|
|
158
186
|
}
|
|
159
|
-
Clarity.setCurrentScreenName(screenName);
|
|
187
|
+
return Clarity.setCurrentScreenName(screenName);
|
|
160
188
|
}
|
|
161
189
|
|
|
162
190
|
/**
|
|
@@ -165,13 +193,8 @@ function setCurrentScreenName(screenName) {
|
|
|
165
193
|
* @returns a promise that resolves to the current session id.
|
|
166
194
|
*/
|
|
167
195
|
function getCurrentSessionId() {
|
|
168
|
-
if (
|
|
169
|
-
|
|
170
|
-
return Promise.resolve("Undefined");
|
|
171
|
-
}
|
|
172
|
-
if (Clarity === null) {
|
|
173
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
174
|
-
return Promise.resolve("Undefined");
|
|
196
|
+
if (isClarityUnavailable()) {
|
|
197
|
+
return Promise.resolve('Undefined');
|
|
175
198
|
}
|
|
176
199
|
return Clarity.getCurrentSessionId();
|
|
177
200
|
}
|
|
@@ -183,13 +206,8 @@ function getCurrentSessionId() {
|
|
|
183
206
|
* @returns a promise that resolves to the current session url if there is an active one.
|
|
184
207
|
*/
|
|
185
208
|
function getCurrentSessionUrl() {
|
|
186
|
-
if (
|
|
187
|
-
|
|
188
|
-
return Promise.resolve("Undefined");
|
|
189
|
-
}
|
|
190
|
-
if (Clarity === null) {
|
|
191
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
192
|
-
return Promise.resolve("Undefined");
|
|
209
|
+
if (isClarityUnavailable()) {
|
|
210
|
+
return Promise.resolve('Undefined');
|
|
193
211
|
}
|
|
194
212
|
return Clarity.getCurrentSessionUrl();
|
|
195
213
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Clarity","NativeModules","SupportedPlatforms","LogLevel","exports","initialize","projectId","config","Error","userId","logLevel","None","allowMeteredNetworkUsage","enableWebViewCapture","allowedDomains","disableOnLowEndDevices","maximumDailyNetworkUsageInMB","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","Clarity","NativeModules","SupportedPlatforms","LogLevel","exports","isClarityUnavailable","includes","OS","console","warn","join","error","initialize","projectId","config","Error","userId","logLevel","None","allowMeteredNetworkUsage","enableWebViewCapture","allowedDomains","disableOnLowEndDevices","maximumDailyNetworkUsageInMB","enableIOS_experimental","push","enableDailyNetworkUsageLimit","refinedMaximumDailyNetworkUsageInMB","pause","Promise","resolve","undefined","resume","isPaused","setCustomUserId","customUserId","setCustomSessionId","customSessionId","setCustomTag","key","value","setCurrentScreenName","screenName","getCurrentSessionId","getCurrentSessionUrl"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACjB,+EAA+E,GAC/EC,qBAAQ,CAACC,MAAM,CAAC;EACdC,GAAG,EAAE,8CAA8C;EACnDC,OAAO,EAAE;AACX,CAAC,CAAC,GACF,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,OAAO,GAAGC,0BAAa,CAACD,OAAO;AAErC,MAAME,kBAAkB,GAAG,CAAC,SAAS,CAAC;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAYA;AACA;AACA;AAFA,IAGYC,QAAQ,GAAAC,OAAA,CAAAD,QAAA,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AASpB,SAASE,oBAAoBA,CAAA,EAAY;EACvC,IAAI,CAACH,kBAAkB,CAACI,QAAQ,C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EAAEC,KAAa,EAAgC;EACrF,IAAInC,oBAAoB,CAAC,CAAC,EAAE;IAC1B,OAAOwB,OAAO,CAACC,OAAO,CAACC,SAAS,CAAC;EACnC;EAEA,OAAO/B,OAAO,CAACsC,YAAY,CAACC,GAAG,EAAEC,KAAK,CAAC;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,oBAAoBA,CAClCC,UAAyB,EACK;EAC9B,IAAIrC,oBAAoB,CAAC,CAAC,EAAE;IAC1B,OAAOwB,OAAO,CAACC,OAAO,CAACC,SAAS,CAAC;EACnC;EAEA,OAAO/B,OAAO,CAACyC,oBAAoB,CAACC,UAAU,CAAC;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAAA,EAAoB;EACrD,IAAItC,oBAAoB,CAAC,CAAC,EAAE;IAC1B,OAAOwB,OAAO,CAACC,OAAO,CAAC,WAAW,CAAC;EACrC;EAEA,OAAO9B,OAAO,CAAC2C,mBAAmB,CAAC,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,oBAAoBA,CAAA,EAAoB;EACtD,IAAIvC,oBAAoB,CAAC,CAAC,EAAE;IAC1B,OAAOwB,OAAO,CAACC,OAAO,CAAC,WAAW,CAAC;EACrC;EAEA,OAAO9B,OAAO,CAAC4C,oBAAoB,CAAC,CAAC;AACvC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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
|
-
|
|
2
|
+
const LINKING_ERROR = `The package 'react-native-clarity' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
3
|
+
ios: "- You have run 'pod install --repo-update'\n",
|
|
4
|
+
default: ''
|
|
5
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
5
6
|
const Clarity = NativeModules.Clarity;
|
|
6
7
|
const SupportedPlatforms = ['android'];
|
|
7
8
|
|
|
@@ -18,8 +19,11 @@ const SupportedPlatforms = ['android'];
|
|
|
18
19
|
* @param enableWebViewCapture [OPTIONAL default = true] Allows Clarity to capture the web views DOM content.
|
|
19
20
|
* @param allowedDomains [OPTIONAL default = ["*"]] The whitelisted domains to allow Clarity to capture their DOM content.
|
|
20
21
|
* If it contains "*" as an element, all domains will be captured.
|
|
22
|
+
* Note: iOS currently does not support allowedDomains feature.
|
|
21
23
|
* @param disableOnLowEndDevices [OPTIONAL default = false] Disable Clarity on low-end devices.
|
|
22
24
|
* @param maximumDailyNetworkUsageInMB [OPTIONAL default = null] Maximum daily network usage for Clarity (null = No limit). When the limit is reached, Clarity will turn on lean mode.
|
|
25
|
+
* Note: iOS currently does not support limiting network usage.
|
|
26
|
+
* @param enableIOS_experimental [OPTIONAL default = false] Experimental flag to enable Clarity on iOS platform.
|
|
23
27
|
*/
|
|
24
28
|
|
|
25
29
|
/**
|
|
@@ -34,15 +38,26 @@ export let LogLevel = /*#__PURE__*/function (LogLevel) {
|
|
|
34
38
|
LogLevel["None"] = "None";
|
|
35
39
|
return LogLevel;
|
|
36
40
|
}({});
|
|
41
|
+
function isClarityUnavailable() {
|
|
42
|
+
if (!SupportedPlatforms.includes(Platform.OS)) {
|
|
43
|
+
console.warn('Clarity supports ' + SupportedPlatforms.join(', ') + ' only for now.');
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
if (Clarity === null) {
|
|
47
|
+
console.error('Clarity did not initialize properly.', LINKING_ERROR);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
37
52
|
|
|
38
53
|
/**
|
|
39
54
|
* Initializes the Clarity SDK if the API level is supported.
|
|
40
55
|
* @param projectId [REQUIRED] The Clarity project id to send data to.
|
|
41
56
|
* @param config [OPTIONAL] The clarity config, if not provided default values are used.
|
|
42
|
-
*/
|
|
57
|
+
*/
|
|
43
58
|
export function initialize(projectId, config) {
|
|
44
|
-
if (typeof projectId !==
|
|
45
|
-
throw Error(
|
|
59
|
+
if (typeof projectId !== 'string' || !(typeof config === 'object' || typeof config === 'undefined')) {
|
|
60
|
+
throw Error('Invalid Clarity initialization arguments. Please check the docs for assitance.');
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
// applying default values
|
|
@@ -51,16 +66,15 @@ export function initialize(projectId, config) {
|
|
|
51
66
|
logLevel = LogLevel.None,
|
|
52
67
|
allowMeteredNetworkUsage = false,
|
|
53
68
|
enableWebViewCapture = true,
|
|
54
|
-
allowedDomains = [
|
|
69
|
+
allowedDomains = ['*'],
|
|
55
70
|
disableOnLowEndDevices = false,
|
|
56
|
-
maximumDailyNetworkUsageInMB = null
|
|
71
|
+
maximumDailyNetworkUsageInMB = null,
|
|
72
|
+
enableIOS_experimental = false
|
|
57
73
|
} = config ?? {};
|
|
58
|
-
if (!SupportedPlatforms.includes(
|
|
59
|
-
|
|
60
|
-
return;
|
|
74
|
+
if (enableIOS_experimental === true && !SupportedPlatforms.includes('ios')) {
|
|
75
|
+
SupportedPlatforms.push('ios');
|
|
61
76
|
}
|
|
62
|
-
if (
|
|
63
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
77
|
+
if (isClarityUnavailable()) {
|
|
64
78
|
return;
|
|
65
79
|
}
|
|
66
80
|
|
|
@@ -70,6 +84,37 @@ export function initialize(projectId, config) {
|
|
|
70
84
|
Clarity.initialize(projectId, userId, logLevel, allowMeteredNetworkUsage, enableWebViewCapture, allowedDomains, disableOnLowEndDevices, enableDailyNetworkUsageLimit, refinedMaximumDailyNetworkUsageInMB);
|
|
71
85
|
}
|
|
72
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Pauses the Clarity capturing processes until the next resume() is called.
|
|
89
|
+
*/
|
|
90
|
+
export function pause() {
|
|
91
|
+
if (isClarityUnavailable()) {
|
|
92
|
+
return Promise.resolve(undefined);
|
|
93
|
+
}
|
|
94
|
+
return Clarity.pause();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Resumes the Clarity capturing processes if they are not already resumed.
|
|
99
|
+
* Note: Clarity starts capturing data right on initialization.
|
|
100
|
+
*/
|
|
101
|
+
export function resume() {
|
|
102
|
+
if (isClarityUnavailable()) {
|
|
103
|
+
return Promise.resolve(undefined);
|
|
104
|
+
}
|
|
105
|
+
return Clarity.resume();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Returns true if Clarity has been paused by the user.
|
|
110
|
+
*/
|
|
111
|
+
export function isPaused() {
|
|
112
|
+
if (isClarityUnavailable()) {
|
|
113
|
+
return Promise.resolve(undefined);
|
|
114
|
+
}
|
|
115
|
+
return Clarity.isPaused();
|
|
116
|
+
}
|
|
117
|
+
|
|
73
118
|
/**
|
|
74
119
|
* Sets a custom user id that can be used to identify the user. It has less
|
|
75
120
|
* restrictions than the userId parameter. You can pass any string and
|
|
@@ -81,15 +126,10 @@ export function initialize(projectId, config) {
|
|
|
81
126
|
* @param customUserId The custom user id to set.
|
|
82
127
|
*/
|
|
83
128
|
export function setCustomUserId(customUserId) {
|
|
84
|
-
if (
|
|
85
|
-
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
if (Clarity === null) {
|
|
89
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
90
|
-
return;
|
|
129
|
+
if (isClarityUnavailable()) {
|
|
130
|
+
return Promise.resolve(undefined);
|
|
91
131
|
}
|
|
92
|
-
Clarity.setCustomUserId(customUserId);
|
|
132
|
+
return Clarity.setCustomUserId(customUserId);
|
|
93
133
|
}
|
|
94
134
|
|
|
95
135
|
/**
|
|
@@ -100,15 +140,10 @@ export function setCustomUserId(customUserId) {
|
|
|
100
140
|
* @param customSessionId The custom session id to set.
|
|
101
141
|
*/
|
|
102
142
|
export function setCustomSessionId(customSessionId) {
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
-
return;
|
|
143
|
+
if (isClarityUnavailable()) {
|
|
144
|
+
return Promise.resolve(undefined);
|
|
106
145
|
}
|
|
107
|
-
|
|
108
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
Clarity.setCustomSessionId(customSessionId);
|
|
146
|
+
return Clarity.setCustomSessionId(customSessionId);
|
|
112
147
|
}
|
|
113
148
|
|
|
114
149
|
/**
|
|
@@ -117,15 +152,10 @@ export function setCustomSessionId(customSessionId) {
|
|
|
117
152
|
* @param value The tag value to set.
|
|
118
153
|
*/
|
|
119
154
|
export function setCustomTag(key, value) {
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
return;
|
|
155
|
+
if (isClarityUnavailable()) {
|
|
156
|
+
return Promise.resolve(undefined);
|
|
123
157
|
}
|
|
124
|
-
|
|
125
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
Clarity.setCustomTag(key, value);
|
|
158
|
+
return Clarity.setCustomTag(key, value);
|
|
129
159
|
}
|
|
130
160
|
|
|
131
161
|
/**
|
|
@@ -136,15 +166,10 @@ export function setCustomTag(key, value) {
|
|
|
136
166
|
* @param screenName The current screen name to set.
|
|
137
167
|
*/
|
|
138
168
|
export function setCurrentScreenName(screenName) {
|
|
139
|
-
if (
|
|
140
|
-
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
if (Clarity === null) {
|
|
144
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
145
|
-
return;
|
|
169
|
+
if (isClarityUnavailable()) {
|
|
170
|
+
return Promise.resolve(undefined);
|
|
146
171
|
}
|
|
147
|
-
Clarity.setCurrentScreenName(screenName);
|
|
172
|
+
return Clarity.setCurrentScreenName(screenName);
|
|
148
173
|
}
|
|
149
174
|
|
|
150
175
|
/**
|
|
@@ -153,13 +178,8 @@ export function setCurrentScreenName(screenName) {
|
|
|
153
178
|
* @returns a promise that resolves to the current session id.
|
|
154
179
|
*/
|
|
155
180
|
export function getCurrentSessionId() {
|
|
156
|
-
if (
|
|
157
|
-
|
|
158
|
-
return Promise.resolve("Undefined");
|
|
159
|
-
}
|
|
160
|
-
if (Clarity === null) {
|
|
161
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
162
|
-
return Promise.resolve("Undefined");
|
|
181
|
+
if (isClarityUnavailable()) {
|
|
182
|
+
return Promise.resolve('Undefined');
|
|
163
183
|
}
|
|
164
184
|
return Clarity.getCurrentSessionId();
|
|
165
185
|
}
|
|
@@ -171,13 +191,8 @@ export function getCurrentSessionId() {
|
|
|
171
191
|
* @returns a promise that resolves to the current session url if there is an active one.
|
|
172
192
|
*/
|
|
173
193
|
export function getCurrentSessionUrl() {
|
|
174
|
-
if (
|
|
175
|
-
|
|
176
|
-
return Promise.resolve("Undefined");
|
|
177
|
-
}
|
|
178
|
-
if (Clarity === null) {
|
|
179
|
-
console.error("Clarity did not initialize properly.", LINKING_ERROR);
|
|
180
|
-
return Promise.resolve("Undefined");
|
|
194
|
+
if (isClarityUnavailable()) {
|
|
195
|
+
return Promise.resolve('Undefined');
|
|
181
196
|
}
|
|
182
197
|
return Clarity.getCurrentSessionUrl();
|
|
183
198
|
}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","Clarity","SupportedPlatforms","LogLevel","initialize","projectId","config","Error","userId","logLevel","None","allowMeteredNetworkUsage","enableWebViewCapture","allowedDomains","disableOnLowEndDevices","maximumDailyNetworkUsageInMB","
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Clarity","SupportedPlatforms","LogLevel","isClarityUnavailable","includes","OS","console","warn","join","error","initialize","projectId","config","Error","userId","logLevel","None","allowMeteredNetworkUsage","enableWebViewCapture","allowedDomains","disableOnLowEndDevices","maximumDailyNetworkUsageInMB","enableIOS_experimental","push","enableDailyNetworkUsageLimit","refinedMaximumDailyNetworkUsageInMB","pause","Promise","resolve","undefined","resume","isPaused","setCustomUserId","customUserId","setCustomSessionId","customSessionId","setCustomTag","key","value","setCurrentScreenName","screenName","getCurrentSessionId","getCurrentSessionUrl"],"sourceRoot":"..\\..\\src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,+EAA+E,GAC/ED,QAAQ,CAACE,MAAM,CAAC;EACdC,GAAG,EAAE,8CAA8C;EACnDC,OAAO,EAAE;AACX,CAAC,CAAC,GACF,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,OAAO,GAAGN,aAAa,CAACM,OAAO;AAErC,MAAMC,kBAAkB,GAAG,CAAC,SAAS,CAAC;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA,WAAYC,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AASpB,SAASC,oBAAoBA,CAAA,EAAY;EACvC,IAAI,CAACF,kBAAkB,CAACG,QAAQ,CAACT,QAAQ,CAACU,EAAE,CAAC,EAAE;IAC7CC,OAAO,CAACC,IAAI,CACV,mBAAmB,GAAGN,kBAAkB,CAACO,IAAI,CAAC,IAAI,CAAC,GAAG,gBACxD,CAAC;IACD,OAAO,IAAI;EACb;EAEA,IAAIR,OAAO,KAAK,IAAI,EAAE;IACpBM,OAAO,CAACG,KAAK,CAAC,sCAAsC,EAAEb,aAAa,CAAC;IACpE,OAAO,IAAI;EACb;EAEA,OAAO,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASc,UAAUA,CAACC,SAAiB,EAAEC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ACC,OAAO,CAACC,SAAS,CAAC;EACnC;EAEA,OAAO7B,OAAO,CAACuC,oBAAoB,CAACC,UAAU,CAAC;AACjD;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAA,EAAoB;EACrD,IAAItC,oBAAoB,CAAC,CAAC,EAAE;IAC1B,OAAOwB,OAAO,CAACC,OAAO,CAAC,WAAW,CAAC;EACrC;EAEA,OAAO5B,OAAO,CAACyC,mBAAmB,CAAC,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAA,EAAoB;EACtD,IAAIvC,oBAAoB,CAAC,CAAC,EAAE;IAC1B,OAAOwB,OAAO,CAACC,OAAO,CAAC,WAAW,CAAC;EACrC;EAEA,OAAO5B,OAAO,CAAC0C,oBAAoB,CAAC,CAAC;AACvC","ignoreList":[]}
|
|
@@ -11,8 +11,11 @@
|
|
|
11
11
|
* @param enableWebViewCapture [OPTIONAL default = true] Allows Clarity to capture the web views DOM content.
|
|
12
12
|
* @param allowedDomains [OPTIONAL default = ["*"]] The whitelisted domains to allow Clarity to capture their DOM content.
|
|
13
13
|
* If it contains "*" as an element, all domains will be captured.
|
|
14
|
+
* Note: iOS currently does not support allowedDomains feature.
|
|
14
15
|
* @param disableOnLowEndDevices [OPTIONAL default = false] Disable Clarity on low-end devices.
|
|
15
16
|
* @param maximumDailyNetworkUsageInMB [OPTIONAL default = null] Maximum daily network usage for Clarity (null = No limit). When the limit is reached, Clarity will turn on lean mode.
|
|
17
|
+
* Note: iOS currently does not support limiting network usage.
|
|
18
|
+
* @param enableIOS_experimental [OPTIONAL default = false] Experimental flag to enable Clarity on iOS platform.
|
|
16
19
|
*/
|
|
17
20
|
export interface ClarityConfig {
|
|
18
21
|
userId?: string | null;
|
|
@@ -22,6 +25,7 @@ export interface ClarityConfig {
|
|
|
22
25
|
allowedDomains?: string[];
|
|
23
26
|
disableOnLowEndDevices?: Boolean;
|
|
24
27
|
maximumDailyNetworkUsageInMB?: number;
|
|
28
|
+
enableIOS_experimental?: boolean;
|
|
25
29
|
}
|
|
26
30
|
/**
|
|
27
31
|
* The level of logging to show in the device logcat stream.
|
|
@@ -38,8 +42,21 @@ export declare enum LogLevel {
|
|
|
38
42
|
* Initializes the Clarity SDK if the API level is supported.
|
|
39
43
|
* @param projectId [REQUIRED] The Clarity project id to send data to.
|
|
40
44
|
* @param config [OPTIONAL] The clarity config, if not provided default values are used.
|
|
41
|
-
*/
|
|
45
|
+
*/
|
|
42
46
|
export declare function initialize(projectId: string, config?: ClarityConfig): void;
|
|
47
|
+
/**
|
|
48
|
+
* Pauses the Clarity capturing processes until the next resume() is called.
|
|
49
|
+
*/
|
|
50
|
+
export declare function pause(): Promise<boolean | undefined>;
|
|
51
|
+
/**
|
|
52
|
+
* Resumes the Clarity capturing processes if they are not already resumed.
|
|
53
|
+
* Note: Clarity starts capturing data right on initialization.
|
|
54
|
+
*/
|
|
55
|
+
export declare function resume(): Promise<boolean | undefined>;
|
|
56
|
+
/**
|
|
57
|
+
* Returns true if Clarity has been paused by the user.
|
|
58
|
+
*/
|
|
59
|
+
export declare function isPaused(): Promise<Boolean | undefined>;
|
|
43
60
|
/**
|
|
44
61
|
* Sets a custom user id that can be used to identify the user. It has less
|
|
45
62
|
* restrictions than the userId parameter. You can pass any string and
|
|
@@ -50,7 +67,7 @@ export declare function initialize(projectId: string, config?: ClarityConfig): v
|
|
|
50
67
|
* </p>
|
|
51
68
|
* @param customUserId The custom user id to set.
|
|
52
69
|
*/
|
|
53
|
-
export declare function setCustomUserId(customUserId: string):
|
|
70
|
+
export declare function setCustomUserId(customUserId: string): Promise<boolean | undefined>;
|
|
54
71
|
/**
|
|
55
72
|
* Sets a custom session id that can be used to identify the session.
|
|
56
73
|
* <p>
|
|
@@ -58,13 +75,13 @@ export declare function setCustomUserId(customUserId: string): void;
|
|
|
58
75
|
* </p>
|
|
59
76
|
* @param customSessionId The custom session id to set.
|
|
60
77
|
*/
|
|
61
|
-
export declare function setCustomSessionId(customSessionId: string):
|
|
78
|
+
export declare function setCustomSessionId(customSessionId: string): Promise<boolean | undefined>;
|
|
62
79
|
/**
|
|
63
80
|
* Sets a custom tag for the current session.
|
|
64
81
|
* @param key The tag key to set.
|
|
65
82
|
* @param value The tag value to set.
|
|
66
83
|
*/
|
|
67
|
-
export declare function setCustomTag(key: string, value: string):
|
|
84
|
+
export declare function setCustomTag(key: string, value: string): Promise<boolean | undefined>;
|
|
68
85
|
/**
|
|
69
86
|
* For React Native applications only, this function is used to set the current screen name
|
|
70
87
|
* in case the ReactNative Navigation package is used.
|
|
@@ -72,7 +89,7 @@ export declare function setCustomTag(key: string, value: string): void;
|
|
|
72
89
|
* You can it set to `null` to remove the latest set value.
|
|
73
90
|
* @param screenName The current screen name to set.
|
|
74
91
|
*/
|
|
75
|
-
export declare function setCurrentScreenName(screenName: string | null):
|
|
92
|
+
export declare function setCurrentScreenName(screenName: string | null): Promise<boolean | undefined>;
|
|
76
93
|
/**
|
|
77
94
|
* Returns the active session id. This can be used to correlate the Clarity session with other
|
|
78
95
|
* analytics tools that the developer may be using.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,sBAAsB,CAAC,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"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
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",
|
|
@@ -77,7 +77,13 @@
|
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"react": "*",
|
|
80
|
-
"react-native": "*"
|
|
80
|
+
"react-native": "*",
|
|
81
|
+
"react-native-svg": ">=14.0.0"
|
|
82
|
+
},
|
|
83
|
+
"peerDependenciesMeta": {
|
|
84
|
+
"react-native-svg": {
|
|
85
|
+
"optional": true
|
|
86
|
+
}
|
|
81
87
|
},
|
|
82
88
|
"engines": {
|
|
83
89
|
"node": ">= 16.0.0"
|