react-native-acoustic-connect-beta 18.0.11 → 18.0.13
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/Examples/SampleUI/ConnectConfig.json +180 -0
- package/Examples/SampleUI/android/app/build.gradle +2 -0
- package/Examples/SampleUI/android/app/src/main/AndroidManifest.xml +18 -13
- package/Examples/SampleUI/android/app/src/main/java/com/sampleui/MainActivity.kt +47 -5
- package/Examples/SampleUI/ios/SampleUI.xcodeproj/xcshareddata/xcschemes/SampleUI.xcscheme +17 -0
- package/Examples/SampleUI/metro.config.js +2 -1
- package/Examples/SampleUI/package.json +3 -2
- package/Examples/SampleUI/src/RootNavigator.tsx +10 -1
- package/Examples/SampleUI/src/index.native.tsx +46 -31
- package/README.md +4 -0
- package/android/src/main/assets/ConnectAdvancedConfig.json +1 -1
- package/android/src/main/assets/TealeafAdvancedConfig.json +1 -1
- package/lib/commonjs/TLTRN.js +219 -0
- package/lib/commonjs/TLTRN.js.map +1 -0
- package/lib/commonjs/components/Connect.js +105 -0
- package/lib/commonjs/components/Connect.js.map +1 -0
- package/lib/commonjs/components/ConnectProfiler.js +45 -0
- package/lib/commonjs/components/ConnectProfiler.js.map +1 -0
- package/lib/commonjs/index.js +22 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/KeyboardListener.js +110 -0
- package/lib/commonjs/utils/KeyboardListener.js.map +1 -0
- package/lib/module/TLTRN.js +214 -0
- package/lib/module/TLTRN.js.map +1 -0
- package/lib/module/components/Connect.js +98 -0
- package/lib/module/components/Connect.js.map +1 -0
- package/lib/module/components/ConnectProfiler.js +40 -0
- package/lib/module/components/ConnectProfiler.js.map +1 -0
- package/lib/module/index.js +4 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/KeyboardListener.js +105 -0
- package/lib/module/utils/KeyboardListener.js.map +1 -0
- package/lib/typescript/src/TLTRN.d.ts +47 -0
- package/lib/typescript/src/TLTRN.d.ts.map +1 -0
- package/lib/typescript/src/components/Connect.d.ts +18 -0
- package/lib/typescript/src/components/Connect.d.ts.map +1 -0
- package/lib/typescript/src/components/ConnectProfiler.d.ts +23 -0
- package/lib/typescript/src/components/ConnectProfiler.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/react-native-acoustic-connect.nitro.d.ts.map +1 -1
- package/{jslib/components/ConnectProfiler.js → lib/typescript/src/utils/KeyboardListener.d.ts} +9 -29
- package/lib/typescript/src/utils/KeyboardListener.d.ts.map +1 -0
- package/package.json +1 -2
- package/scripts/ConnectConfig.json +1 -1
- package/scripts/javaParser.js +1 -1
- package/{jslib/TLTRN.js → src/TLTRN.ts} +54 -39
- package/src/components/Connect.tsx +126 -0
- package/src/components/ConnectProfiler.ts +43 -0
- package/src/index.ts +5 -3
- package/src/specs/react-native-acoustic-connect.nitro.ts +1 -15
- package/src/utils/KeyboardListener.ts +113 -0
- package/Examples/SampleUI/package-lock.json +0 -17033
- package/jslib/components/Connect.js +0 -85
- package/jslib/utils/KeyboardListener.js +0 -100
- package/lib/commonjs/types.js +0 -24
- package/lib/commonjs/types.js.map +0 -1
- package/lib/module/types.js +0 -24
- package/lib/module/types.js.map +0 -1
- package/lib/typescript/jslib/TLTRN.d.ts +0 -37
- package/lib/typescript/jslib/TLTRN.d.ts.map +0 -1
- package/lib/typescript/jslib/components/Connect.d.ts +0 -4
- package/lib/typescript/jslib/components/Connect.d.ts.map +0 -1
- package/lib/typescript/jslib/components/ConnectProfiler.d.ts +0 -10
- package/lib/typescript/jslib/components/ConnectProfiler.d.ts.map +0 -1
- package/lib/typescript/jslib/utils/KeyboardListener.d.ts +0 -10
- package/lib/typescript/jslib/utils/KeyboardListener.d.ts.map +0 -1
- package/lib/typescript/src/types.d.ts +0 -1
- package/lib/typescript/src/types.d.ts.map +0 -1
- package/src/types.ts +0 -23
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-native-acoustic-connect.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/react-native-acoustic-connect.nitro.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"react-native-acoustic-connect.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/react-native-acoustic-connect.nitro.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAG9D,MAAM,MAAM,cAAc,GAAG;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,QAAQ,GAAG,iBAAiB,GAAG,MAAM,CAAA;AAE9E,MAAM,WAAW,iBAAkB,SAAQ,YAAY,CAAC;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;IACxF,0BAA0B,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAA;IACpF,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAA;IAC5E,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAA;IAC5E,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAA;IAC/F,0BAA0B,CAAC,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAA;IACzF,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAI,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IACpG,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAAA;IAChF,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;IAC5G,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;IACpF,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAA;IAClF,WAAW,IAAI,OAAO,CAAA;IACtB,gCAAgC,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;IAC7F,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAA;IACzD,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAA;IAC/F,oBAAoB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAA;IACtD,wBAAwB,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAC,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAA;IACjH,0BAA0B,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAC,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAA;IACnH,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;CACxD"}
|
package/{jslib/components/ConnectProfiler.js → lib/typescript/src/utils/KeyboardListener.d.ts}
RENAMED
|
@@ -7,34 +7,14 @@
|
|
|
7
7
|
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
8
|
* prohibited.
|
|
9
9
|
********************************************************************************************/
|
|
10
|
-
|
|
11
|
-
import React, {Component} from "react";
|
|
12
10
|
import TLTRN from '../TLTRN';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
super(props)
|
|
21
|
-
this.startTime = (new Date()).getTime();
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
componentDidMount(){
|
|
26
|
-
this.endTime = (new Date()).getTime();
|
|
27
|
-
const pageLoadTime = this.endTime - this.startTime
|
|
28
|
-
const {profileName} = this.props
|
|
29
|
-
|
|
30
|
-
if(profileName){
|
|
31
|
-
TLTRN.logCustomEvent("Load Time",{profileName, pageLoadTime},1)
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
render(){
|
|
36
|
-
return this.props.children
|
|
37
|
-
}
|
|
11
|
+
declare class KeyboardListener {
|
|
12
|
+
static TLTRN: TLTRN | null;
|
|
13
|
+
static listener: KeyboardListener | null;
|
|
14
|
+
static _instance(_TLTRN: TLTRN): KeyboardListener;
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
constructor(_TLTRN: TLTRN);
|
|
17
|
+
interceptKeyboardEvents(enable: boolean): void;
|
|
38
18
|
}
|
|
39
|
-
|
|
40
|
-
|
|
19
|
+
export default KeyboardListener;
|
|
20
|
+
//# sourceMappingURL=KeyboardListener.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyboardListener.d.ts","sourceRoot":"","sources":["../../../../src/utils/KeyboardListener.ts"],"names":[],"mappings":"AAAA;;;;;;;;6FAQ6F;AAG7F,OAAO,KAAK,MAAM,UAAU,CAAC;AAE7B,cAAM,gBAAgB;IAClB,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAQ;IAClC,MAAM,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAQ;IAEhD,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,GAAG,gBAAgB;IAOjD,OAAO,EAAE,OAAO,CAAC;gBAEL,MAAM,EAAE,KAAK;IAiFzB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;CAGjD;AAED,eAAe,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
"src",
|
|
54
54
|
"react-native.config.js",
|
|
55
55
|
"lib",
|
|
56
|
-
"jslib",
|
|
57
56
|
"nitrogen",
|
|
58
57
|
"cpp",
|
|
59
58
|
"android/build.gradle",
|
|
@@ -193,7 +192,7 @@
|
|
|
193
192
|
"source": "src/index",
|
|
194
193
|
"summary": "react-native ios android tealeaf connect cxa wxca er enhanced-replay",
|
|
195
194
|
"types": "./lib/typescript/src/index.d.ts",
|
|
196
|
-
"version": "18.0.
|
|
195
|
+
"version": "18.0.13",
|
|
197
196
|
"workspaces": [
|
|
198
197
|
"example"
|
|
199
198
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Connect": {
|
|
3
|
-
"AndroidVersion": "10.4.
|
|
3
|
+
"AndroidVersion": "10.4.45",
|
|
4
4
|
"AppKey": "b6c3709b7a4c479bb4b5a9fb8fec324c",
|
|
5
5
|
"KillSwitchUrl": "https://lib-us-2.brilliantcollector.com/collector/switch/b6c3709b7a4c479bb4b5a9fb8fec324c",
|
|
6
6
|
"PostMessageUrl": "https://lib-us-2.brilliantcollector.com/collector/collectorPost",
|
package/scripts/javaParser.js
CHANGED
|
@@ -172,7 +172,7 @@ if (updateMainActivity) {
|
|
|
172
172
|
console.log("File to be saved:\n" + updateMainActivityData);
|
|
173
173
|
|
|
174
174
|
try {
|
|
175
|
-
|
|
175
|
+
fs.writeFileSync(mainActivityPath, updateMainActivityData);
|
|
176
176
|
console.log("Updated:" + mainActivityPath);
|
|
177
177
|
} catch (err) {
|
|
178
178
|
console.log("Error writing:" + mainActivityPath);
|
|
@@ -8,18 +8,20 @@
|
|
|
8
8
|
* prohibited.
|
|
9
9
|
********************************************************************************************/
|
|
10
10
|
|
|
11
|
+
// @ts-ignore
|
|
11
12
|
import MessageQueue from "react-native/Libraries/BatchedBridge/MessageQueue.js";
|
|
13
|
+
import { Platform } from "react-native";
|
|
12
14
|
import KeyboardListener from "./utils/KeyboardListener";
|
|
13
|
-
import AcousticConnectRN from '
|
|
14
|
-
|
|
15
|
-
global.ErrorUtils.setGlobalHandler( (e, isFatal) => {
|
|
15
|
+
import AcousticConnectRN from './index';
|
|
16
16
|
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
global.ErrorUtils.setGlobalHandler((e: any, _isFatal: boolean) => {
|
|
17
19
|
AcousticConnectRN.logExceptionEvent(
|
|
18
20
|
JSON.stringify(e),
|
|
19
21
|
JSON.stringify(e),
|
|
20
22
|
true
|
|
21
|
-
|
|
22
|
-
})
|
|
23
|
+
);
|
|
24
|
+
});
|
|
23
25
|
|
|
24
26
|
class TLTRN {
|
|
25
27
|
static currentScreen =
|
|
@@ -31,10 +33,10 @@ class TLTRN {
|
|
|
31
33
|
static messageConsole = 0;
|
|
32
34
|
static lastMessageConsole = 0;
|
|
33
35
|
static isLoggingData = 0;
|
|
34
|
-
static displayDebug =
|
|
36
|
+
static displayDebug = false;
|
|
35
37
|
|
|
36
38
|
static myTimer = {
|
|
37
|
-
handle:
|
|
39
|
+
handle: null as NodeJS.Timeout | null,
|
|
38
40
|
started: 0,
|
|
39
41
|
time: 1000,
|
|
40
42
|
/**
|
|
@@ -50,57 +52,65 @@ class TLTRN {
|
|
|
50
52
|
stopTimer: function () {
|
|
51
53
|
if (this.handle) {
|
|
52
54
|
clearInterval(this.handle);
|
|
53
|
-
this.handle =
|
|
55
|
+
this.handle = null;
|
|
54
56
|
this.started = 0;
|
|
55
57
|
}
|
|
56
58
|
},
|
|
57
59
|
};
|
|
58
60
|
|
|
59
|
-
static init = (initialCurrentScreen, showDebugConsoleMessages) => {
|
|
61
|
+
static init = (initialCurrentScreen: String, showDebugConsoleMessages: boolean) => {
|
|
60
62
|
TLTRN.currentScreen =
|
|
61
63
|
initialCurrentScreen === undefined
|
|
64
|
+
// @ts-ignore:
|
|
62
65
|
? currentScreenMsg
|
|
63
66
|
: initialCurrentScreen;
|
|
64
67
|
MessageQueue.spy(TLTRN.listenToBridge);
|
|
65
|
-
TLTRN.displayDebug =
|
|
66
|
-
showDebugConsoleMessages === undefined ? 0 : showDebugConsoleMessages;
|
|
68
|
+
TLTRN.displayDebug = showDebugConsoleMessages === undefined ? false : showDebugConsoleMessages;
|
|
67
69
|
};
|
|
68
70
|
|
|
69
|
-
static interceptKeyboardEvents = (enable) => {
|
|
71
|
+
static interceptKeyboardEvents = (enable: boolean) => {
|
|
70
72
|
keyListener.interceptKeyboardEvents(enable);
|
|
71
73
|
};
|
|
72
74
|
|
|
73
|
-
static logScreenViewPageName = (name) => {
|
|
75
|
+
static logScreenViewPageName = (name: string | undefined) => {
|
|
76
|
+
let result = false
|
|
74
77
|
try {
|
|
75
|
-
|
|
76
|
-
} catch (error) {
|
|
78
|
+
result = AcousticConnectRN.setCurrentScreenName(name || '');
|
|
79
|
+
} catch (error: Error | any) {
|
|
77
80
|
console.log('LogScreenViewPageName error: ', error.message);
|
|
78
81
|
}
|
|
82
|
+
return result;
|
|
79
83
|
};
|
|
80
84
|
|
|
81
|
-
static logScreenViewContextLoad = (name, prevName) => {
|
|
85
|
+
static logScreenViewContextLoad = (name: string, prevName: string) => {
|
|
86
|
+
let result = false
|
|
82
87
|
try {
|
|
83
|
-
|
|
84
|
-
} catch (error) {
|
|
88
|
+
result = AcousticConnectRN.logScreenViewContextLoad(name, prevName);
|
|
89
|
+
} catch (error: Error | any) {
|
|
85
90
|
console.log('LogScreenViewContextLoad error: ', error.message);
|
|
86
91
|
}
|
|
92
|
+
return result;
|
|
87
93
|
};
|
|
88
94
|
|
|
89
|
-
static logScreenLayout = (name) => {
|
|
90
|
-
TLTRN.currentScreen = name;
|
|
95
|
+
static logScreenLayout = (name: string | undefined) => {
|
|
96
|
+
TLTRN.currentScreen = name || '';
|
|
97
|
+
let result = false
|
|
91
98
|
try {
|
|
92
|
-
|
|
93
|
-
} catch (error) {
|
|
99
|
+
result = AcousticConnectRN.logScreenLayout(TLTRN.currentScreen, 0);
|
|
100
|
+
} catch (error: Error | any) {
|
|
94
101
|
console.log('LogScreenLayout error: ', error.message);
|
|
95
102
|
}
|
|
103
|
+
return result;
|
|
96
104
|
};
|
|
97
105
|
|
|
98
|
-
static logClickEvent = async (event) => {
|
|
99
|
-
|
|
106
|
+
static logClickEvent = async (event: any) => {
|
|
107
|
+
let result = false
|
|
108
|
+
|
|
109
|
+
if(!event.target || !event.target._nativeTag || typeof event.target._nativeTag === 'undefined'){ return result; }
|
|
100
110
|
|
|
101
|
-
const events = event._dispatchInstances.filter(node => {
|
|
102
|
-
return
|
|
103
|
-
})
|
|
111
|
+
const events = event._dispatchInstances.filter((node: any) => {
|
|
112
|
+
return node.memoizedProps && node.memoizedProps.id;
|
|
113
|
+
});
|
|
104
114
|
const id = (events.length) ? events[0].memoizedProps.id : '';
|
|
105
115
|
|
|
106
116
|
let target = event.target._nativeTag;
|
|
@@ -109,36 +119,41 @@ class TLTRN {
|
|
|
109
119
|
|
|
110
120
|
try {
|
|
111
121
|
if (Platform.OS === 'ios') {
|
|
112
|
-
|
|
122
|
+
result = AcousticConnectRN.logClickEvent(target, controlId);
|
|
113
123
|
} else if (Platform.OS === 'android') {
|
|
114
|
-
|
|
124
|
+
result = AcousticConnectRN.logClickEvent(target, controlId);
|
|
115
125
|
}
|
|
116
|
-
} catch(error){
|
|
126
|
+
} catch(error: Error | any){
|
|
117
127
|
console.log('LogClickEvent error: ', error.message);
|
|
118
128
|
}
|
|
129
|
+
return result;
|
|
119
130
|
};
|
|
120
131
|
|
|
121
|
-
static logTextChangeEvent = async (target, controlId, text,
|
|
132
|
+
static logTextChangeEvent = async (target: number, controlId: string, text: string, _ariaLabel: string) => {
|
|
133
|
+
let result = false
|
|
122
134
|
try {
|
|
123
135
|
if (Platform.OS === 'ios') {
|
|
124
|
-
|
|
136
|
+
result = AcousticConnectRN.logTextChangeEvent(target, controlId, text);
|
|
125
137
|
} else if (Platform.OS === 'android') {
|
|
126
138
|
AcousticConnectRN.logTextChangeEvent(target, controlId, text);
|
|
127
139
|
}
|
|
128
|
-
} catch (error) {
|
|
140
|
+
} catch (error: Error | any) {
|
|
129
141
|
console.log('LogTextChangeEvent error: ', error.message);
|
|
130
142
|
}
|
|
143
|
+
return result;
|
|
131
144
|
};
|
|
132
145
|
|
|
133
|
-
static logCustomEvent = async (eventName, values, level) => {
|
|
146
|
+
static logCustomEvent = async (eventName: string, values: Record<string, string | number | boolean>, level: number) => {
|
|
147
|
+
let result = false
|
|
134
148
|
try {
|
|
135
|
-
|
|
136
|
-
} catch (error) {
|
|
149
|
+
result = AcousticConnectRN.logCustomEvent(eventName, values, level);
|
|
150
|
+
} catch (error: Error | any) {
|
|
137
151
|
console.log('LogCustomEvent error: ', error.message);
|
|
138
152
|
}
|
|
153
|
+
return result;
|
|
139
154
|
};
|
|
140
155
|
|
|
141
|
-
static listenToBridge = (message) => {
|
|
156
|
+
static listenToBridge = (message: any) => {
|
|
142
157
|
if (TLTRN.displayDebug) {
|
|
143
158
|
console.log(
|
|
144
159
|
"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&:isLoggingData:" +
|
|
@@ -232,14 +247,14 @@ class TLTRN {
|
|
|
232
247
|
TLTRN.messageConsole = 0;
|
|
233
248
|
TLTRN.lastMessageConsole = 0;
|
|
234
249
|
TLTRN.myTimer.stopTimer();
|
|
235
|
-
logTeal();
|
|
250
|
+
this.logTeal();
|
|
236
251
|
}
|
|
237
252
|
};
|
|
238
253
|
|
|
239
254
|
static logTeal = async () => {
|
|
240
255
|
try {
|
|
241
256
|
TLTRN.isLoggingData = 1;
|
|
242
|
-
var res = await AcousticConnectRN.logScreenLayout(TLTRN.currentScreen);
|
|
257
|
+
var res = await AcousticConnectRN.logScreenLayout(TLTRN.currentScreen, -1);
|
|
243
258
|
var dict = { ReactLayoutTime: TLTRN.totalRenderTime };
|
|
244
259
|
var result = await AcousticConnectRN.logCustomEvent("ReactPlugin", dict, 1);
|
|
245
260
|
if (TLTRN.displayDebug) {
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/********************************************************************************************
|
|
2
|
+
* Copyright (C) 2025 Acoustic, L.P. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
|
+
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
6
|
+
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
7
|
+
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
|
+
* prohibited.
|
|
9
|
+
********************************************************************************************/
|
|
10
|
+
import React, { useCallback, useEffect, useRef, forwardRef } from "react";
|
|
11
|
+
import { View, StyleSheet, Platform, NativeModules, findNodeHandle } from "react-native";
|
|
12
|
+
import type { LayoutChangeEvent } from "react-native";
|
|
13
|
+
import TLTRN from "../TLTRN";
|
|
14
|
+
|
|
15
|
+
interface ConnectProps {
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
captureKeyboardEvents: boolean;
|
|
18
|
+
navigationRef?: React.RefObject<any>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const Connect = forwardRef<any, ConnectProps>(
|
|
22
|
+
({ children, captureKeyboardEvents, navigationRef }, ref) => {
|
|
23
|
+
const navigation = navigationRef || useRef(null);
|
|
24
|
+
|
|
25
|
+
// Handle forwarded ref
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (ref && typeof ref === "object" && ref !== null) {
|
|
28
|
+
navigation.current = ref.current;
|
|
29
|
+
} else if (typeof ref === "function") {
|
|
30
|
+
ref(navigation.current);
|
|
31
|
+
}
|
|
32
|
+
}, [ref]);
|
|
33
|
+
|
|
34
|
+
const currentRoute = useRef<string | undefined>(undefined);
|
|
35
|
+
const initial = useRef<boolean>(false);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
TLTRN.interceptKeyboardEvents(captureKeyboardEvents);
|
|
39
|
+
}, [captureKeyboardEvents]);
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (
|
|
43
|
+
!navigation.current ||
|
|
44
|
+
typeof navigation.current.addListener !== "function" ||
|
|
45
|
+
typeof navigation.current.getCurrentRoute !== "function"
|
|
46
|
+
) {
|
|
47
|
+
console.warn(
|
|
48
|
+
"Connect: The Connect component's ref must be a NavigationContainer with a ref."
|
|
49
|
+
);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const unsubscribe = navigation.current.addListener("state", () => {
|
|
54
|
+
currentRoute.current = extractName(navigation);
|
|
55
|
+
console.log("State change - ", currentRoute.current);
|
|
56
|
+
|
|
57
|
+
if (Platform.OS === "ios" && currentRoute.current) {
|
|
58
|
+
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
59
|
+
} else if (Platform.OS === "android") {
|
|
60
|
+
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
61
|
+
TLTRN.logScreenLayout(currentRoute.current);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return unsubscribe;
|
|
66
|
+
}, [navigation]);
|
|
67
|
+
|
|
68
|
+
const onStartShouldSetResponderCapture = useCallback(
|
|
69
|
+
(event: any) => {
|
|
70
|
+
currentRoute.current = extractName(navigation);
|
|
71
|
+
if (currentRoute.current) {
|
|
72
|
+
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
73
|
+
}
|
|
74
|
+
TLTRN.logClickEvent(event);
|
|
75
|
+
return false;
|
|
76
|
+
},
|
|
77
|
+
[navigation]
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const onLayout = useCallback(
|
|
81
|
+
(event: LayoutChangeEvent) => {
|
|
82
|
+
if (initial.current) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
initial.current = true;
|
|
86
|
+
|
|
87
|
+
console.log("event - ", event.nativeEvent);
|
|
88
|
+
|
|
89
|
+
currentRoute.current = navigation.current?.getCurrentRoute()?.name;
|
|
90
|
+
if (Platform.OS === "ios" && currentRoute.current) {
|
|
91
|
+
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
92
|
+
} else if (Platform.OS === "android") {
|
|
93
|
+
TLTRN.logScreenLayout(currentRoute.current);
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
},
|
|
97
|
+
[navigation]
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<View
|
|
102
|
+
style={styles.connect_main}
|
|
103
|
+
onLayout={onLayout}
|
|
104
|
+
onStartShouldSetResponderCapture={onStartShouldSetResponderCapture}
|
|
105
|
+
>
|
|
106
|
+
{children}
|
|
107
|
+
</View>
|
|
108
|
+
);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
function extractName(navigation: any): string {
|
|
112
|
+
const routeParams = navigation.current?.getCurrentRoute()?.params;
|
|
113
|
+
if (routeParams) {
|
|
114
|
+
const { name } = routeParams;
|
|
115
|
+
return name || "";
|
|
116
|
+
}
|
|
117
|
+
return navigation.current?.getCurrentRoute()?.name || "";
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export default Connect;
|
|
121
|
+
|
|
122
|
+
const styles = StyleSheet.create({
|
|
123
|
+
connect_main: {
|
|
124
|
+
flex: 1,
|
|
125
|
+
},
|
|
126
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/********************************************************************************************
|
|
2
|
+
* Copyright (C) 2025 Acoustic, L.P. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
|
+
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
6
|
+
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
7
|
+
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
|
+
* prohibited.
|
|
9
|
+
********************************************************************************************/
|
|
10
|
+
|
|
11
|
+
import React, { Component } from "react";
|
|
12
|
+
import TLTRN from "../TLTRN";
|
|
13
|
+
|
|
14
|
+
interface ConnectProfilerProps {
|
|
15
|
+
profileName?: string; // Optional property
|
|
16
|
+
children?: React.ReactNode; // For rendering child components
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
class ConnectProfiler extends Component<ConnectProfilerProps> {
|
|
20
|
+
startTime = 0;
|
|
21
|
+
endTime = 0;
|
|
22
|
+
|
|
23
|
+
constructor(props: ConnectProfilerProps) {
|
|
24
|
+
super(props);
|
|
25
|
+
this.startTime = new Date().getTime();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
componentDidMount() {
|
|
29
|
+
this.endTime = new Date().getTime();
|
|
30
|
+
const pageLoadTime = this.endTime - this.startTime;
|
|
31
|
+
const { profileName } = this.props;
|
|
32
|
+
|
|
33
|
+
if (profileName) {
|
|
34
|
+
TLTRN.logCustomEvent("Load Time", { profileName, pageLoadTime }, 1);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
render() {
|
|
39
|
+
return this.props.children;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default ConnectProfiler;
|
package/src/index.ts
CHANGED
|
@@ -13,9 +13,11 @@
|
|
|
13
13
|
|
|
14
14
|
import { NitroModules } from 'react-native-nitro-modules'
|
|
15
15
|
import type { AcousticConnectRN as AcousticConnectRNSpec } from './specs/react-native-acoustic-connect.nitro'
|
|
16
|
-
|
|
16
|
+
import Connect from './components/Connect'
|
|
17
|
+
import KeyboardListener from './utils/KeyboardListener'
|
|
18
|
+
import TLTRN from './TLTRN'
|
|
17
19
|
|
|
18
|
-
const AcousticConnectRN =
|
|
19
|
-
NitroModules.createHybridObject<AcousticConnectRNSpec>('AcousticConnectRN')
|
|
20
|
+
const AcousticConnectRN = NitroModules.createHybridObject<AcousticConnectRNSpec>('AcousticConnectRN')
|
|
20
21
|
|
|
22
|
+
export { Connect, TLTRN, KeyboardListener}
|
|
21
23
|
export default AcousticConnectRN
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (C)
|
|
1
|
+
// Copyright (C) 2025 Acoustic, L.P. All rights reserved.
|
|
2
2
|
//
|
|
3
3
|
// NOTICE: This file contains material that is confidential and proprietary to
|
|
4
4
|
// Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
@@ -11,19 +11,6 @@
|
|
|
11
11
|
//
|
|
12
12
|
|
|
13
13
|
import { type HybridObject } from 'react-native-nitro-modules'
|
|
14
|
-
// import { type HybridObject, type AnyMap } from 'react-native-nitro-modules'
|
|
15
|
-
// import type { ConnectionType, NetworkInfoListener } from '../types'
|
|
16
|
-
|
|
17
|
-
// // Define a custom type for the values parameter with limited recursion
|
|
18
|
-
// export type KeyValueMap = {
|
|
19
|
-
// placeholder: string; // Add a placeholder property to avoid the "empty struct" error
|
|
20
|
-
// [key: string]: string | number | boolean | null | KeyValueMapLevel1;
|
|
21
|
-
// };
|
|
22
|
-
|
|
23
|
-
// // Define a second level to limit recursion
|
|
24
|
-
// export type KeyValueMapLevel1 = {
|
|
25
|
-
// [key: string]: string | number | boolean | null;
|
|
26
|
-
// };
|
|
27
14
|
|
|
28
15
|
// Define a named type for the anonymous object
|
|
29
16
|
export type KeyValueObject = {
|
|
@@ -33,7 +20,6 @@ export type KeyValueObject = {
|
|
|
33
20
|
|
|
34
21
|
export type ConnectMonitoringLevelType = 'Ignore' | 'CellularAndWiFi' | 'WiFi'
|
|
35
22
|
|
|
36
|
-
|
|
37
23
|
export interface AcousticConnectRN extends HybridObject<{ ios: 'swift', android: 'kotlin' }> {
|
|
38
24
|
setBooleanConfigItemForKey(key: string, value: boolean, moduleName: string): boolean
|
|
39
25
|
setStringItemForKey(key: string, value: string, moduleName: string): boolean
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/********************************************************************************************
|
|
2
|
+
* Copyright (C) 2025 Acoustic, L.P. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* NOTICE: This file contains material that is confidential and proprietary to
|
|
5
|
+
* Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
|
|
6
|
+
* industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
|
|
7
|
+
* Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
|
|
8
|
+
* prohibited.
|
|
9
|
+
********************************************************************************************/
|
|
10
|
+
|
|
11
|
+
import { Keyboard, Platform, TextInput } from "react-native";
|
|
12
|
+
import TLTRN from '../TLTRN';
|
|
13
|
+
|
|
14
|
+
class KeyboardListener {
|
|
15
|
+
static TLTRN: TLTRN | null = null;
|
|
16
|
+
static listener: KeyboardListener | null = null;
|
|
17
|
+
|
|
18
|
+
static _instance(_TLTRN: TLTRN): KeyboardListener {
|
|
19
|
+
if (!KeyboardListener.listener) {
|
|
20
|
+
KeyboardListener.listener = new KeyboardListener(_TLTRN);
|
|
21
|
+
}
|
|
22
|
+
return KeyboardListener.listener;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
|
|
27
|
+
constructor(_TLTRN: TLTRN) {
|
|
28
|
+
KeyboardListener.TLTRN = _TLTRN;
|
|
29
|
+
|
|
30
|
+
this.enabled = false;
|
|
31
|
+
let _x: Record<string, any> = {};
|
|
32
|
+
let _i: Record<string, any> = {};
|
|
33
|
+
|
|
34
|
+
const sanitize = (target: string, text: string): string => {
|
|
35
|
+
if (!_x[target].secureTextEntry || typeof _x[target].secureTextEntry === "undefined") {
|
|
36
|
+
return text;
|
|
37
|
+
}
|
|
38
|
+
return new Array(text.length).fill("*").join("");
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const flushData = (): void => {
|
|
42
|
+
_i = {};
|
|
43
|
+
_x = {};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const keyListener = (evt: any, bubbledEvent: string): void => {
|
|
47
|
+
let _nativeTag = evt?.target?._nativeTag;
|
|
48
|
+
|
|
49
|
+
let valid = this.enabled && (!_i[_nativeTag] || _i[_nativeTag] === bubbledEvent);
|
|
50
|
+
if (!valid) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
_i[_nativeTag] = bubbledEvent;
|
|
55
|
+
if (!_x[_nativeTag]) {
|
|
56
|
+
_x[_nativeTag] = { text: "" };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
_x[_nativeTag].target = evt?.target?._nativeTag;
|
|
60
|
+
_x[_nativeTag].controlId = evt?._targetInst?.memoizedProps?.id;
|
|
61
|
+
_x[_nativeTag].ariaLabel = evt?._targetInst?.memoizedProps?.accessible?.accessibilityLabel;
|
|
62
|
+
_x[_nativeTag].secureTextEntry = evt?._targetInst?.memoizedProps?.secureTextEntry;
|
|
63
|
+
|
|
64
|
+
const anon = (_k: string): string => {
|
|
65
|
+
if (_k !== "Backspace" && _k.length === 1) {
|
|
66
|
+
return (_x[_nativeTag].text += sanitize(_nativeTag, _k));
|
|
67
|
+
} else if (_k !== "Backspace" && _k.length > 1) {
|
|
68
|
+
return sanitize(_nativeTag, _k);
|
|
69
|
+
} else {
|
|
70
|
+
return _x[_nativeTag].text.slice(0, -1);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
let text: string | null = null;
|
|
75
|
+
switch (bubbledEvent) {
|
|
76
|
+
case "onTextInput":
|
|
77
|
+
text = evt?.nativeEvent?.text;
|
|
78
|
+
_x[_nativeTag].text = sanitize(_nativeTag, text || "");
|
|
79
|
+
break;
|
|
80
|
+
case "onKeyPress":
|
|
81
|
+
text = evt?.nativeEvent?.key;
|
|
82
|
+
_x[_nativeTag].text = anon(text || "");
|
|
83
|
+
break;
|
|
84
|
+
case "onChange":
|
|
85
|
+
text = evt?.nativeEvent?.text;
|
|
86
|
+
_x[_nativeTag].text = sanitize(_nativeTag, text || "");
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const keyboardDidHide = async (): Promise<void> => {
|
|
92
|
+
let values = Object.values(_x);
|
|
93
|
+
for (let value of values) {
|
|
94
|
+
let { text, controlId, ariaLabel, target } = value;
|
|
95
|
+
TLTRN.logTextChangeEvent(target, controlId, text, ariaLabel);
|
|
96
|
+
}
|
|
97
|
+
flushData();
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// @ts-ignore: Ignore TypeScript error for defaultProps
|
|
101
|
+
TextInput.defaultProps = TextInput.defaultProps || {};
|
|
102
|
+
// @ts-ignore: Ignore TypeScript error for defaultProps
|
|
103
|
+
TextInput.defaultProps.onChange = (evt: any) => keyListener(evt, "onChange");
|
|
104
|
+
|
|
105
|
+
Keyboard.addListener("keyboardDidHide", keyboardDidHide);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interceptKeyboardEvents(enable: boolean): void {
|
|
109
|
+
this.enabled = enable;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export default KeyboardListener;
|