react-native-acoustic-connect-beta 18.0.20 → 18.0.22

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.
@@ -10,6 +10,19 @@ dependencyName = useRelease ? 'AcousticConnect' : 'AcousticConnectDebug'
10
10
  iOSVersion = connectConfig["Connect"]["iOSVersion"]
11
11
  dependencyVersion = iOSVersion.to_s.empty? ? "" : ", '#{iOSVersion}'"
12
12
 
13
+ # Write the merged consumer config to the resource-bundle source path AT POD INSTALL TIME.
14
+ # This MUST happen before CocoaPods builds the AcousticConnectRNConfig bundle target,
15
+ # which it does as a dependency of the parent target — too early for any build-time
16
+ # script_phase to influence. Writing here ensures the bundle ships the consumer's
17
+ # AppKey / PostMessageUrl / KillSwitchUrl from the very first build, instead of an
18
+ # empty placeholder that causes the SDK to fall back to its bundled demo defaults.
19
+ # See: ios/AcousticConnectRNConfig.json (placeholder shipped in the npm tarball;
20
+ # overwritten here on every `pod install`).
21
+ File.open(File.join(__dir__, 'ios', 'AcousticConnectRNConfig.json'), 'w') do |f|
22
+ f.write(JSON.pretty_generate(connectConfig))
23
+ end
24
+ puts "Merged ConnectConfig.json into ios/AcousticConnectRNConfig.json (install-time)"
25
+
13
26
  puts "*********react-native-acoustic-connect-beta.podspec*********"
14
27
  puts "connectConfig:"
15
28
  puts JSON.pretty_generate(connectConfig)
@@ -37,8 +50,6 @@ Pod::Spec.new do |s|
37
50
  "ios/**/*.{swift}",
38
51
  # Autolinking/Registration (Objective-C++)
39
52
  "ios/**/*.{m,mm}",
40
- # Build Config (Ruby)
41
- "ios/ConnectConfig/**/*.{rb}",
42
53
  # Implementation (C++ objects)
43
54
  "cpp/**/*.{hpp,cpp}",
44
55
  ]
@@ -52,11 +63,6 @@ Pod::Spec.new do |s|
52
63
  'AcousticConnectRNConfig' => ['ios/AcousticConnectRNConfig.json'],
53
64
  }
54
65
  s.resource = 'ios/AcousticConnectRNConfig.json'
55
- s.script_phase = {
56
- :name => 'Build Config',
57
- :script => %("${PODS_TARGET_SRCROOT}/ios/ConnectConfig/Build_Config.rb" "${PODS_ROOT}" "ConnectConfig.json" "${PODS_TARGET_SRCROOT}"),
58
- :execution_position => :before_compile,
59
- }
60
66
 
61
67
  load 'nitrogen/generated/ios/AcousticConnectRN+autolinking.rb'
62
68
  add_nitrogen_files(s)
@@ -24,7 +24,7 @@
24
24
  "IpPlaceholder": "N/A",
25
25
  "KillSwitchAsync": true,
26
26
  "KillSwitchDelay": 300,
27
- "LibraryVersion": "11.0.8-beta",
27
+ "LibraryVersion": "11.0.9-beta",
28
28
  "LogFullRequestResponsePayloads": true,
29
29
  "MessageTypeHeader": "WorklightHit",
30
30
  "MessageTypes": "4,5",
@@ -1,4 +1,4 @@
1
- #Fri Apr 24 00:36:32 PDT 2026
1
+ #Tue Apr 28 02:21:07 PDT 2026
2
2
  UseWhiteList=true
3
3
  PrintScreen=3
4
4
  UseRandomSample=false
@@ -24,7 +24,7 @@
24
24
  "IpPlaceholder": "N/A",
25
25
  "KillSwitchAsync": true,
26
26
  "KillSwitchDelay": 300,
27
- "LibraryVersion": "10.4.27-beta",
27
+ "LibraryVersion": "10.4.28-beta",
28
28
  "LogFullRequestResponsePayloads": true,
29
29
  "MessageTypeHeader": "WorklightHit",
30
30
  "MessageTypes": "4,5",
@@ -0,0 +1,156 @@
1
+ {
2
+ "Connect": {
3
+ "AndroidVersion": "11.0.9-beta",
4
+ "AppKey": "b6c3709b7a4c479bb4b5a9fb8fec324c",
5
+ "KillSwitchUrl": "https://lib-us-2.brilliantcollector.com/collector/switch/b6c3709b7a4c479bb4b5a9fb8fec324c",
6
+ "PostMessageUrl": "https://lib-us-2.brilliantcollector.com/collector/collectorPost",
7
+ "iOSVersion": "",
8
+ "layoutConfigAndroid": {
9
+ "AppendMapIds": {
10
+ "[w,9290],[v,0]": {
11
+ "mid": "ASimpleUIView"
12
+ },
13
+ "idxPathValue": {
14
+ "mid": "giveAdditionalId2"
15
+ },
16
+ "tag2999999": {
17
+ "mid": "giveAdditionalId1"
18
+ }
19
+ },
20
+ "AutoLayout": {
21
+ "ExampleMaskingPage": {
22
+ "CaptureLayoutDelay": 0,
23
+ "CaptureLayoutOn": 0,
24
+ "CaptureScreenVisits": false,
25
+ "CaptureScreenshotOn": 0,
26
+ "CaptureUserEvents": false,
27
+ "DisplayName": "",
28
+ "Masking": {
29
+ "HasCustomMask": true,
30
+ "HasMasking": true,
31
+ "MaskAccessibilityIdList": [],
32
+ "MaskAccessibilityLabelList": [],
33
+ "MaskIdList": [
34
+ "^9[0-9][0-9][0-9]$",
35
+ "^\\[wvv,0\\],\\[dddv,0\\],\\[v,0\\],\\[v,0\\],\\[v,0\\],\\[b,0\\](.)*$"
36
+ ],
37
+ "MaskValueList": [
38
+ "^4[0-9]{12}(?:[0-9]{3})?$",
39
+ "^3[47][0-9]{13}$",
40
+ "^65[4-9][0-9]{13}|64[4-9][0-9]{13}|6011[0-9]{12}|(622(?:12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|9[01][0-9]|92[0-5])[0-9]{10})$",
41
+ "^(5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12}))$"
42
+ ],
43
+ "Sensitive": {
44
+ "capitalCaseAlphabet": "X",
45
+ "number": "9",
46
+ "smallCaseAlphabet": "x",
47
+ "symbol": "#"
48
+ }
49
+ },
50
+ "NumberOfWebViews": 0,
51
+ "ScreenChange": false,
52
+ "ScreenShot": false
53
+ },
54
+ "GlobalScreenSettings": {
55
+ "CaptureLayoutDelay": 1,
56
+ "CaptureLayoutOn": 2,
57
+ "CaptureScreenVisits": false,
58
+ "CaptureScreenshotOn": 2,
59
+ "CaptureUserEvents": true,
60
+ "DisplayName": "",
61
+ "Masking": {
62
+ "HasCustomMask": true,
63
+ "HasMasking": true,
64
+ "MaskAccessibilityIdList": [],
65
+ "MaskAccessibilityLabelList": [],
66
+ "MaskIdList": [],
67
+ "MaskValueList": [],
68
+ "Sensitive": {
69
+ "capitalCaseAlphabet": "X",
70
+ "number": "9",
71
+ "smallCaseAlphabet": "x",
72
+ "symbol": "#"
73
+ }
74
+ },
75
+ "NumberOfWebViews": 0,
76
+ "ScreenChange": true,
77
+ "ScreenShot": true
78
+ }
79
+ }
80
+ },
81
+ "layoutConfigIos": {
82
+ "AppendMapIds": {
83
+ "[w,9290],[v,0]": {
84
+ "mid": "ASimpleUIView"
85
+ },
86
+ "idxPathValue": {
87
+ "mid": "giveAdditionalId2"
88
+ },
89
+ "tag2999999": {
90
+ "mid": "giveAdditionalId1"
91
+ }
92
+ },
93
+ "AutoLayout": {
94
+ "ExampleMaskingPage": {
95
+ "CaptureLayoutDelay": 0,
96
+ "CaptureLayoutOn": 0,
97
+ "CaptureScreenVisits": false,
98
+ "CaptureScreenshotOn": 0,
99
+ "CaptureUserEvents": false,
100
+ "DisplayName": "",
101
+ "Masking": {
102
+ "HasCustomMask": true,
103
+ "HasMasking": true,
104
+ "MaskAccessibilityIdList": [],
105
+ "MaskAccessibilityLabelList": [],
106
+ "MaskIdList": [
107
+ "^9[0-9][0-9][0-9]$",
108
+ "^\\[wvv,0\\],\\[dddv,0\\],\\[v,0\\],\\[v,0\\],\\[v,0\\],\\[b,0\\](.)*$"
109
+ ],
110
+ "MaskValueList": [
111
+ "^4[0-9]{12}(?:[0-9]{3})?$",
112
+ "^3[47][0-9]{13}$",
113
+ "^65[4-9][0-9]{13}|64[4-9][0-9]{13}|6011[0-9]{12}|(622(?:12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|9[01][0-9]|92[0-5])[0-9]{10})$",
114
+ "^(5[1-5][0-9]{14}|2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12}))$"
115
+ ],
116
+ "Sensitive": {
117
+ "capitalCaseAlphabet": "X",
118
+ "number": "9",
119
+ "smallCaseAlphabet": "x",
120
+ "symbol": "#"
121
+ }
122
+ },
123
+ "NumberOfWebViews": 0,
124
+ "ScreenChange": false,
125
+ "ScreenShot": false
126
+ },
127
+ "GlobalScreenSettings": {
128
+ "CaptureLayoutDelay": 1,
129
+ "CaptureLayoutOn": 2,
130
+ "CaptureScreenVisits": false,
131
+ "CaptureScreenshotOn": 2,
132
+ "CaptureUserEvents": true,
133
+ "DisplayName": "",
134
+ "Masking": {
135
+ "HasCustomMask": true,
136
+ "HasMasking": true,
137
+ "MaskAccessibilityIdList": [],
138
+ "MaskAccessibilityLabelList": [],
139
+ "MaskIdList": [],
140
+ "MaskValueList": [],
141
+ "Sensitive": {
142
+ "capitalCaseAlphabet": "X",
143
+ "number": "9",
144
+ "smallCaseAlphabet": "x",
145
+ "symbol": "#"
146
+ }
147
+ },
148
+ "NumberOfWebViews": 0,
149
+ "ScreenChange": true,
150
+ "ScreenShot": true
151
+ }
152
+ }
153
+ },
154
+ "useRelease": false
155
+ }
156
+ }
@@ -14,64 +14,30 @@ import Foundation
14
14
  import Connect
15
15
  import NitroModules
16
16
 
17
- // EOCore and Tealeaf ship as separate modules in the Release iOS SDK and in the
18
- // Debug SDK before 2.1.2. From Debug 2.1.2 onward they are merged into Connect
19
- // and these modules are no longer on the search path — so we import them
20
- // conditionally to support both variants from the same source.
21
- #if canImport(EOCore)
22
- import EOCore
23
- #endif
24
- #if canImport(Tealeaf)
25
- import Tealeaf
26
- #endif
27
-
28
- // In the unified SDK, module-name constants were dropped along with the modules
29
- // themselves. The replacement helper (`ConnectApplicationHelper`) ignores the
30
- // module name — a single config store holds all keys. We still keep the old
31
- // names so existing call sites compile unchanged on both variants.
32
- #if !canImport(EOCore)
33
- private let kEOCoreModule = "EOCore"
34
- private let kTLFCoreModule = "TLFCoreModule"
35
- #endif
36
-
37
- // Cross-SDK bridge for the config-item set/get API. On the old SDK this calls
38
- // through `EOApplicationHelper` with a module name; on the unified SDK it calls
39
- // through `ConnectApplicationHelper` and the module name is ignored.
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.
40
22
  private enum ConnectConfigStore {
41
23
  @discardableResult
42
- static func set(_ key: String, value: Any, forModule moduleName: String) -> Bool {
43
- #if canImport(EOCore)
44
- return EOApplicationHelper.sharedInstance().setConfigItem(key, value: value, forModuleName: moduleName)
45
- #else
24
+ static func set(_ key: String, value: Any) -> Bool {
46
25
  return ConnectApplicationHelper.sharedInstance().setConfigurableItem(key, value: value)
47
- #endif
48
26
  }
49
27
 
50
- static func bool(forKey key: String, default def: Bool, moduleName: String) -> Bool {
51
- #if canImport(EOCore)
52
- return EOApplicationHelper().getBOOLconfigItem(forKey: key, withDefault: def, forModuleName: moduleName)
53
- #else
28
+ static func bool(forKey key: String, default def: Bool) -> Bool {
54
29
  let raw = ConnectApplicationHelper.sharedInstance().value(forConfigurableItem: key)
55
30
  if let n = raw as? NSNumber { return n.boolValue }
56
31
  if let s = raw as? String { return (s as NSString).boolValue }
57
32
  return def
58
- #endif
59
33
  }
60
34
 
61
- static func string(forKey key: String, default def: String, moduleName: String) -> String? {
62
- #if canImport(EOCore)
63
- return EOApplicationHelper().getStringItem(forKey: key, withDefault: def, forModuleName: moduleName)
64
- #else
35
+ static func string(forKey key: String, default def: String) -> String? {
65
36
  return (ConnectApplicationHelper.sharedInstance().value(forConfigurableItem: key) as? String) ?? def
66
- #endif
67
37
  }
68
38
 
69
- static func number(forKey key: String, default def: Double, moduleName: String) -> Double {
70
- #if canImport(EOCore)
71
- return (EOApplicationHelper().getNumberItem(forKey: key, withDefault: NSNumber(value: def), forModuleName: moduleName) as? NSNumber)?.doubleValue ?? def
72
- #else
39
+ static func number(forKey key: String, default def: Double) -> Double {
73
40
  return (ConnectApplicationHelper.sharedInstance().value(forConfigurableItem: key) as? NSNumber)?.doubleValue ?? def
74
- #endif
75
41
  }
76
42
  }
77
43
 
@@ -95,17 +61,89 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
95
61
 
96
62
  func load() {
97
63
  DispatchQueue.main.async {
98
- self.loadConnectConfig()
99
- // EOApplicationHelper().setConfigItem(kConfigurableItemSetGestureDetector, value: "false", forModuleName: kTLFCoreModule)
100
- // EOApplicationHelper().setConfigItem(kConfigurableItemLogViewLayoutOnScreenTransition, value: "false", forModuleName: kTLFCoreModule)
101
- ConnectApplicationHelper().isReactNative(true, wrapNavigationContainer: true)
102
- ConnectApplicationHelper().enableFramework()
64
+ let connectData = self.parseConnectConfigJSON()
65
+ let appKey = (connectData?["AppKey"] as? String) ?? ""
66
+ let postURL = (connectData?["PostMessageUrl"] as? String) ?? ""
67
+
68
+ // Skip enable entirely if the consumer's config didn't reach us —
69
+ // proceeding with empty strings would let the SDK silently fall back
70
+ // to its bundled demo collector, which is exactly the bug this flow
71
+ // is designed to prevent. Most likely cause: missing or malformed
72
+ // ConnectConfig.json at the consumer's project root, or `pod install`
73
+ // didn't run after the file was added.
74
+ guard !appKey.isEmpty, !postURL.isEmpty else {
75
+ print("[AcousticConnectRN] SDK NOT ENABLED — empty AppKey or PostMessageUrl. " +
76
+ "Verify ConnectConfig.json at your project root contains both fields, " +
77
+ "then re-run `pod install`.")
78
+ return
79
+ }
80
+
81
+ let helper = ConnectApplicationHelper.sharedInstance()
82
+ helper.isReactNative(true, wrapNavigationContainer: true)
83
+
84
+ // Seed bundle defaults via the new internal selector when available.
85
+ // Required on merged Debug 2.1.2+ SDKs where EOCoreSettings.bundle /
86
+ // TLFResources.bundle aren't on the app target's resource path; without
87
+ // it the SDK fails to enable. Runtime-dispatched so older SDKs that
88
+ // don't expose this method skip cleanly.
89
+ let applyDefaults = NSSelectorFromString("_connectApplyBundleDefaults")
90
+ if helper.responds(to: applyDefaults) {
91
+ helper.perform(applyDefaults)
92
+ }
93
+
94
+ // Enable with explicit appKey/postURL via the new internal selector
95
+ // when present. The zero-arg `enableFramework()` and the deprecated
96
+ // 2-arg public form both empirically ignore explicit values on merged
97
+ // SDKs (they re-read from Connect.framework's bundled demo defaults).
98
+ // The new `_connectEnableWithAppKey:postURL:` honours the args — same
99
+ // path the SDK's own ConnectSDK.shared.enable(...) wrapper uses.
100
+ // Falls back to the deprecated public 2-arg form on older SDKs.
101
+ let connectEnableSel = NSSelectorFromString("_connectEnableWithAppKey:postURL:")
102
+ if helper.responds(to: connectEnableSel) {
103
+ typealias EnableFn = @convention(c) (AnyObject, Selector, NSString, NSString) -> Bool
104
+ let imp = helper.method(for: connectEnableSel)
105
+ let fn = unsafeBitCast(imp, to: EnableFn.self)
106
+ _ = fn(helper, connectEnableSel, appKey as NSString, postURL as NSString)
107
+ } else {
108
+ // Older SDK build that doesn't expose the underscored category. The
109
+ // deprecated 2-arg public form may not honor explicit values on every
110
+ // SDK version — log so the consumer can tell which path fired if they
111
+ // see unexpected routing on their dashboard.
112
+ print("[AcousticConnectRN] Using deprecated enableFramework(_:withPostMessageUrl:) — " +
113
+ "the new internal selector is not exposed by this SDK build. " +
114
+ "If sessions appear on the wrong dashboard, upgrade the AcousticConnect pod.")
115
+ _ = helper.enableFramework(appKey, withPostMessageUrl: postURL)
116
+ }
117
+
118
+ // Apply remaining programmatic overrides (everything other than the
119
+ // two enable parameters) AFTER enable — matches the order in the SDK's
120
+ // own ConnectSDK.shared.enable(with:) implementation.
121
+ if let connectData = connectData {
122
+ self.applyConnectConfig(connectData)
123
+ }
103
124
  }
104
125
  }
126
+
127
+ /// Reads and returns the `Connect` dictionary from the bundled
128
+ /// `AcousticConnectRNConfig.json`. The bundle is populated at pod install
129
+ /// time by the podspec — see `AcousticConnectRN.podspec`. Returns nil when
130
+ /// the bundle or file is missing; callers fall back to empty values.
131
+ private func parseConnectConfigJSON() -> [String: Any]? {
132
+ let bundle = Bundle(for: Self.self)
133
+ let bundleURL = bundle.resourceURL?.appendingPathComponent("AcousticConnectRNConfig.bundle")
134
+ let resourceBundle = bundleURL.flatMap { Bundle(url: $0) }
135
+ let path = resourceBundle?.path(forResource: "AcousticConnectRNConfig", ofType: "json")
136
+ let data = path.flatMap { try? Data(contentsOf: URL(fileURLWithPath: $0)) }
137
+ let jsonData = data.flatMap { try? JSONSerialization.jsonObject(with: $0, options: []) as? [String: Any] }
138
+ return jsonData?["Connect"] as? [String: Any]
139
+ }
105
140
 
106
- /// <#Description#>
107
- /// - Returns: <#description#>
108
- func loadConnectConfig() {
141
+ /// Applies every recognised key from the parsed `Connect` config as a
142
+ /// programmatic override. Called by `load()` AFTER enable so values land on
143
+ /// a fully-initialised SDK. AppKey and PostMessageUrl are skipped here —
144
+ /// they're passed to enable directly because the SDK's bundle-read
145
+ /// short-circuits `tempConfigDict` for those two specifically.
146
+ private func applyConnectConfig(_ connectData: [String: Any]) {
109
147
  let eocoreKeys = [
110
148
  "CachingLevel", "DoPostAppComesFromBackground", "DoPostAppGoesToBackground", "DoPostAppGoesToClose",
111
149
  "DoPostAppIsLaunched", "DoPostOnIntervals", "DynamicConfigurationEnabled", "HasToPersistLocalCache",
@@ -140,29 +178,20 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
140
178
  "textBox:_searchFieldBeginChanged", "textBox:_searchFieldBeginEditing", "textBox:_searchFieldEditingChanged",
141
179
  "textBox:textChange", "textBox:textChanged", "textBox:textFieldDidChange", "toggleButton:click"
142
180
  ]
143
-
144
- let bundle = Bundle(for: Self.self)
145
- let bundleURL = bundle.resourceURL?.appendingPathComponent("AcousticConnectRNConfig.bundle")
146
- let resourceBundle = bundleURL.flatMap { Bundle(url: $0) }
147
- let path = resourceBundle?.path(forResource: "AcousticConnectRNConfig", ofType: "json")
148
- let data = path.flatMap { try? Data(contentsOf: URL(fileURLWithPath: $0)) }
149
- let jsonData = data.flatMap { try? JSONSerialization.jsonObject(with: $0, options: []) as? [String: Any] }
150
-
151
- if let jsonData = jsonData,
152
- let connectData = jsonData["Connect"] as? [String: Any] {
153
- for (key, value) in connectData {
154
- if tealeafKeys.contains(key) {
155
- ConnectConfigStore.set(key, value: value, forModule: kTLFCoreModule)
156
- } else if eocoreKeys.contains(key) {
157
- ConnectConfigStore.set(key, value: value, forModule: kEOCoreModule)
158
- } else if key == "layoutConfig",
159
- let layoutConfig = value as? [String: Any] {
160
- if let autoLayout = layoutConfig["AutoLayout"] {
161
- ConnectConfigStore.set("AutoLayout", value: autoLayout, forModule: kTLFCoreModule)
162
- }
163
- if let appendMapIds = layoutConfig["AppendMapIds"] {
164
- ConnectConfigStore.set("AppendMapIds", value: appendMapIds, forModule: kTLFCoreModule)
165
- }
181
+
182
+ for (key, value) in connectData {
183
+ // Skip keys load() passes directly to enable — re-applying is harmless but redundant.
184
+ if key == "AppKey" || key == "PostMessageUrl" { continue }
185
+
186
+ if tealeafKeys.contains(key) || eocoreKeys.contains(key) {
187
+ ConnectConfigStore.set(key, value: value)
188
+ } else if key == "layoutConfig",
189
+ let layoutConfig = value as? [String: Any] {
190
+ if let autoLayout = layoutConfig["AutoLayout"] {
191
+ ConnectConfigStore.set("AutoLayout", value: autoLayout)
192
+ }
193
+ if let appendMapIds = layoutConfig["AppendMapIds"] {
194
+ ConnectConfigStore.set("AppendMapIds", value: appendMapIds)
166
195
  }
167
196
  }
168
197
  }
@@ -175,7 +204,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
175
204
  /// - 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.
176
205
  /// - Returns: Whether it was able to set the value as Boolean value.
177
206
  func setBooleanConfigItemForKey(key: String, value: Bool, moduleName: String) throws -> Bool {
178
- return ConnectConfigStore.set(key, value: value, forModule: moduleName)
207
+ return ConnectConfigStore.set(key, value: value)
179
208
  }
180
209
 
181
210
  /// Sets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a NString value.
@@ -185,7 +214,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
185
214
  /// - 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.
186
215
  /// - Returns: Whether it was able to set the value as Boolean value.
187
216
  func setStringItemForKey(key: String, value: String, moduleName: String) throws -> Bool {
188
- return ConnectConfigStore.set(key, value: value, forModule: moduleName)
217
+ return ConnectConfigStore.set(key, value: value)
189
218
  }
190
219
 
191
220
  /// Sets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a NSNumber value.
@@ -195,7 +224,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
195
224
  /// - 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.
196
225
  /// - Returns: Whether it was able to set the value as Boolean value.
197
226
  func setNumberItemForKey(key: String, value: Double, moduleName: String) throws -> Bool {
198
- return ConnectConfigStore.set(key, value: value, forModule: moduleName)
227
+ return ConnectConfigStore.set(key, value: value)
199
228
  }
200
229
 
201
230
 
@@ -206,7 +235,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
206
235
  /// - 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.
207
236
  /// - Returns: Whether it was able to set the value.
208
237
  func setConfigItemForKey(key: String, value: Variant_Bool_String_Double, moduleName: String) throws -> Bool {
209
- return ConnectConfigStore.set(key, value: convertVariantToAny(value), forModule: moduleName)
238
+ return ConnectConfigStore.set(key, value: convertVariantToAny(value))
210
239
  }
211
240
 
212
241
  /// Gets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a BOOL value.
@@ -216,7 +245,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
216
245
  /// - 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.
217
246
  /// - Returns: The value of the configuration item key as a BOOL value.
218
247
  func getBooleanConfigItemForKey(theDefault: Bool, key: String, moduleName: String) throws -> Bool {
219
- return ConnectConfigStore.bool(forKey: key, default: theDefault, moduleName: moduleName)
248
+ return ConnectConfigStore.bool(forKey: key, default: theDefault)
220
249
  }
221
250
 
222
251
  /// Gets the module's configuration item from AdvancedConfig.json or BasicConfig.plist that matches the specified key as a NString value.
@@ -226,7 +255,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
226
255
  /// - 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.
227
256
  /// - Returns: The value of the configuration item key as a NString value.
228
257
  func getStringItemForKey(theDefault: String, key: String, moduleName: String) throws -> Variant_NullType_String? {
229
- let result = ConnectConfigStore.string(forKey: key, default: theDefault, moduleName: moduleName)
258
+ let result = ConnectConfigStore.string(forKey: key, default: theDefault)
230
259
  return result.map { .second($0) }
231
260
  }
232
261
 
@@ -237,7 +266,7 @@ class HybridAcousticConnectRN: HybridAcousticConnectRNSpec {
237
266
  /// - 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.
238
267
  /// - Returns: The value of the configuration item key as a NSNumber value.
239
268
  func getNumberItemForKey(theDefault: Double, key: String, moduleName: String) throws -> Double {
240
- return ConnectConfigStore.number(forKey: key, default: theDefault, moduleName: moduleName)
269
+ return ConnectConfigStore.number(forKey: key, default: theDefault)
241
270
  }
242
271
 
243
272
  /// 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 navigation = child.props?.ref ?? child.ref;
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: The Connect component's first child must be a NavigationContainer with a ref.");
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
- currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
65
- if (currentRoute && currentRoute.current) {
66
- _TLTRN.default.logScreenViewPageName(currentRoute.current);
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 be false; true means this component becomes the touch responder and events don't bubble
70
- }, []);
71
- const onLayout = (0, _react.useCallback)(event => {
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
- console.log("event - ", event.nativeEvent);
77
- currentRoute.current = navigation.current.getCurrentRoute()?.name;
78
- if (_reactNative.Platform.OS === "ios" && currentRoute && currentRoute.current) {
79
- _TLTRN.default.logScreenViewPageName(currentRoute.current);
80
- } else if (_reactNative.Platform.OS === "android") {
81
- _TLTRN.default.logScreenLayout(currentRoute.current);
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: 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.current.getCurrentRoute()?.params;
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","navigation","props","ref","currentRoute","useRef","undefined","initial","useEffect","TLTRN","interceptKeyboardEvents","interceptDialogEvents","current","addListener","getCurrentRoute","console","warn","unsubscribeState","extractName","name","log","Platform","OS","logScreenViewPageName","logScreenLayout","onStartShouldSetResponderCapture","useCallback","event","logClickEvent","onLayout","nativeEvent","jsx","View","style","styles","connect_main","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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EAAEA,gCAAiC;IAAA5B,QAAA,EAElEA;EAAQ,CACP,CAAC;AAEf,CAAC;AAED,SAASqB,WAAWA,CAACjB,UAAe,EAAU;EAC1C,MAAMmC,WAAW,GAAGnC,UAAU,CAACW,OAAO,CAACE,eAAe,CAAC,CAAC,EAAEuB,MAAM;EAChE,IAAID,WAAW,EAAE;IACb,MAAM;MAAEjB;IAAK,CAAC,GAAGiB,WAAW;IAC5B,OAAOjB,IAAI,GAAGA,IAAI,GAAGlB,UAAU,CAACW,OAAO,EAAEE,eAAe,CAAC,CAAC,EAAEK,IAAI,IAAI,EAAE;EAC1E;EACA,OAAO,EAAE;AACb;AAAC,IAAAmB,QAAA,GAAAC,OAAA,CAAA5D,OAAA,GAEciB,OAAO;AAEtB,MAAMsC,MAAM,GAAGM,uBAAU,CAACC,MAAM,CAAC;EAC7BN,YAAY,EAAE;IACVO,IAAI,EAAE;EACV;AACJ,CAAC,CAAC","ignoreList":[]}
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,sBA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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 navigation = child.props?.ref ?? child.ref;
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: The Connect component's first child must be a NavigationContainer with a ref.");
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
- currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
57
- if (currentRoute && currentRoute.current) {
58
- TLTRN.logScreenViewPageName(currentRoute.current);
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 be false; true means this component becomes the touch responder and events don't bubble
62
- }, []);
63
- const onLayout = useCallback(event => {
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
- console.log("event - ", event.nativeEvent);
69
- currentRoute.current = navigation.current.getCurrentRoute()?.name;
70
- if (Platform.OS === "ios" && currentRoute && currentRoute.current) {
71
- TLTRN.logScreenViewPageName(currentRoute.current);
72
- } else if (Platform.OS === "android") {
73
- TLTRN.logScreenLayout(currentRoute.current);
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: 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.current.getCurrentRoute()?.params;
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","navigation","props","ref","currentRoute","undefined","initial","interceptKeyboardEvents","interceptDialogEvents","current","addListener","getCurrentRoute","console","warn","unsubscribeState","extractName","name","log","OS","logScreenViewPageName","logScreenLayout","onStartShouldSetResponderCapture","event","logClickEvent","onLayout","nativeEvent","style","styles","connect_main","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,QAAoB,OAAO;AACzE,SAASC,IAAI,EAAEC,UAAU,EAAEC,QAAQ,QAAuC,cAAc;AACjC;AACvD,OAAOC,KAAK,MAAM,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAQ7B,MAAMC,OAA+B,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,qBAAqB;EAAEC,mBAAmB,GAAG;AAAM,CAAC,KAAK;EAC1G,MAAMC,KAAK,GAAGH,QAAe;EAC7B,MAAMI,UAAU,GAAGD,KAAK,CAACE,KAAK,EAAEC,GAAG,IAAIH,KAAK,CAACG,GAAG;EAChD,MAAMC,YAAY,GAAGf,MAAM,CAAqBgB,SAAS,CAAC;EAC1D,MAAMC,OAAO,GAAGjB,MAAM,CAAU,KAAK,CAAC;EAEtCD,SAAS,CAAC,MAAM;IACZK,KAAK,CAACc,uBAAuB,CAACT,qBAAqB,CAAC;EACxD,CAAC,EAAE,CAACA,qBAAqB,CAAC,CAAC;EAE3BV,SAAS,CAAC,MAAM;IACZK,KAAK,CAACe,qBAAqB,CAACT,mBAAmB,CAAC;EACpD,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EAEzBX,SAAS,CAAC,MAAM;IACZ,IACI,CAACa,UAAU,IACX,OAAOA,UAAU,CAACQ,OAAO,CAACC,WAAW,KAAK,UAAU,IACpD,OAAOT,UAAU,CAACQ,OAAO,CAACE,eAAe,KAAK,UAAU,EAC1D;MACEC,OAAO,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AY,EAAE;IACVI,IAAI,EAAE;EACV;AACJ,CAAC,CAAC","ignoreList":[]}
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,IAAA;AAoB7B,MAAMC,OAA+B,GAAGA,CAAC;EACrCC,QAAQ;EACRC,qBAAqB;EACrBC,mBAAmB,GAAG,KAAK;EAC3BC;AACJ,CAAC,KAAK;EACF,MAAMC,KAAK,GAAGJ,QAAe;EAC7B,MAAMK,gBAAgB,GAAGD,KAAK,EAAEE,KAAK,EAAEC,GAAG,IAAIH,KAAK,EAAEG,GAAG;EACxD,MAAMC,WAAW,GAAGhB,MAAM,CAAM,IAAI,CAAC;;EAErC;EACA;EACA;EACA;EACA,MAAMiB,UAAU,GAAGN,aAAa,IAAIE,gBAAgB,IAAIG,WAAW;EACnE,MAAME,eAAe,GACjB,CAACP,aAAa,IAAI,CAACE,gBAAgB,iBAAIhB,KAAK,CAACsB,cAAc,CAACP,KAAK,CAAC;EAEtE,MAAMQ,YAAY,GAAGpB,MAAM,CAAqBqB,SAAS,CAAC;EAC1D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AACC,YAAa;IAC3BJ,QAAQ,EAAEA,QAAS;IACnBH,gCAAgC,EAAEA,gCAAiC;IAAA7B,QAAA,EAElEU,eAAe,gBACVrB,KAAK,CAACgD,YAAY,CAACjC,KAAK,EAA6B;MAAEG,GAAG,EAAEC;IAAY,CAAC,CAAC,GAC1ER;EAAQ,CACZ,CAAC;AAEf,CAAC;AAED,SAASuB,WAAWA,CAACd,UAAe,EAAU;EAC1C,MAAM6B,WAAW,GAAG7B,UAAU,EAAEQ,OAAO,EAAEE,eAAe,GAAG,CAAC,EAAEoB,MAAM;EACpE,IAAID,WAAW,EAAE;IACb,MAAM;MAAEd;IAAK,CAAC,GAAGc,WAAW;IAC5B,OAAOd,IAAI,GAAGA,IAAI,GAAGf,UAAU,CAACQ,OAAO,EAAEE,eAAe,CAAC,CAAC,EAAEK,IAAI,IAAI,EAAE;EAC1E;EACA,OAAO,EAAE;AACb;AAEA,eAAezB,OAAO;AAEtB,MAAMoC,MAAM,GAAGzC,UAAU,CAAC8C,MAAM,CAAC;EAC7BJ,YAAY,EAAE;IACVK,IAAI,EAAE;EACV;AACJ,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,KAAqD,MAAM,OAAO,CAAC;AAK1E,UAAU,YAAY;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAgFnC,CAAC;AAWF,eAAe,OAAO,CAAC"}
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
@@ -66,7 +66,7 @@
66
66
  "ios/**/*.mm",
67
67
  "ios/**/*.cpp",
68
68
  "ios/**/*.swift",
69
- "ios/ConnectConfig/Build_Config.rb",
69
+ "ios/AcousticConnectRNConfig.json",
70
70
  "app.plugin.js",
71
71
  "*.podspec",
72
72
  "README.md",
@@ -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.20",
195
+ "version": "18.0.22",
196
196
  "workspaces": [
197
197
  "example"
198
198
  ]
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "Connect": {
3
- "AndroidVersion": "11.0.8-beta",
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, forwardRef } from "react";
11
- import { View, StyleSheet, Platform, NativeModules, findNodeHandle } from "react-native";
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> = ({ children, captureKeyboardEvents, captureDialogEvents = false }) => {
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 navigation = child.props?.ref ?? child.ref;
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: The Connect component's first child must be a NavigationContainer with a ref."
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
- currentRoute.current = extractName(navigation) || navigation.current.getCurrentRoute()?.name;
68
- if (currentRoute && currentRoute.current) {
69
- TLTRN.logScreenViewPageName(currentRoute.current);
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 be false; true means this component becomes the touch responder and events don't bubble
73
- }, []);
104
+ return false; // Must remain false so events bubble to the host app's handlers
105
+ }, [navigation]);
74
106
 
75
- const onLayout = useCallback((event: LayoutChangeEvent) => {
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
- console.log("event - ", event.nativeEvent);
82
-
83
- currentRoute.current = navigation.current.getCurrentRoute()?.name;
84
- if (Platform.OS === "ios" && currentRoute && currentRoute.current) {
85
- TLTRN.logScreenViewPageName(currentRoute.current);
86
- } else if (Platform.OS === "android") {
87
- TLTRN.logScreenLayout(currentRoute.current);
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
- {children}
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.current.getCurrentRoute()?.params;
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 || "";
@@ -1,59 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'json'
3
-
4
- #--------------------------------------------------------------------------------------------
5
- # Copyright (C) 2025 Acoustic, L.P. All rights reserved.
6
- #
7
- # NOTICE: This file contains material that is confidential and proprietary to
8
- # Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
9
- # industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
10
- # Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
11
- # prohibited.
12
- #--------------------------------------------------------------------------------------------
13
-
14
- pods_root = ARGV[0]
15
- config_file = ARGV[1]
16
- lib_root = ARGV[2]
17
-
18
- begin
19
- puts "*********Build_Config.rb*********"
20
- puts "Pods root:#{pods_root}"
21
- puts "Config file:#{config_file}"
22
- puts "Lib root:#{lib_root}"
23
- puts "**********************************"
24
- config_path = "#{pods_root}/../../#{config_file}"
25
- if !File.exist?(config_path)
26
- config_path = "#{pods_root}/../#{config_file}"
27
- lib_root = "#{pods_root}/../#{lib_root}"
28
- end
29
-
30
- if File.exist?(config_path)
31
- puts "Read from ConnectConfig.json at:#{config_path}"
32
- json = JSON.parse(File.read(config_path))
33
- puts JSON.pretty_generate(json)
34
- else
35
- puts "ConnectConfig.json does not exist at:#{config_path}"
36
- exit
37
- end
38
-
39
- libConfigPath = "#{lib_root}/ios/ConnectConfig.json"
40
- if File.exist?(libConfigPath)
41
- puts "Read from ConnectConfig.json at:#{libConfigPath}"
42
- libConfig = File.read(libConfigPath)
43
- puts libConfig
44
-
45
- File.open(libConfigPath, 'w') do |f|
46
- f.write(JSON.pretty_generate(json))
47
- end
48
-
49
- libConfig = File.read(libConfigPath)
50
- puts "Update #{libConfigPath} to"
51
- puts "#{libConfig}"
52
- else
53
- puts "ConnectConfig.json does not exist at:#{libConfigPath}"
54
- exit
55
- end
56
-
57
- rescue Errno::ENOENT
58
- exit
59
- end