react-native-acoustic-connect-beta 18.0.12 → 18.0.14

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.
Files changed (48) hide show
  1. package/Examples/SampleUI/src/RootNavigator.tsx +1 -1
  2. package/Examples/SampleUI/src/index.native.tsx +47 -31
  3. package/android/src/main/assets/ConnectAdvancedConfig.json +1 -1
  4. package/android/src/main/assets/TealeafAdvancedConfig.json +1 -1
  5. package/ios/HybridAcousticConnectRN.swift +4 -4
  6. package/lib/commonjs/TLTRN.js +219 -0
  7. package/lib/commonjs/TLTRN.js.map +1 -0
  8. package/lib/commonjs/components/Connect.js +19 -14
  9. package/lib/commonjs/components/Connect.js.map +1 -1
  10. package/lib/commonjs/components/ConnectProfiler.js +45 -0
  11. package/lib/commonjs/components/ConnectProfiler.js.map +1 -0
  12. package/lib/commonjs/index.js +14 -3
  13. package/lib/commonjs/index.js.map +1 -1
  14. package/lib/commonjs/utils/KeyboardListener.js +110 -0
  15. package/lib/commonjs/utils/KeyboardListener.js.map +1 -0
  16. package/lib/module/TLTRN.js +214 -0
  17. package/lib/module/TLTRN.js.map +1 -0
  18. package/lib/module/components/Connect.js +18 -14
  19. package/lib/module/components/Connect.js.map +1 -1
  20. package/lib/module/components/ConnectProfiler.js +40 -0
  21. package/lib/module/components/ConnectProfiler.js.map +1 -0
  22. package/lib/module/index.js +4 -3
  23. package/lib/module/index.js.map +1 -1
  24. package/lib/module/utils/KeyboardListener.js +105 -0
  25. package/lib/module/utils/KeyboardListener.js.map +1 -0
  26. package/lib/typescript/src/TLTRN.d.ts +47 -0
  27. package/lib/typescript/src/TLTRN.d.ts.map +1 -0
  28. package/lib/typescript/src/components/Connect.d.ts.map +1 -1
  29. package/lib/typescript/src/components/ConnectProfiler.d.ts +23 -0
  30. package/lib/typescript/src/components/ConnectProfiler.d.ts.map +1 -0
  31. package/lib/typescript/src/index.d.ts +3 -1
  32. package/lib/typescript/src/index.d.ts.map +1 -1
  33. package/{jslib/components/ConnectProfiler.js → lib/typescript/src/utils/KeyboardListener.d.ts} +9 -29
  34. package/lib/typescript/src/utils/KeyboardListener.d.ts.map +1 -0
  35. package/package.json +1 -2
  36. package/scripts/ConnectConfig.json +1 -1
  37. package/{jslib/TLTRN.js → src/TLTRN.ts} +54 -39
  38. package/src/components/Connect.tsx +18 -16
  39. package/src/components/ConnectProfiler.ts +43 -0
  40. package/src/index.ts +4 -2
  41. package/src/utils/KeyboardListener.ts +113 -0
  42. package/jslib/utils/KeyboardListener.js +0 -100
  43. package/lib/typescript/jslib/TLTRN.d.ts +0 -37
  44. package/lib/typescript/jslib/TLTRN.d.ts.map +0 -1
  45. package/lib/typescript/jslib/components/ConnectProfiler.d.ts +0 -10
  46. package/lib/typescript/jslib/components/ConnectProfiler.d.ts.map +0 -1
  47. package/lib/typescript/jslib/utils/KeyboardListener.d.ts +0 -10
  48. package/lib/typescript/jslib/utils/KeyboardListener.d.ts.map +0 -1
@@ -0,0 +1,47 @@
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
+ /// <reference types="node" />
11
+ declare class TLTRN {
12
+ static currentScreen: string;
13
+ static lastJSBridgeMessageTime: number;
14
+ static totalRenderTime: number;
15
+ static messageRenderTime: number;
16
+ static countMsgs: number;
17
+ static messageConsole: number;
18
+ static lastMessageConsole: number;
19
+ static isLoggingData: number;
20
+ static displayDebug: boolean;
21
+ static myTimer: {
22
+ handle: NodeJS.Timeout | null;
23
+ started: number;
24
+ time: number;
25
+ /**
26
+ * @type Class
27
+ */
28
+ startTimer: () => void;
29
+ /**
30
+ * @type Class
31
+ */
32
+ stopTimer: () => void;
33
+ };
34
+ static init: (initialCurrentScreen: String, showDebugConsoleMessages: boolean) => void;
35
+ static interceptKeyboardEvents: (enable: boolean) => void;
36
+ static logScreenViewPageName: (name: string | undefined) => boolean;
37
+ static logScreenViewContextLoad: (name: string, prevName: string) => boolean;
38
+ static logScreenLayout: (name: string | undefined) => boolean;
39
+ static logClickEvent: (event: any) => Promise<boolean>;
40
+ static logTextChangeEvent: (target: number, controlId: string, text: string, _ariaLabel: string) => Promise<boolean>;
41
+ static logCustomEvent: (eventName: string, values: Record<string, string | number | boolean>, level: number) => Promise<boolean>;
42
+ static listenToBridge: (message: any) => void;
43
+ static checkTime: () => void;
44
+ static logTeal: () => Promise<void>;
45
+ }
46
+ export default TLTRN;
47
+ //# sourceMappingURL=TLTRN.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TLTRN.d.ts","sourceRoot":"","sources":["../../../src/TLTRN.ts"],"names":[],"mappings":"AAAA;;;;;;;;6FAQ6F;;AAiB7F,cAAM,KAAK;IACT,MAAM,CAAC,aAAa,SACgD;IACpE,MAAM,CAAC,uBAAuB,SAAK;IACnC,MAAM,CAAC,eAAe,SAAK;IAC3B,MAAM,CAAC,iBAAiB,SAAK;IAC7B,MAAM,CAAC,SAAS,SAAK;IACrB,MAAM,CAAC,cAAc,SAAK;IAC1B,MAAM,CAAC,kBAAkB,SAAK;IAC9B,MAAM,CAAC,aAAa,SAAK;IACzB,MAAM,CAAC,YAAY,UAAS;IAE5B,MAAM,CAAC,OAAO;;;;QAIZ;;WAEG;;QAKH;;WAEG;;MAQH;IAEF,MAAM,CAAC,IAAI,yBAA0B,MAAM,4BAA4B,OAAO,UAQ5E;IAEF,MAAM,CAAC,uBAAuB,WAAY,OAAO,UAE/C;IAEF,MAAM,CAAC,qBAAqB,SAAU,MAAM,GAAG,SAAS,aAQtD;IAEF,MAAM,CAAC,wBAAwB,SAAU,MAAM,YAAY,MAAM,aAQ/D;IAEF,MAAM,CAAC,eAAe,SAAU,MAAM,GAAG,SAAS,aAShD;IAEF,MAAM,CAAC,aAAa,UAAiB,GAAG,sBAwBtC;IAEF,MAAM,CAAC,kBAAkB,WAAkB,MAAM,aAAa,MAAM,QAAQ,MAAM,cAAc,MAAM,sBAYpG;IAEF,MAAM,CAAC,cAAc,cAAqB,MAAM,UAAU,OAAO,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,SAAS,MAAM,sBAQhH;IAEF,MAAM,CAAC,cAAc,YAAa,GAAG,UAiEnC;IAEF,MAAM,CAAC,SAAS,aA6Bd;IAEF,MAAM,CAAC,OAAO,sBAsBZ;CACH;AAGD,eAAe,KAAK,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Connect.d.ts","sourceRoot":"","sources":["../../../../src/components/Connect.tsx"],"names":[],"mappings":"AAAA;;;;;;;;6FAQ6F;AAC7F,OAAO,KAAyC,MAAM,OAAO,CAAC;AAK9D,UAAU,YAAY;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,qBAAqB,EAAE,OAAO,CAAC;CAClC;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAyEnC,CAAC;AAWF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"Connect.d.ts","sourceRoot":"","sources":["../../../../src/components/Connect.tsx"],"names":[],"mappings":"AAAA;;;;;;;;6FAQ6F;AAC7F,OAAO,KAAqD,MAAM,OAAO,CAAC;AAK1E,UAAU,YAAY;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,qBAAqB,EAAE,OAAO,CAAC;CAClC;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA2EnC,CAAC;AAWF,eAAe,OAAO,CAAC"}
@@ -0,0 +1,23 @@
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, { Component } from "react";
11
+ interface ConnectProfilerProps {
12
+ profileName?: string;
13
+ children?: React.ReactNode;
14
+ }
15
+ declare class ConnectProfiler extends Component<ConnectProfilerProps> {
16
+ startTime: number;
17
+ endTime: number;
18
+ constructor(props: ConnectProfilerProps);
19
+ componentDidMount(): void;
20
+ render(): React.ReactNode;
21
+ }
22
+ export default ConnectProfiler;
23
+ //# sourceMappingURL=ConnectProfiler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConnectProfiler.d.ts","sourceRoot":"","sources":["../../../../src/components/ConnectProfiler.ts"],"names":[],"mappings":"AAAA;;;;;;;;6FAQ6F;AAE7F,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,UAAU,oBAAoB;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,cAAM,eAAgB,SAAQ,SAAS,CAAC,oBAAoB,CAAC;IAC3D,SAAS,SAAK;IACd,OAAO,SAAK;gBAEA,KAAK,EAAE,oBAAoB;IAKvC,iBAAiB;IAUjB,MAAM;CAGP;AAED,eAAe,eAAe,CAAC"}
@@ -12,7 +12,9 @@
12
12
  ********************************************************************************************/
13
13
  import type { AcousticConnectRN as AcousticConnectRNSpec } from './specs/react-native-acoustic-connect.nitro';
14
14
  import Connect from './components/Connect';
15
+ import KeyboardListener from './utils/KeyboardListener';
16
+ import TLTRN from './TLTRN';
15
17
  declare const AcousticConnectRN: AcousticConnectRNSpec;
16
- export { Connect };
18
+ export { Connect, TLTRN, KeyboardListener };
17
19
  export default AcousticConnectRN;
18
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;6FAW6F;AAG7F,OAAO,KAAK,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AAC7G,OAAO,OAAO,MAAM,sBAAsB,CAAA;AAE1C,QAAA,MAAM,iBAAiB,uBAA8E,CAAA;AAErG,OAAO,EAAE,OAAO,EAAE,CAAA;AAClB,eAAe,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;6FAW6F;AAG7F,OAAO,KAAK,EAAE,iBAAiB,IAAI,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AAC7G,OAAO,OAAO,MAAM,sBAAsB,CAAA;AAC1C,OAAO,gBAAgB,MAAM,0BAA0B,CAAA;AACvD,OAAO,KAAK,MAAM,SAAS,CAAA;AAE3B,QAAA,MAAM,iBAAiB,uBAA8E,CAAA;AAErG,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAC,CAAA;AAC1C,eAAe,iBAAiB,CAAA"}
@@ -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
- class ConnectProfiler extends Component {
16
- startTime = 0
17
- endTime = 0
18
-
19
- constructor(props){
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
- export default ConnectProfiler;
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.12",
195
+ "version": "18.0.14",
197
196
  "workspaces": [
198
197
  "example"
199
198
  ]
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "Connect": {
3
- "AndroidVersion": "10.4.37",
3
+ "AndroidVersion": "10.4.59",
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",
@@ -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 'react-native-acoustic-connect-beta';
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 = 0;
36
+ static displayDebug = false;
35
37
 
36
38
  static myTimer = {
37
- handle: 0,
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 = 0;
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
- return AcousticConnectRN.setCurrentScreenName(name);
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
- return AcousticConnectRN.logScreenViewContextLoad(name, prevName);
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
- return AcousticConnectRN.logScreenLayout(name, 0);
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
- if(!event.target._nativeTag || typeof event.target._nativeTag === 'undefined'){ return false; }
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 (node.memoizedProps && node.memoizedProps.id)
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
- return AcousticConnectRN.logClickEvent(target, controlId);
122
+ result = AcousticConnectRN.logClickEvent(target, controlId);
113
123
  } else if (Platform.OS === 'android') {
114
- return AcousticConnectRN.logClickEvent(target, controlId);
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, ariaLabel) => {
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
- await AcousticConnectRN.logTextChangeEvent(target, controlId, text);
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
- return await AcousticConnectRN.logCustomEvent(eventName, values, level);
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) {
@@ -7,10 +7,10 @@
7
7
  * Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
8
8
  * prohibited.
9
9
  ********************************************************************************************/
10
- import React, { useCallback, useEffect, useRef } from "react";
10
+ import React, { useCallback, useEffect, useRef, forwardRef } from "react";
11
11
  import { View, StyleSheet, Platform, NativeModules, findNodeHandle } from "react-native";
12
12
  import type { LayoutChangeEvent } from "react-native"; // Use type-only import for LayoutChangeEvent
13
- // import TLTRN from '../TLTRN';
13
+ import TLTRN from '../TLTRN';
14
14
 
15
15
  interface ConnectProps {
16
16
  children: React.ReactNode;
@@ -23,7 +23,7 @@ const Connect: React.FC<ConnectProps> = ({ children, captureKeyboardEvents }) =>
23
23
  const initial = useRef<boolean>(false);
24
24
 
25
25
  useEffect(() => {
26
- // TLTRN.interceptKeyboardEvents(captureKeyboardEvents);
26
+ TLTRN.interceptKeyboardEvents(captureKeyboardEvents);
27
27
  }, [captureKeyboardEvents]);
28
28
 
29
29
  useEffect(() => {
@@ -38,29 +38,31 @@ const Connect: React.FC<ConnectProps> = ({ children, captureKeyboardEvents }) =>
38
38
  return;
39
39
  }
40
40
 
41
- const unsubscribe = navigation.current.addListener("state", () => {
41
+ // Listen for the 'state' event to track navigation state changes
42
+ const unsubscribeState = navigation.current.addListener("state", () => {
42
43
  currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
43
44
  console.log("State change - ", currentRoute.current);
44
-
45
+
45
46
  if (Platform.OS === "ios" && currentRoute && currentRoute.current) {
46
- // TLTRN.setCurrentScreenName(currentRoute.current);
47
+ TLTRN.logScreenViewPageName(currentRoute.current);
47
48
  } else if (Platform.OS === "android") {
48
- // TLTRN.setCurrentScreenName(currentRoute.current);
49
- // TLTRN.logScreenLayout(currentRoute.current);
49
+ TLTRN.logScreenViewPageName(currentRoute.current);
50
+ TLTRN.logScreenLayout(currentRoute.current);
50
51
  }
51
52
  });
52
53
 
53
- return unsubscribe;
54
+ // Cleanup listeners when the component unmounts or dependencies change
55
+ return () => {
56
+ unsubscribeState();
57
+ };
54
58
  }, [navigation]);
55
59
 
56
60
  const onStartShouldSetResponderCapture = useCallback((event: any) => {
57
61
  currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
58
62
  if (currentRoute && currentRoute.current) {
59
- // TLTRN.setCurrentScreenName(currentRoute.current);
63
+ TLTRN.logScreenViewPageName(currentRoute.current);
60
64
  }
61
- // Log the click event
62
- console.log("event - ", event.nativeEvent);
63
- // TLTRN.logClickEvent(event);
65
+ TLTRN.logClickEvent(event);
64
66
  return false; // Must be false; true means this component becomes the touch responder and events don't bubble
65
67
  }, []);
66
68
 
@@ -74,9 +76,9 @@ const Connect: React.FC<ConnectProps> = ({ children, captureKeyboardEvents }) =>
74
76
 
75
77
  currentRoute.current = navigation.current.getCurrentRoute()?.name;
76
78
  if (Platform.OS === "ios" && currentRoute && currentRoute.current) {
77
- // TLTRN.setCurrentScreenName(currentRoute.current);
79
+ TLTRN.logScreenViewPageName(currentRoute.current);
78
80
  } else if (Platform.OS === "android") {
79
- // TLTRN.logScreenLayout(currentRoute.current);
81
+ TLTRN.logScreenLayout(currentRoute.current);
80
82
  }
81
83
  return true
82
84
  }, [navigation]);
@@ -96,7 +98,7 @@ function extractName(navigation: any): string {
96
98
  const routeParams = navigation.current.getCurrentRoute()?.params;
97
99
  if (routeParams) {
98
100
  const { name } = routeParams;
99
- return name || "";
101
+ return name ? name : navigation.current?.getCurrentRoute()?.name || "";
100
102
  }
101
103
  return "";
102
104
  }
@@ -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
- import Connect from './components/Connect' // Import Connect.tsx
16
+ import Connect from './components/Connect'
17
+ import KeyboardListener from './utils/KeyboardListener'
18
+ import TLTRN from './TLTRN'
17
19
 
18
20
  const AcousticConnectRN = NitroModules.createHybridObject<AcousticConnectRNSpec>('AcousticConnectRN')
19
21
 
20
- export { Connect } // Export Connect.tsx
22
+ export { Connect, TLTRN, KeyboardListener}
21
23
  export default AcousticConnectRN
@@ -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;