react-native-acoustic-connect-beta 18.0.19 → 18.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/config.gradle +71 -4
- package/android/src/main/assets/ConnectAdvancedConfig.json +1 -1
- package/android/src/main/assets/ConnectBasicConfig.properties +35 -0
- package/android/src/main/assets/TealeafAdvancedConfig.json +1 -1
- package/ios/HybridAcousticConnectRN.swift +38 -21
- package/lib/commonjs/components/Connect.js +32 -18
- package/lib/commonjs/components/Connect.js.map +1 -1
- package/lib/module/components/Connect.js +32 -18
- package/lib/module/components/Connect.js.map +1 -1
- package/lib/typescript/src/components/Connect.d.ts +12 -0
- package/lib/typescript/src/components/Connect.d.ts.map +1 -1
- package/package.json +1 -1
- package/scripts/ConnectConfig.json +1 -1
- package/src/components/Connect.tsx +55 -21
package/android/config.gradle
CHANGED
|
@@ -85,6 +85,71 @@ def updateTealeafBasicConfig(mp, json) {
|
|
|
85
85
|
println("Updating:$propertiesFile")
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
def updateConnectBasicConfig(mp, json) {
|
|
89
|
+
def propertiesFile = "$mp/src/main/assets/ConnectBasicConfig.properties"
|
|
90
|
+
FileInputStream _file = new FileInputStream(propertiesFile);
|
|
91
|
+
Properties properties = new Properties();
|
|
92
|
+
properties.load(_file);
|
|
93
|
+
_file.close();
|
|
94
|
+
|
|
95
|
+
FileOutputStream out = new FileOutputStream(propertiesFile);
|
|
96
|
+
|
|
97
|
+
json.each { key, value ->
|
|
98
|
+
if(key != "Connect"){ return }
|
|
99
|
+
|
|
100
|
+
println("Update/Add the following key/values:")
|
|
101
|
+
value.each { config_key, config_value ->
|
|
102
|
+
if(config_value.getClass() != java.lang.String
|
|
103
|
+
&& config_value.getClass() != java.lang.Boolean
|
|
104
|
+
&& config_value.getClass() != java.lang.Integer){
|
|
105
|
+
return
|
|
106
|
+
}
|
|
107
|
+
// Just update the following items
|
|
108
|
+
if (config_key == "AppKey" ||
|
|
109
|
+
config_key == "PostMessageUrl" ||
|
|
110
|
+
config_key == "KillSwitchUrl" ||
|
|
111
|
+
config_key == "KillSwitchEnabled" ||
|
|
112
|
+
config_key == "KillSwitchMaxNumberOfTries" ||
|
|
113
|
+
config_key == "KillSwitchTimeInterval" ||
|
|
114
|
+
config_key == "UseWhiteList" ||
|
|
115
|
+
config_key == "WhiteListParam" ||
|
|
116
|
+
config_key == "UseRandomSample" ||
|
|
117
|
+
config_key == "RandomSampleParam" ||
|
|
118
|
+
config_key == "PrintScreen" ||
|
|
119
|
+
config_key == "Connection" ||
|
|
120
|
+
config_key == "MaxStringsLength" ||
|
|
121
|
+
config_key == "CookieUrl" ||
|
|
122
|
+
config_key == "CookieParam" ||
|
|
123
|
+
config_key == "CookiePath" ||
|
|
124
|
+
config_key == "CookieDomain" ||
|
|
125
|
+
config_key == "CookieExpires" ||
|
|
126
|
+
config_key == "CookieSecure" ||
|
|
127
|
+
config_key == "CookieExpiresFormat" ||
|
|
128
|
+
config_key == "SessionTimeout" ||
|
|
129
|
+
config_key == "SessionTimeoutKillSwitch" ||
|
|
130
|
+
config_key == "disableTLTDID" ||
|
|
131
|
+
config_key == "ScreenshotFormat" ||
|
|
132
|
+
config_key == "PercentOfScreenshotsSize" ||
|
|
133
|
+
config_key == "PercentToCompressImage" ||
|
|
134
|
+
config_key == "ScreenShotPixelDensity" ||
|
|
135
|
+
config_key == "LogViewLayoutOnScreenTransition" ||
|
|
136
|
+
config_key == "GetImageDataOnScreenLayout" ||
|
|
137
|
+
config_key == "SetGestureDetector" ||
|
|
138
|
+
config_key == "CaptureNativeGesturesOnWebview" ||
|
|
139
|
+
config_key == "LogLocationEnabled" ||
|
|
140
|
+
config_key == "LogLocationTries" ||
|
|
141
|
+
config_key == "LogLocationTimeout" ) {
|
|
142
|
+
println(config_key + "=" + config_value)
|
|
143
|
+
properties.setProperty(config_key, config_value.toString())
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
properties.store(out, null);
|
|
149
|
+
out.close();
|
|
150
|
+
println("Updating:$propertiesFile")
|
|
151
|
+
}
|
|
152
|
+
|
|
88
153
|
def updateLayoutConfig(mp, json){
|
|
89
154
|
def layoutConfigPath = "$mp/src/main/assets/TealeafLayoutConfig.json"
|
|
90
155
|
def layoutConfigDefaultPath = "$mp/src/main/assets/TealeafLayoutConfigDefault.json"
|
|
@@ -299,14 +364,16 @@ try {
|
|
|
299
364
|
println("Step 2:")
|
|
300
365
|
updateTealeafBasicConfig(module_path, configJSONData)
|
|
301
366
|
println("Step 3:")
|
|
302
|
-
|
|
367
|
+
updateConnectBasicConfig(module_path, configJSONData)
|
|
303
368
|
println("Step 4:")
|
|
304
|
-
|
|
369
|
+
updateLayoutConfig(module_path, configJSONData)
|
|
305
370
|
println("Step 5:")
|
|
306
|
-
|
|
371
|
+
updateTealeafAdvConfig(module_path, configJSONData)
|
|
307
372
|
println("Step 6:")
|
|
308
|
-
|
|
373
|
+
updateEOCoreBasicConfig(module_path, configJSONData)
|
|
309
374
|
println("Step 7:")
|
|
375
|
+
updateEOCoreAdvConfig(module_path, configJSONData)
|
|
376
|
+
println("Step 8:")
|
|
310
377
|
updateGradle(module_path, configJSONData)
|
|
311
378
|
println("*********************************************************************************************")
|
|
312
379
|
} catch (FileNotFoundException e) {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"IpPlaceholder": "N/A",
|
|
25
25
|
"KillSwitchAsync": true,
|
|
26
26
|
"KillSwitchDelay": 300,
|
|
27
|
-
"LibraryVersion": "11.0.
|
|
27
|
+
"LibraryVersion": "11.0.9-beta",
|
|
28
28
|
"LogFullRequestResponsePayloads": true,
|
|
29
29
|
"MessageTypeHeader": "WorklightHit",
|
|
30
30
|
"MessageTypes": "4,5",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#Fri Apr 24 05:22:50 PDT 2026
|
|
2
|
+
UseWhiteList=true
|
|
3
|
+
PrintScreen=3
|
|
4
|
+
UseRandomSample=false
|
|
5
|
+
CookieDomain=.straussandplesser.com
|
|
6
|
+
PostMessageUrl=https\://lib-us-2.brilliantcollector.com/collector/collectorPost
|
|
7
|
+
SessionTimeout=30
|
|
8
|
+
PercentToCompressImage=80
|
|
9
|
+
CookieExpires=false
|
|
10
|
+
AppKey=b6c3709b7a4c479bb4b5a9fb8fec324c
|
|
11
|
+
KillSwitchEnabled=false
|
|
12
|
+
ScreenShotPixelDensity=1.5
|
|
13
|
+
CookieExpiresFormat=ASCTIME
|
|
14
|
+
RandomSampleParam=
|
|
15
|
+
SessionTimeoutKillSwitch=false
|
|
16
|
+
PercentOfScreenshotsSize=40
|
|
17
|
+
SetGestureDetector=true
|
|
18
|
+
disableTLTDID=false
|
|
19
|
+
GetImageDataOnScreenLayout=false
|
|
20
|
+
CookieUrl=http\://m.straussandplesser.com
|
|
21
|
+
ScreenshotFormat=JPG
|
|
22
|
+
Connection=3
|
|
23
|
+
CookiePath=/
|
|
24
|
+
KillSwitchUrl=https\://lib-us-2.brilliantcollector.com/collector/switch/b6c3709b7a4c479bb4b5a9fb8fec324c
|
|
25
|
+
LogLocationEnabled=true
|
|
26
|
+
LogLocationTimeout=30
|
|
27
|
+
KillSwitchTimeInterval=5
|
|
28
|
+
MaxStringsLength=300
|
|
29
|
+
CookieParam=TLTSID
|
|
30
|
+
CookieSecure=true
|
|
31
|
+
LogViewLayoutOnScreenTransition=true
|
|
32
|
+
KillSwitchMaxNumberOfTries=3
|
|
33
|
+
WhiteListParam=id
|
|
34
|
+
CaptureNativeGesturesOnWebview=false
|
|
35
|
+
LogLocationTries=3
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"IpPlaceholder": "N/A",
|
|
25
25
|
"KillSwitchAsync": true,
|
|
26
26
|
"KillSwitchDelay": 300,
|
|
27
|
-
"LibraryVersion": "10.4.
|
|
27
|
+
"LibraryVersion": "10.4.28-beta",
|
|
28
28
|
"LogFullRequestResponsePayloads": true,
|
|
29
29
|
"MessageTypeHeader": "WorklightHit",
|
|
30
30
|
"MessageTypes": "4,5",
|
|
@@ -12,10 +12,35 @@
|
|
|
12
12
|
|
|
13
13
|
import Foundation
|
|
14
14
|
import Connect
|
|
15
|
-
import EOCore
|
|
16
|
-
import Tealeaf
|
|
17
15
|
import NitroModules
|
|
18
16
|
|
|
17
|
+
// Single compat entry point for the config-item store. Works against every
|
|
18
|
+
// shipping iOS SDK variant (Release with separate EOCore/Tealeaf, current merged
|
|
19
|
+
// Debug 2.1.2, future merged-only) because `ConnectApplicationHelper` ships with
|
|
20
|
+
// each of them. Not importing `EOCore`/`Tealeaf` avoids a link dependency on
|
|
21
|
+
// frameworks that aren't always packaged into the app bundle.
|
|
22
|
+
private enum ConnectConfigStore {
|
|
23
|
+
@discardableResult
|
|
24
|
+
static func set(_ key: String, value: Any) -> Bool {
|
|
25
|
+
return ConnectApplicationHelper.sharedInstance().setConfigurableItem(key, value: value)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static func bool(forKey key: String, default def: Bool) -> Bool {
|
|
29
|
+
let raw = ConnectApplicationHelper.sharedInstance().value(forConfigurableItem: key)
|
|
30
|
+
if let n = raw as? NSNumber { return n.boolValue }
|
|
31
|
+
if let s = raw as? String { return (s as NSString).boolValue }
|
|
32
|
+
return def
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static func string(forKey key: String, default def: String) -> String? {
|
|
36
|
+
return (ConnectApplicationHelper.sharedInstance().value(forConfigurableItem: key) as? String) ?? def
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static func number(forKey key: String, default def: Double) -> Double {
|
|
40
|
+
return (ConnectApplicationHelper.sharedInstance().value(forConfigurableItem: key) as? NSNumber)?.doubleValue ?? def
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
19
44
|
class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
20
45
|
|
|
21
46
|
// Constructor
|
|
@@ -92,17 +117,15 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
92
117
|
if let jsonData = jsonData,
|
|
93
118
|
let connectData = jsonData["Connect"] as? [String: Any] {
|
|
94
119
|
for (key, value) in connectData {
|
|
95
|
-
if tealeafKeys.contains(key) {
|
|
96
|
-
|
|
97
|
-
} else if eocoreKeys.contains(key) {
|
|
98
|
-
EOApplicationHelper.sharedInstance().setConfigItem(key, value: value, forModuleName: kEOCoreModule)
|
|
120
|
+
if tealeafKeys.contains(key) || eocoreKeys.contains(key) {
|
|
121
|
+
ConnectConfigStore.set(key, value: value)
|
|
99
122
|
} else if key == "layoutConfig",
|
|
100
123
|
let layoutConfig = value as? [String: Any] {
|
|
101
124
|
if let autoLayout = layoutConfig["AutoLayout"] {
|
|
102
|
-
|
|
125
|
+
ConnectConfigStore.set("AutoLayout", value: autoLayout)
|
|
103
126
|
}
|
|
104
127
|
if let appendMapIds = layoutConfig["AppendMapIds"] {
|
|
105
|
-
|
|
128
|
+
ConnectConfigStore.set("AppendMapIds", value: appendMapIds)
|
|
106
129
|
}
|
|
107
130
|
}
|
|
108
131
|
}
|
|
@@ -116,8 +139,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
116
139
|
/// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
|
|
117
140
|
/// - Returns: Whether it was able to set the value as Boolean value.
|
|
118
141
|
func setBooleanConfigItemForKey(key: String, value: Bool, moduleName: String) throws -> Bool {
|
|
119
|
-
|
|
120
|
-
return result
|
|
142
|
+
return ConnectConfigStore.set(key, value: value)
|
|
121
143
|
}
|
|
122
144
|
|
|
123
145
|
/// Sets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a NString value.
|
|
@@ -127,8 +149,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
127
149
|
/// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
|
|
128
150
|
/// - Returns: Whether it was able to set the value as Boolean value.
|
|
129
151
|
func setStringItemForKey(key: String, value: String, moduleName: String) throws -> Bool {
|
|
130
|
-
|
|
131
|
-
return result
|
|
152
|
+
return ConnectConfigStore.set(key, value: value)
|
|
132
153
|
}
|
|
133
154
|
|
|
134
155
|
/// Sets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a NSNumber value.
|
|
@@ -138,8 +159,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
138
159
|
/// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
|
|
139
160
|
/// - Returns: Whether it was able to set the value as Boolean value.
|
|
140
161
|
func setNumberItemForKey(key: String, value: Double, moduleName: String) throws -> Bool {
|
|
141
|
-
|
|
142
|
-
return result
|
|
162
|
+
return ConnectConfigStore.set(key, value: value)
|
|
143
163
|
}
|
|
144
164
|
|
|
145
165
|
|
|
@@ -150,8 +170,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
150
170
|
/// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
|
|
151
171
|
/// - Returns: Whether it was able to set the value.
|
|
152
172
|
func setConfigItemForKey(key: String, value: Variant_Bool_String_Double, moduleName: String) throws -> Bool {
|
|
153
|
-
|
|
154
|
-
return true
|
|
173
|
+
return ConnectConfigStore.set(key, value: convertVariantToAny(value))
|
|
155
174
|
}
|
|
156
175
|
|
|
157
176
|
/// Gets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a BOOL value.
|
|
@@ -161,8 +180,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
161
180
|
/// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
|
|
162
181
|
/// - Returns: The value of the configuration item key as a BOOL value.
|
|
163
182
|
func getBooleanConfigItemForKey(theDefault: Bool, key: String, moduleName: String) throws -> Bool {
|
|
164
|
-
|
|
165
|
-
return result
|
|
183
|
+
return ConnectConfigStore.bool(forKey: key, default: theDefault)
|
|
166
184
|
}
|
|
167
185
|
|
|
168
186
|
/// Gets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a NString value.
|
|
@@ -172,7 +190,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
172
190
|
/// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
|
|
173
191
|
/// - Returns: The value of the configuration item key as a NString value.
|
|
174
192
|
func getStringItemForKey(theDefault: String, key: String, moduleName: String) throws -> Variant_NullType_String? {
|
|
175
|
-
let result =
|
|
193
|
+
let result = ConnectConfigStore.string(forKey: key, default: theDefault)
|
|
176
194
|
return result.map { .second($0) }
|
|
177
195
|
}
|
|
178
196
|
|
|
@@ -183,8 +201,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
|
|
|
183
201
|
/// - moduleName: The name of the module to be updated. For EOCore settings, please use 'EOCore' which can be found the following files EOCoreBasicConfig.plist, EOCoreBasicConfig.properties or EOCoreAdvancedConfig.json and 'Connect' for Connect which can be found the following files ConnectBasicConfig.plist, ConnectBasicConfig.properties or ConnectAdvancedConfig.json.
|
|
184
202
|
/// - Returns: The value of the configuration item key as a NSNumber value.
|
|
185
203
|
func getNumberItemForKey(theDefault: Double, key: String, moduleName: String) throws -> Double {
|
|
186
|
-
|
|
187
|
-
return result
|
|
204
|
+
return ConnectConfigStore.number(forKey: key, default: theDefault)
|
|
188
205
|
}
|
|
189
206
|
|
|
190
207
|
/// Log custom event.
|
|
@@ -25,10 +25,19 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
25
25
|
const Connect = ({
|
|
26
26
|
children,
|
|
27
27
|
captureKeyboardEvents,
|
|
28
|
-
captureDialogEvents = false
|
|
28
|
+
captureDialogEvents = false,
|
|
29
|
+
navigationRef
|
|
29
30
|
}) => {
|
|
30
31
|
const child = children;
|
|
31
|
-
const
|
|
32
|
+
const childProvidedRef = child?.props?.ref ?? child?.ref;
|
|
33
|
+
const internalRef = (0, _react.useRef)(null);
|
|
34
|
+
|
|
35
|
+
// Resolution order (explicit → legacy child ref → auto-injected fallback).
|
|
36
|
+
// The chosen ref flows through the same mount-effect / touch / layout
|
|
37
|
+
// guards, so any path that fails to resolve a usable navigation container
|
|
38
|
+
// simply disables tracking rather than breaking host-app gestures.
|
|
39
|
+
const navigation = navigationRef ?? childProvidedRef ?? internalRef;
|
|
40
|
+
const shouldInjectRef = !navigationRef && !childProvidedRef && /*#__PURE__*/_react.default.isValidElement(child);
|
|
32
41
|
const currentRoute = (0, _react.useRef)(undefined);
|
|
33
42
|
const initial = (0, _react.useRef)(false);
|
|
34
43
|
(0, _react.useEffect)(() => {
|
|
@@ -38,8 +47,8 @@ const Connect = ({
|
|
|
38
47
|
_TLTRN.default.interceptDialogEvents(captureDialogEvents);
|
|
39
48
|
}, [captureDialogEvents]);
|
|
40
49
|
(0, _react.useEffect)(() => {
|
|
41
|
-
if (!navigation || typeof navigation.current.addListener !== "function" || typeof navigation.current.getCurrentRoute !== "function") {
|
|
42
|
-
console.warn("Connect:
|
|
50
|
+
if (!navigation || !navigation.current || typeof navigation.current.addListener !== "function" || typeof navigation.current.getCurrentRoute !== "function") {
|
|
51
|
+
console.warn("Connect: navigation tracking disabled — no usable NavigationContainer ref resolved. " + "Pass `navigationRef` (from useNavigationContainerRef()) or ensure the direct child is a NavigationContainer.");
|
|
43
52
|
return;
|
|
44
53
|
}
|
|
45
54
|
|
|
@@ -61,24 +70,27 @@ const Connect = ({
|
|
|
61
70
|
};
|
|
62
71
|
}, [navigation]);
|
|
63
72
|
const onStartShouldSetResponderCapture = (0, _react.useCallback)(event => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
73
|
+
if (navigation?.current?.getCurrentRoute) {
|
|
74
|
+
currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
|
|
75
|
+
if (currentRoute.current) {
|
|
76
|
+
_TLTRN.default.logScreenViewPageName(currentRoute.current);
|
|
77
|
+
}
|
|
67
78
|
}
|
|
68
79
|
_TLTRN.default.logClickEvent(event);
|
|
69
|
-
return false; // Must
|
|
70
|
-
}, []);
|
|
71
|
-
const onLayout = (0, _react.useCallback)(
|
|
80
|
+
return false; // Must remain false so events bubble to the host app's handlers
|
|
81
|
+
}, [navigation]);
|
|
82
|
+
const onLayout = (0, _react.useCallback)(_event => {
|
|
72
83
|
if (initial.current) {
|
|
73
84
|
return false;
|
|
74
85
|
}
|
|
75
86
|
initial.current = true;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
87
|
+
if (navigation?.current?.getCurrentRoute) {
|
|
88
|
+
currentRoute.current = navigation.current.getCurrentRoute()?.name;
|
|
89
|
+
if (_reactNative.Platform.OS === "ios" && currentRoute.current) {
|
|
90
|
+
_TLTRN.default.logScreenViewPageName(currentRoute.current);
|
|
91
|
+
} else if (_reactNative.Platform.OS === "android") {
|
|
92
|
+
_TLTRN.default.logScreenLayout(currentRoute.current);
|
|
93
|
+
}
|
|
82
94
|
}
|
|
83
95
|
return true;
|
|
84
96
|
}, [navigation]);
|
|
@@ -86,11 +98,13 @@ const Connect = ({
|
|
|
86
98
|
style: styles.connect_main,
|
|
87
99
|
onLayout: onLayout,
|
|
88
100
|
onStartShouldSetResponderCapture: onStartShouldSetResponderCapture,
|
|
89
|
-
children:
|
|
101
|
+
children: shouldInjectRef ? /*#__PURE__*/_react.default.cloneElement(child, {
|
|
102
|
+
ref: internalRef
|
|
103
|
+
}) : children
|
|
90
104
|
});
|
|
91
105
|
};
|
|
92
106
|
function extractName(navigation) {
|
|
93
|
-
const routeParams = navigation
|
|
107
|
+
const routeParams = navigation?.current?.getCurrentRoute?.()?.params;
|
|
94
108
|
if (routeParams) {
|
|
95
109
|
const {
|
|
96
110
|
name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_TLTRN","_interopRequireDefault","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Connect","children","captureKeyboardEvents","captureDialogEvents","child","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_TLTRN","_interopRequireDefault","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Connect","children","captureKeyboardEvents","captureDialogEvents","navigationRef","child","childProvidedRef","props","ref","internalRef","useRef","navigation","shouldInjectRef","React","isValidElement","currentRoute","undefined","initial","useEffect","TLTRN","interceptKeyboardEvents","interceptDialogEvents","current","addListener","getCurrentRoute","console","warn","unsubscribeState","extractName","name","log","Platform","OS","logScreenViewPageName","logScreenLayout","onStartShouldSetResponderCapture","useCallback","event","logClickEvent","onLayout","_event","jsx","View","style","styles","connect_main","cloneElement","routeParams","params","_default","exports","StyleSheet","create","flex"],"sourceRoot":"../../../src","sources":["components/Connect.tsx"],"mappings":";;;;;;AASA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAA6B,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAM,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,GAAA,CAAAb,CAAA,EAAAS,CAAA,gBAAAN,CAAA,IAAAH,CAAA,gBAAAG,CAAA,OAAAW,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAG,CAAA,OAAAK,CAAA,IAAAD,CAAA,GAAAS,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAG,CAA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AAE;IACb,MAAM;MAAElB;IAAK,CAAC,GAAGkB,WAAW;IAC5B,OAAOlB,IAAI,GAAGA,IAAI,GAAGlB,UAAU,CAACW,OAAO,EAAEE,eAAe,CAAC,CAAC,EAAEK,IAAI,IAAI,EAAE;EAC1E;EACA,OAAO,EAAE;AACb;AAAC,IAAAoB,QAAA,GAAAC,OAAA,CAAAnE,OAAA,GAEciB,OAAO;AAEtB,MAAM4C,MAAM,GAAGO,uBAAU,CAACC,MAAM,CAAC;EAC7BP,YAAY,EAAE;IACVQ,IAAI,EAAE;EACV;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -17,10 +17,19 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
17
17
|
const Connect = ({
|
|
18
18
|
children,
|
|
19
19
|
captureKeyboardEvents,
|
|
20
|
-
captureDialogEvents = false
|
|
20
|
+
captureDialogEvents = false,
|
|
21
|
+
navigationRef
|
|
21
22
|
}) => {
|
|
22
23
|
const child = children;
|
|
23
|
-
const
|
|
24
|
+
const childProvidedRef = child?.props?.ref ?? child?.ref;
|
|
25
|
+
const internalRef = useRef(null);
|
|
26
|
+
|
|
27
|
+
// Resolution order (explicit → legacy child ref → auto-injected fallback).
|
|
28
|
+
// The chosen ref flows through the same mount-effect / touch / layout
|
|
29
|
+
// guards, so any path that fails to resolve a usable navigation container
|
|
30
|
+
// simply disables tracking rather than breaking host-app gestures.
|
|
31
|
+
const navigation = navigationRef ?? childProvidedRef ?? internalRef;
|
|
32
|
+
const shouldInjectRef = !navigationRef && !childProvidedRef && /*#__PURE__*/React.isValidElement(child);
|
|
24
33
|
const currentRoute = useRef(undefined);
|
|
25
34
|
const initial = useRef(false);
|
|
26
35
|
useEffect(() => {
|
|
@@ -30,8 +39,8 @@ const Connect = ({
|
|
|
30
39
|
TLTRN.interceptDialogEvents(captureDialogEvents);
|
|
31
40
|
}, [captureDialogEvents]);
|
|
32
41
|
useEffect(() => {
|
|
33
|
-
if (!navigation || typeof navigation.current.addListener !== "function" || typeof navigation.current.getCurrentRoute !== "function") {
|
|
34
|
-
console.warn("Connect:
|
|
42
|
+
if (!navigation || !navigation.current || typeof navigation.current.addListener !== "function" || typeof navigation.current.getCurrentRoute !== "function") {
|
|
43
|
+
console.warn("Connect: navigation tracking disabled — no usable NavigationContainer ref resolved. " + "Pass `navigationRef` (from useNavigationContainerRef()) or ensure the direct child is a NavigationContainer.");
|
|
35
44
|
return;
|
|
36
45
|
}
|
|
37
46
|
|
|
@@ -53,24 +62,27 @@ const Connect = ({
|
|
|
53
62
|
};
|
|
54
63
|
}, [navigation]);
|
|
55
64
|
const onStartShouldSetResponderCapture = useCallback(event => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
if (navigation?.current?.getCurrentRoute) {
|
|
66
|
+
currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
|
|
67
|
+
if (currentRoute.current) {
|
|
68
|
+
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
69
|
+
}
|
|
59
70
|
}
|
|
60
71
|
TLTRN.logClickEvent(event);
|
|
61
|
-
return false; // Must
|
|
62
|
-
}, []);
|
|
63
|
-
const onLayout = useCallback(
|
|
72
|
+
return false; // Must remain false so events bubble to the host app's handlers
|
|
73
|
+
}, [navigation]);
|
|
74
|
+
const onLayout = useCallback(_event => {
|
|
64
75
|
if (initial.current) {
|
|
65
76
|
return false;
|
|
66
77
|
}
|
|
67
78
|
initial.current = true;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
79
|
+
if (navigation?.current?.getCurrentRoute) {
|
|
80
|
+
currentRoute.current = navigation.current.getCurrentRoute()?.name;
|
|
81
|
+
if (Platform.OS === "ios" && currentRoute.current) {
|
|
82
|
+
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
83
|
+
} else if (Platform.OS === "android") {
|
|
84
|
+
TLTRN.logScreenLayout(currentRoute.current);
|
|
85
|
+
}
|
|
74
86
|
}
|
|
75
87
|
return true;
|
|
76
88
|
}, [navigation]);
|
|
@@ -78,11 +90,13 @@ const Connect = ({
|
|
|
78
90
|
style: styles.connect_main,
|
|
79
91
|
onLayout: onLayout,
|
|
80
92
|
onStartShouldSetResponderCapture: onStartShouldSetResponderCapture,
|
|
81
|
-
children:
|
|
93
|
+
children: shouldInjectRef ? /*#__PURE__*/React.cloneElement(child, {
|
|
94
|
+
ref: internalRef
|
|
95
|
+
}) : children
|
|
82
96
|
});
|
|
83
97
|
};
|
|
84
98
|
function extractName(navigation) {
|
|
85
|
-
const routeParams = navigation
|
|
99
|
+
const routeParams = navigation?.current?.getCurrentRoute?.()?.params;
|
|
86
100
|
if (routeParams) {
|
|
87
101
|
const {
|
|
88
102
|
name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useEffect","useRef","View","StyleSheet","Platform","TLTRN","jsx","_jsx","Connect","children","captureKeyboardEvents","captureDialogEvents","child","
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useRef","View","StyleSheet","Platform","TLTRN","jsx","_jsx","Connect","children","captureKeyboardEvents","captureDialogEvents","navigationRef","child","childProvidedRef","props","ref","internalRef","navigation","shouldInjectRef","isValidElement","currentRoute","undefined","initial","interceptKeyboardEvents","interceptDialogEvents","current","addListener","getCurrentRoute","console","warn","unsubscribeState","extractName","name","log","OS","logScreenViewPageName","logScreenLayout","onStartShouldSetResponderCapture","event","logClickEvent","onLayout","_event","style","styles","connect_main","cloneElement","routeParams","params","create","flex"],"sourceRoot":"../../../src","sources":["components/Connect.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAC7D,SAASC,IAAI,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,cAAc;AACF;AACvD,OAAOC,KAAK,MAAM,UAAU;AAAC,SAAAC,GAAA,IAAAC,I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,CAAC,CAAC","ignoreList":[]}
|
|
@@ -12,6 +12,18 @@ interface ConnectProps {
|
|
|
12
12
|
children: React.ReactNode;
|
|
13
13
|
captureKeyboardEvents: boolean;
|
|
14
14
|
captureDialogEvents?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Preferred: an explicit NavigationContainer ref obtained from
|
|
17
|
+
* `useNavigationContainerRef()`. Using this prop decouples <Connect> from
|
|
18
|
+
* any assumption about the children structure and is the recommended
|
|
19
|
+
* integration path.
|
|
20
|
+
*
|
|
21
|
+
* If omitted, <Connect> falls back to (a) inspecting the direct child's
|
|
22
|
+
* own ref, then (b) auto-injecting an internal ref via cloneElement.
|
|
23
|
+
* Every path degrades gracefully — if no usable ref is resolved,
|
|
24
|
+
* screen-name tracking is disabled but touches still reach host components.
|
|
25
|
+
*/
|
|
26
|
+
navigationRef?: React.RefObject<any>;
|
|
15
27
|
}
|
|
16
28
|
declare const Connect: React.FC<ConnectProps>;
|
|
17
29
|
export default Connect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Connect.d.ts","sourceRoot":"","sources":["../../../../src/components/Connect.tsx"],"names":[],"mappings":"AAAA;;;;;;;;6FAQ6F;AAC7F,OAAO,
|
|
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;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;CACxC;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAsGnC,CAAC;AAWF,eAAe,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
"source": "src/index",
|
|
193
193
|
"summary": "react-native ios android tealeaf connect cxa wxca er enhanced-replay",
|
|
194
194
|
"types": "./lib/typescript/src/index.d.ts",
|
|
195
|
-
"version": "18.0.
|
|
195
|
+
"version": "18.0.21",
|
|
196
196
|
"workspaces": [
|
|
197
197
|
"example"
|
|
198
198
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"Connect": {
|
|
3
|
-
"AndroidVersion": "11.0.
|
|
3
|
+
"AndroidVersion": "11.0.9-beta",
|
|
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",
|
|
@@ -7,8 +7,8 @@
|
|
|
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
|
|
11
|
-
import { View, StyleSheet, Platform
|
|
10
|
+
import React, { useCallback, useEffect, useRef } from "react";
|
|
11
|
+
import { View, StyleSheet, Platform } from "react-native";
|
|
12
12
|
import type { LayoutChangeEvent } from "react-native"; // Use type-only import for LayoutChangeEvent
|
|
13
13
|
import TLTRN from '../TLTRN';
|
|
14
14
|
|
|
@@ -16,11 +16,38 @@ interface ConnectProps {
|
|
|
16
16
|
children: React.ReactNode;
|
|
17
17
|
captureKeyboardEvents: boolean;
|
|
18
18
|
captureDialogEvents?: boolean; // New prop for dialog event capture
|
|
19
|
+
/**
|
|
20
|
+
* Preferred: an explicit NavigationContainer ref obtained from
|
|
21
|
+
* `useNavigationContainerRef()`. Using this prop decouples <Connect> from
|
|
22
|
+
* any assumption about the children structure and is the recommended
|
|
23
|
+
* integration path.
|
|
24
|
+
*
|
|
25
|
+
* If omitted, <Connect> falls back to (a) inspecting the direct child's
|
|
26
|
+
* own ref, then (b) auto-injecting an internal ref via cloneElement.
|
|
27
|
+
* Every path degrades gracefully — if no usable ref is resolved,
|
|
28
|
+
* screen-name tracking is disabled but touches still reach host components.
|
|
29
|
+
*/
|
|
30
|
+
navigationRef?: React.RefObject<any>;
|
|
19
31
|
}
|
|
20
32
|
|
|
21
|
-
const Connect: React.FC<ConnectProps> = ({
|
|
33
|
+
const Connect: React.FC<ConnectProps> = ({
|
|
34
|
+
children,
|
|
35
|
+
captureKeyboardEvents,
|
|
36
|
+
captureDialogEvents = false,
|
|
37
|
+
navigationRef,
|
|
38
|
+
}) => {
|
|
22
39
|
const child = children as any;
|
|
23
|
-
const
|
|
40
|
+
const childProvidedRef = child?.props?.ref ?? child?.ref;
|
|
41
|
+
const internalRef = useRef<any>(null);
|
|
42
|
+
|
|
43
|
+
// Resolution order (explicit → legacy child ref → auto-injected fallback).
|
|
44
|
+
// The chosen ref flows through the same mount-effect / touch / layout
|
|
45
|
+
// guards, so any path that fails to resolve a usable navigation container
|
|
46
|
+
// simply disables tracking rather than breaking host-app gestures.
|
|
47
|
+
const navigation = navigationRef ?? childProvidedRef ?? internalRef;
|
|
48
|
+
const shouldInjectRef =
|
|
49
|
+
!navigationRef && !childProvidedRef && React.isValidElement(child);
|
|
50
|
+
|
|
24
51
|
const currentRoute = useRef<string | undefined>(undefined);
|
|
25
52
|
const initial = useRef<boolean>(false);
|
|
26
53
|
|
|
@@ -35,11 +62,13 @@ const Connect: React.FC<ConnectProps> = ({ children, captureKeyboardEvents, capt
|
|
|
35
62
|
useEffect(() => {
|
|
36
63
|
if (
|
|
37
64
|
!navigation ||
|
|
65
|
+
!navigation.current ||
|
|
38
66
|
typeof navigation.current.addListener !== "function" ||
|
|
39
67
|
typeof navigation.current.getCurrentRoute !== "function"
|
|
40
68
|
) {
|
|
41
69
|
console.warn(
|
|
42
|
-
"Connect:
|
|
70
|
+
"Connect: navigation tracking disabled — no usable NavigationContainer ref resolved. " +
|
|
71
|
+
"Pass `navigationRef` (from useNavigationContainerRef()) or ensure the direct child is a NavigationContainer."
|
|
43
72
|
);
|
|
44
73
|
return;
|
|
45
74
|
}
|
|
@@ -64,29 +93,32 @@ const Connect: React.FC<ConnectProps> = ({ children, captureKeyboardEvents, capt
|
|
|
64
93
|
}, [navigation]);
|
|
65
94
|
|
|
66
95
|
const onStartShouldSetResponderCapture = useCallback((event: any) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
96
|
+
if (navigation?.current?.getCurrentRoute) {
|
|
97
|
+
currentRoute.current =
|
|
98
|
+
extractName(navigation) || navigation.current.getCurrentRoute()?.name;
|
|
99
|
+
if (currentRoute.current) {
|
|
100
|
+
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
101
|
+
}
|
|
70
102
|
}
|
|
71
103
|
TLTRN.logClickEvent(event);
|
|
72
|
-
return false; // Must
|
|
73
|
-
}, []);
|
|
104
|
+
return false; // Must remain false so events bubble to the host app's handlers
|
|
105
|
+
}, [navigation]);
|
|
74
106
|
|
|
75
|
-
const onLayout = useCallback((
|
|
107
|
+
const onLayout = useCallback((_event: LayoutChangeEvent) => {
|
|
76
108
|
if (initial.current) {
|
|
77
109
|
return false;
|
|
78
110
|
}
|
|
79
111
|
initial.current = true;
|
|
80
112
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
113
|
+
if (navigation?.current?.getCurrentRoute) {
|
|
114
|
+
currentRoute.current = navigation.current.getCurrentRoute()?.name;
|
|
115
|
+
if (Platform.OS === "ios" && currentRoute.current) {
|
|
116
|
+
TLTRN.logScreenViewPageName(currentRoute.current);
|
|
117
|
+
} else if (Platform.OS === "android") {
|
|
118
|
+
TLTRN.logScreenLayout(currentRoute.current);
|
|
119
|
+
}
|
|
88
120
|
}
|
|
89
|
-
return true
|
|
121
|
+
return true;
|
|
90
122
|
}, [navigation]);
|
|
91
123
|
|
|
92
124
|
return (
|
|
@@ -95,13 +127,15 @@ const Connect: React.FC<ConnectProps> = ({ children, captureKeyboardEvents, capt
|
|
|
95
127
|
onLayout={onLayout}
|
|
96
128
|
onStartShouldSetResponderCapture={onStartShouldSetResponderCapture}
|
|
97
129
|
>
|
|
98
|
-
{
|
|
130
|
+
{shouldInjectRef
|
|
131
|
+
? React.cloneElement(child as React.ReactElement<any>, { ref: internalRef })
|
|
132
|
+
: children}
|
|
99
133
|
</View>
|
|
100
134
|
);
|
|
101
135
|
};
|
|
102
136
|
|
|
103
137
|
function extractName(navigation: any): string {
|
|
104
|
-
const routeParams = navigation
|
|
138
|
+
const routeParams = navigation?.current?.getCurrentRoute?.()?.params;
|
|
105
139
|
if (routeParams) {
|
|
106
140
|
const { name } = routeParams;
|
|
107
141
|
return name ? name : navigation.current?.getCurrentRoute()?.name || "";
|