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.
Files changed (70) hide show
  1. package/Examples/SampleUI/ConnectConfig.json +180 -0
  2. package/Examples/SampleUI/android/app/build.gradle +2 -0
  3. package/Examples/SampleUI/android/app/src/main/AndroidManifest.xml +18 -13
  4. package/Examples/SampleUI/android/app/src/main/java/com/sampleui/MainActivity.kt +47 -5
  5. package/Examples/SampleUI/ios/SampleUI.xcodeproj/xcshareddata/xcschemes/SampleUI.xcscheme +17 -0
  6. package/Examples/SampleUI/metro.config.js +2 -1
  7. package/Examples/SampleUI/package.json +3 -2
  8. package/Examples/SampleUI/src/RootNavigator.tsx +10 -1
  9. package/Examples/SampleUI/src/index.native.tsx +46 -31
  10. package/README.md +4 -0
  11. package/android/src/main/assets/ConnectAdvancedConfig.json +1 -1
  12. package/android/src/main/assets/TealeafAdvancedConfig.json +1 -1
  13. package/lib/commonjs/TLTRN.js +219 -0
  14. package/lib/commonjs/TLTRN.js.map +1 -0
  15. package/lib/commonjs/components/Connect.js +105 -0
  16. package/lib/commonjs/components/Connect.js.map +1 -0
  17. package/lib/commonjs/components/ConnectProfiler.js +45 -0
  18. package/lib/commonjs/components/ConnectProfiler.js.map +1 -0
  19. package/lib/commonjs/index.js +22 -2
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/commonjs/utils/KeyboardListener.js +110 -0
  22. package/lib/commonjs/utils/KeyboardListener.js.map +1 -0
  23. package/lib/module/TLTRN.js +214 -0
  24. package/lib/module/TLTRN.js.map +1 -0
  25. package/lib/module/components/Connect.js +98 -0
  26. package/lib/module/components/Connect.js.map +1 -0
  27. package/lib/module/components/ConnectProfiler.js +40 -0
  28. package/lib/module/components/ConnectProfiler.js.map +1 -0
  29. package/lib/module/index.js +4 -2
  30. package/lib/module/index.js.map +1 -1
  31. package/lib/module/utils/KeyboardListener.js +105 -0
  32. package/lib/module/utils/KeyboardListener.js.map +1 -0
  33. package/lib/typescript/src/TLTRN.d.ts +47 -0
  34. package/lib/typescript/src/TLTRN.d.ts.map +1 -0
  35. package/lib/typescript/src/components/Connect.d.ts +18 -0
  36. package/lib/typescript/src/components/Connect.d.ts.map +1 -0
  37. package/lib/typescript/src/components/ConnectProfiler.d.ts +23 -0
  38. package/lib/typescript/src/components/ConnectProfiler.d.ts.map +1 -0
  39. package/lib/typescript/src/index.d.ts +4 -0
  40. package/lib/typescript/src/index.d.ts.map +1 -1
  41. package/lib/typescript/src/specs/react-native-acoustic-connect.nitro.d.ts.map +1 -1
  42. package/{jslib/components/ConnectProfiler.js → lib/typescript/src/utils/KeyboardListener.d.ts} +9 -29
  43. package/lib/typescript/src/utils/KeyboardListener.d.ts.map +1 -0
  44. package/package.json +1 -2
  45. package/scripts/ConnectConfig.json +1 -1
  46. package/scripts/javaParser.js +1 -1
  47. package/{jslib/TLTRN.js → src/TLTRN.ts} +54 -39
  48. package/src/components/Connect.tsx +126 -0
  49. package/src/components/ConnectProfiler.ts +43 -0
  50. package/src/index.ts +5 -3
  51. package/src/specs/react-native-acoustic-connect.nitro.ts +1 -15
  52. package/src/utils/KeyboardListener.ts +113 -0
  53. package/Examples/SampleUI/package-lock.json +0 -17033
  54. package/jslib/components/Connect.js +0 -85
  55. package/jslib/utils/KeyboardListener.js +0 -100
  56. package/lib/commonjs/types.js +0 -24
  57. package/lib/commonjs/types.js.map +0 -1
  58. package/lib/module/types.js +0 -24
  59. package/lib/module/types.js.map +0 -1
  60. package/lib/typescript/jslib/TLTRN.d.ts +0 -37
  61. package/lib/typescript/jslib/TLTRN.d.ts.map +0 -1
  62. package/lib/typescript/jslib/components/Connect.d.ts +0 -4
  63. package/lib/typescript/jslib/components/Connect.d.ts.map +0 -1
  64. package/lib/typescript/jslib/components/ConnectProfiler.d.ts +0 -10
  65. package/lib/typescript/jslib/components/ConnectProfiler.d.ts.map +0 -1
  66. package/lib/typescript/jslib/utils/KeyboardListener.d.ts +0 -10
  67. package/lib/typescript/jslib/utils/KeyboardListener.d.ts.map +0 -1
  68. package/lib/typescript/src/types.d.ts +0 -1
  69. package/lib/typescript/src/types.d.ts.map +0 -1
  70. package/src/types.ts +0 -23
@@ -1,85 +0,0 @@
1
- /********************************************************************************************
2
- * Copyright (C) 2024 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} from "react";
11
- import { View, StyleSheet, Platform, NativeModules, findNodeHandle } from "react-native";
12
- import TLTRN from '../TLTRN';
13
-
14
- const Connect = (props) => {
15
- const { children, captureKeyboardEvents } = props;
16
- const navigation = children.ref;
17
- const currentRoute = useRef();
18
- const initial = useRef(false);
19
-
20
- useEffect(() => { TLTRN.interceptKeyboardEvents(captureKeyboardEvents); }, [captureKeyboardEvents]);
21
-
22
- useEffect(() => {
23
- if(!navigation || typeof navigation.current.addListener !== 'function' || typeof navigation.current.getCurrentRoute !== 'function'){
24
- console.warn('Connect: The Connect components first child must be a NavigationContainer with a ref.');
25
- return;
26
- }
27
-
28
- const unsubscribe = navigation.current.addListener('state', () => {
29
- currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute().name;
30
- console.log('State change - ', currentRoute.current);
31
-
32
- if (Platform.OS === 'ios' && currentRoute && currentRoute.current) {
33
- TLTRN.setCurrentScreenName(currentRoute.current);
34
- } else if (Platform.OS === 'android') {
35
- TLTRN.setCurrentScreenName(currentRoute.current);
36
- TLTRN.logScreenLayout(currentRoute.current);
37
- }
38
- });
39
-
40
- return unsubscribe;
41
- }, [navigation]);
42
-
43
- const onStartShouldSetResponderCapture = useCallback((event) => {
44
- currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute().name;
45
- if (currentRoute && currentRoute.current) {
46
- TLTRN.setCurrentScreenName(currentRoute.current);
47
- }
48
- TLTRN.logClickEvent(event);
49
- return false; // Must be false; true means this component becomes the touch responder and events dont bubble
50
- }, []);
51
-
52
- const onLayout = useCallback(() => {
53
- if(initial.current){ return false; }
54
- initial.current = true;
55
-
56
- currentRoute.current = navigation.current.getCurrentRoute().name;
57
- if (Platform.OS === 'ios' && currentRoute && currentRoute.current) {
58
- TLTRN.setCurrentScreenName(currentRoute.current);
59
- } else if (Platform.OS === 'android') {
60
- TLTRN.logScreenLayout(currentRoute.current);
61
- }
62
- }, [navigation]);
63
-
64
- return (
65
- <View style={styles.connect_main}
66
- onLayout={onLayout}
67
- onStartShouldSetResponderCapture={onStartShouldSetResponderCapture}>
68
- {children}
69
- </View>
70
- );
71
- };
72
- function extractName(navigation){
73
- if(navigation.current.getCurrentRoute().params){
74
- const { name } = navigation.current.getCurrentRoute().params
75
- return name
76
- }
77
- return ""
78
- }
79
- export default Connect;
80
-
81
- const styles = StyleSheet.create({
82
- connect_main: {
83
- flex: 1
84
- }
85
- })
@@ -1,100 +0,0 @@
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
-
13
- class KeyboardListener{
14
- static TLTRN = null;
15
- static listener = null;
16
-
17
- static _instance(_TLTRN){
18
- if(!KeyboardListener.listener){ KeyboardListener.listener = new KeyboardListener(_TLTRN); }
19
- return KeyboardListener.listener;
20
- }
21
-
22
- constructor(_TLTRN) {
23
- KeyboardListener.TLTRN = _TLTRN;
24
-
25
- this.enabled = false;
26
- let _x = {};
27
- let _i = {};
28
-
29
- const sanitize = (target, text) => {
30
- if(!_x[target].secureTextEntry || typeof _x[target].secureTextEntry === 'undefined'){ return text; }
31
- return new Array(text.length).fill('*').join('');
32
- };
33
- const flushData = () => {
34
- _i = {};
35
- _x = {};
36
- };
37
- const keyListener = (evt, bubbledEvent) => {
38
- let _nativeTag = evt?.target?._nativeTag;
39
-
40
- let valid = this.enabled && (!_i[_nativeTag] || _i[_nativeTag] === bubbledEvent);
41
- if(!valid){ return false; }
42
-
43
- // console.log('parent keyListener evt', evt);
44
- // console.log('parent keyListener evt?._targetInst?.secureTextEntry', evt?._targetInst?.memoizedProps?.secureTextEntry);
45
-
46
- _i[_nativeTag] = bubbledEvent;
47
- if(!_x[_nativeTag]){ _x[_nativeTag] = { text: '' }; }
48
-
49
- _x[_nativeTag].target = evt?.target?._nativeTag;
50
- _x[_nativeTag].controlId = evt?._targetInst?.memoizedProps?.id;
51
- _x[_nativeTag].ariaLabel = evt?._targetInst?.memoizedProps?.accessible?.accessibilityLabel;
52
- _x[_nativeTag].secureTextEntry = evt?._targetInst?.memoizedProps?.secureTextEntry;
53
-
54
- let anon = _k => {
55
- if(_k !== 'Backspace' && _k.length === 1){ return _x[_nativeTag].text += sanitize(_nativeTag, _k); }
56
- else if(_k !== 'Backspace' && _k.length > 1){ return sanitize(_nativeTag, _k); }
57
- else { return _x[_nativeTag].text.slice(0, -1); }
58
- };
59
- let text = null;
60
- switch(bubbledEvent){
61
- case 'onTextInput':
62
- text = evt?.nativeEvent?.text;
63
- if(_k !== 'Backspace' && _k.length === 1){ _x[_nativeTag] = _x[_nativeTag].text += sanitize(_nativeTag, _k); }
64
- else if(_k !== 'Backspace' && _k.length > 1){ _x[_nativeTag].text = sanitize(_nativeTag, _k); }
65
- else { _x[_nativeTag].text = _x[_nativeTag].text.slice(0, -1); }
66
-
67
- break;
68
- case 'onKeyPress':
69
- text = evt?.nativeEvent?.key;
70
- _x[_nativeTag].text = anon(text);
71
- break;
72
- case 'onChange':
73
- text = evt?.nativeEvent?.text;
74
- _x[_nativeTag].text = sanitize(_nativeTag, text);
75
- break;
76
- }
77
- };
78
-
79
- const keyboardDidHide = async () => {
80
- let values = Object.values(_x);
81
- for (let value of values) {
82
- let {text, controlId, ariaLabel, target} = value;
83
- await KeyboardListener.TLTRN.logTextChangeEvent(target, controlId, text, ariaLabel);
84
- }
85
- flushData();
86
- };
87
-
88
- TextInput.defaultProps = TextInput.defaultProps || {};
89
-
90
- // Shotgun approach; if any of these listeners are set on the component the event doesn't bubble up
91
- // TextInput.defaultProps.onKeyPress = evt => keyListener(evt, 'onKeyPress');
92
- TextInput.defaultProps.onChange = evt => keyListener(evt, 'onChange');
93
- // TextInput.defaultProps.onTextInput = evt => keyListener(evt, 'onTextInput');
94
-
95
- Keyboard.addListener('keyboardDidHide', keyboardDidHide);
96
- }
97
- interceptKeyboardEvents(enable){ this.enabled = enable; }
98
- }
99
-
100
- export default KeyboardListener;
@@ -1,24 +0,0 @@
1
- // Copyright (C) 2024 Acoustic, L.P. All rights reserved.
2
- //
3
- // NOTICE: This file contains material that is confidential and proprietary to
4
- // Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
5
- // industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
6
- // Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
7
- // prohibited.
8
- //
9
- //
10
- // Created by Omar Hernandez on 5/9/25.
11
- //
12
-
13
- // export type ConnectionType = 'unknown' | 'ethernet' | 'wifi' | 'cellular'
14
-
15
- // export type AcousticConnectStatusInfoRNBeta = {
16
- // isConnected: boolean
17
- // connectionType: ConnectionType
18
- // }
19
-
20
- // export type NetworkInfoListener = (networkInfo: AcousticConnectStatusInfoRNBeta) => void
21
-
22
- // export type ConnectionType = 'Ignore' | 'CellularAndWiFi' | 'WiFi'
23
- "use strict";
24
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAGA;;AAEA;AAAA","ignoreList":[]}
@@ -1,24 +0,0 @@
1
- // Copyright (C) 2024 Acoustic, L.P. All rights reserved.
2
- //
3
- // NOTICE: This file contains material that is confidential and proprietary to
4
- // Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
5
- // industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
6
- // Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
7
- // prohibited.
8
- //
9
- //
10
- // Created by Omar Hernandez on 5/9/25.
11
- //
12
-
13
- // export type ConnectionType = 'unknown' | 'ethernet' | 'wifi' | 'cellular'
14
-
15
- // export type AcousticConnectStatusInfoRNBeta = {
16
- // isConnected: boolean
17
- // connectionType: ConnectionType
18
- // }
19
-
20
- // export type NetworkInfoListener = (networkInfo: AcousticConnectStatusInfoRNBeta) => void
21
-
22
- // export type ConnectionType = 'Ignore' | 'CellularAndWiFi' | 'WiFi'
23
- "use strict";
24
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAGA;;AAEA;AAAA","ignoreList":[]}
@@ -1,37 +0,0 @@
1
- export default TLTRN;
2
- declare class TLTRN {
3
- static currentScreen: string;
4
- static lastJSBridgeMessageTime: number;
5
- static totalRenderTime: number;
6
- static messageRenderTime: number;
7
- static countMsgs: number;
8
- static messageConsole: number;
9
- static lastMessageConsole: number;
10
- static isLoggingData: number;
11
- static displayDebug: number;
12
- static myTimer: {
13
- handle: number;
14
- started: number;
15
- time: number;
16
- /**
17
- * @type Class
18
- */
19
- startTimer: Class;
20
- /**
21
- * @type Class
22
- */
23
- stopTimer: Class;
24
- };
25
- static init: (initialCurrentScreen: any, showDebugConsoleMessages: any) => void;
26
- static interceptKeyboardEvents: (enable: any) => void;
27
- static logScreenViewPageName: (name: any) => boolean | undefined;
28
- static logScreenViewContextLoad: (name: any, prevName: any) => boolean | undefined;
29
- static logScreenLayout: (name: any) => boolean | undefined;
30
- static logClickEvent: (event: any) => Promise<boolean | undefined>;
31
- static logTextChangeEvent: (target: any, controlId: any, text: any, ariaLabel: any) => Promise<void>;
32
- static logCustomEvent: (eventName: any, values: any, level: any) => Promise<boolean | undefined>;
33
- static listenToBridge: (message: any) => void;
34
- static checkTime: () => void;
35
- static logTeal: () => Promise<void>;
36
- }
37
- //# sourceMappingURL=TLTRN.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TLTRN.d.ts","sourceRoot":"","sources":["../../../jslib/TLTRN.js"],"names":[],"mappings":";AAuBA;IACE,6BACoE;IACpE,uCAAmC;IACnC,+BAA2B;IAC3B,iCAA6B;IAC7B,yBAAqB;IACrB,8BAA0B;IAC1B,kCAA8B;IAC9B,6BAAyB;IACzB,4BAAwB;IAExB;;;;QAIE;;WAEG;;QAKH;;WAEG;;MAQH;IAEF,gFAQE;IAEF,sDAEE;IAEF,iEAME;IAEF,mFAME;IAEF,2DAOE;IAEF,mEAqBE;IAEF,qGAUE;IAEF,iGAME;IAEF,8CAiEE;IAEF,6BA6BE;IAEF,oCAsBE;CACH"}
@@ -1,4 +0,0 @@
1
- export default Connect;
2
- declare function Connect(props: any): React.JSX.Element;
3
- import React from "react";
4
- //# sourceMappingURL=Connect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Connect.d.ts","sourceRoot":"","sources":["../../../../jslib/components/Connect.js"],"names":[],"mappings":";AAaA,wDAyDC;kBA7DmD,OAAO"}
@@ -1,10 +0,0 @@
1
- export default ConnectProfiler;
2
- declare class ConnectProfiler extends React.Component<any, any, any> {
3
- constructor(props: any);
4
- startTime: number;
5
- endTime: number;
6
- componentDidMount(): void;
7
- render(): any;
8
- }
9
- import React from "react";
10
- //# sourceMappingURL=ConnectProfiler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ConnectProfiler.d.ts","sourceRoot":"","sources":["../../../../jslib/components/ConnectProfiler.js"],"names":[],"mappings":";AAcA;IAIE,wBAIC;IAPD,kBAAa;IACb,gBAAW;IAQX,0BAQC;IAED,cAEC;CACF;kBA3B8B,OAAO"}
@@ -1,10 +0,0 @@
1
- export default KeyboardListener;
2
- declare class KeyboardListener {
3
- static TLTRN: null;
4
- static listener: null;
5
- static _instance(_TLTRN: any): null;
6
- constructor(_TLTRN: any);
7
- enabled: boolean;
8
- interceptKeyboardEvents(enable: any): void;
9
- }
10
- //# sourceMappingURL=KeyboardListener.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"KeyboardListener.d.ts","sourceRoot":"","sources":["../../../../jslib/utils/KeyboardListener.js"],"names":[],"mappings":";AAYA;IACI,mBAAoB;IACpB,sBAAuB;IAEvB,oCAGC;IAED,yBA0EC;IAvEG,iBAAoB;IAwExB,2CAAyD;CAC5D"}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":""}
package/src/types.ts DELETED
@@ -1,23 +0,0 @@
1
- // Copyright (C) 2024 Acoustic, L.P. All rights reserved.
2
- //
3
- // NOTICE: This file contains material that is confidential and proprietary to
4
- // Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
5
- // industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
6
- // Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
7
- // prohibited.
8
- //
9
- //
10
- // Created by Omar Hernandez on 5/9/25.
11
- //
12
-
13
- // export type ConnectionType = 'unknown' | 'ethernet' | 'wifi' | 'cellular'
14
-
15
- // export type AcousticConnectStatusInfoRNBeta = {
16
- // isConnected: boolean
17
- // connectionType: ConnectionType
18
- // }
19
-
20
-
21
- // export type NetworkInfoListener = (networkInfo: AcousticConnectStatusInfoRNBeta) => void
22
-
23
- // export type ConnectionType = 'Ignore' | 'CellularAndWiFi' | 'WiFi'