react-native-acoustic-connect-beta 18.0.13 → 18.0.15

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 (98) hide show
  1. package/Examples/SampleUI/.detoxrc.js +83 -0
  2. package/Examples/SampleUI/ConnectConfig.json +2 -2
  3. package/Examples/SampleUI/android/app/build.gradle +3 -0
  4. package/Examples/SampleUI/android/app/src/main/java/com/sampleui/MainActivity.kt +0 -35
  5. package/Examples/SampleUI/android/settings.gradle +1 -1
  6. package/Examples/SampleUI/package.json +8 -6
  7. package/Examples/SampleUI/scripts/integration-test-android.sh +292 -0
  8. package/Examples/SampleUI/src/Examples/DialogExample.tsx +88 -2
  9. package/Examples/SampleUI/src/Examples/Dialogs/DialogTrackingTest.tsx +307 -0
  10. package/Examples/SampleUI/src/Examples/Dialogs/index.tsx +37 -0
  11. package/Examples/SampleUI/src/index.native.tsx +5 -5
  12. package/android/build.gradle +2 -2
  13. package/android/src/main/assets/ConnectAdvancedConfig.json +1 -1
  14. package/android/src/main/assets/TealeafAdvancedConfig.json +1 -1
  15. package/android/src/main/java/com/acousticconnectrn/HybridAcousticConnectRN.kt +787 -490
  16. package/ios/HybridAcousticConnectRN.swift +79 -4
  17. package/lib/commonjs/TLTRN.js +69 -0
  18. package/lib/commonjs/TLTRN.js.map +1 -1
  19. package/lib/commonjs/components/Connect.js +31 -29
  20. package/lib/commonjs/components/Connect.js.map +1 -1
  21. package/lib/commonjs/docs/DialogTracking.md +252 -0
  22. package/lib/commonjs/docs/NativeImplementation.md +176 -0
  23. package/lib/commonjs/examples/DialogTrackingExample.js +175 -0
  24. package/lib/commonjs/examples/DialogTrackingExample.js.map +1 -0
  25. package/lib/commonjs/examples/HOCDialogExample.js +296 -0
  26. package/lib/commonjs/examples/HOCDialogExample.js.map +1 -0
  27. package/lib/commonjs/index.js +28 -0
  28. package/lib/commonjs/index.js.map +1 -1
  29. package/lib/commonjs/utils/DialogDebugger.js +216 -0
  30. package/lib/commonjs/utils/DialogDebugger.js.map +1 -0
  31. package/lib/commonjs/utils/DialogListener.js +203 -0
  32. package/lib/commonjs/utils/DialogListener.js.map +1 -0
  33. package/lib/commonjs/utils/useDialogTracking.js +107 -0
  34. package/lib/commonjs/utils/useDialogTracking.js.map +1 -0
  35. package/lib/commonjs/utils/withAcousticAutoDialog.js +282 -0
  36. package/lib/commonjs/utils/withAcousticAutoDialog.js.map +1 -0
  37. package/lib/module/TLTRN.js +69 -0
  38. package/lib/module/TLTRN.js.map +1 -1
  39. package/lib/module/components/Connect.js +32 -31
  40. package/lib/module/components/Connect.js.map +1 -1
  41. package/lib/module/docs/DialogTracking.md +252 -0
  42. package/lib/module/docs/NativeImplementation.md +176 -0
  43. package/lib/module/examples/DialogTrackingExample.js +172 -0
  44. package/lib/module/examples/DialogTrackingExample.js.map +1 -0
  45. package/lib/module/examples/HOCDialogExample.js +292 -0
  46. package/lib/module/examples/HOCDialogExample.js.map +1 -0
  47. package/lib/module/index.js +5 -1
  48. package/lib/module/index.js.map +1 -1
  49. package/lib/module/utils/DialogDebugger.js +211 -0
  50. package/lib/module/utils/DialogDebugger.js.map +1 -0
  51. package/lib/module/utils/DialogListener.js +199 -0
  52. package/lib/module/utils/DialogListener.js.map +1 -0
  53. package/lib/module/utils/useDialogTracking.js +102 -0
  54. package/lib/module/utils/useDialogTracking.js.map +1 -0
  55. package/lib/module/utils/withAcousticAutoDialog.js +275 -0
  56. package/lib/module/utils/withAcousticAutoDialog.js.map +1 -0
  57. package/lib/typescript/src/TLTRN.d.ts +7 -0
  58. package/lib/typescript/src/TLTRN.d.ts.map +1 -1
  59. package/lib/typescript/src/components/Connect.d.ts +2 -2
  60. package/lib/typescript/src/components/Connect.d.ts.map +1 -1
  61. package/lib/typescript/src/examples/DialogTrackingExample.d.ts +17 -0
  62. package/lib/typescript/src/examples/DialogTrackingExample.d.ts.map +1 -0
  63. package/lib/typescript/src/examples/HOCDialogExample.d.ts +21 -0
  64. package/lib/typescript/src/examples/HOCDialogExample.d.ts.map +1 -0
  65. package/lib/typescript/src/index.d.ts +5 -1
  66. package/lib/typescript/src/index.d.ts.map +1 -1
  67. package/lib/typescript/src/specs/react-native-acoustic-connect.nitro.d.ts +4 -0
  68. package/lib/typescript/src/specs/react-native-acoustic-connect.nitro.d.ts.map +1 -1
  69. package/lib/typescript/src/utils/DialogDebugger.d.ts +58 -0
  70. package/lib/typescript/src/utils/DialogDebugger.d.ts.map +1 -0
  71. package/lib/typescript/src/utils/DialogListener.d.ts +85 -0
  72. package/lib/typescript/src/utils/DialogListener.d.ts.map +1 -0
  73. package/lib/typescript/src/utils/useDialogTracking.d.ts +25 -0
  74. package/lib/typescript/src/utils/useDialogTracking.d.ts.map +1 -0
  75. package/lib/typescript/src/utils/withAcousticAutoDialog.d.ts +37 -0
  76. package/lib/typescript/src/utils/withAcousticAutoDialog.d.ts.map +1 -0
  77. package/nitrogen/generated/android/c++/JHybridAcousticConnectRNSpec.cpp +26 -0
  78. package/nitrogen/generated/android/c++/JHybridAcousticConnectRNSpec.hpp +4 -0
  79. package/nitrogen/generated/android/kotlin/com/margelo/nitro/acousticconnectrn/HybridAcousticConnectRNSpec.kt +16 -0
  80. package/nitrogen/generated/ios/c++/HybridAcousticConnectRNSpecSwift.hpp +32 -0
  81. package/nitrogen/generated/ios/swift/HybridAcousticConnectRNSpec.swift +4 -0
  82. package/nitrogen/generated/ios/swift/HybridAcousticConnectRNSpec_cxx.swift +71 -0
  83. package/nitrogen/generated/shared/c++/HybridAcousticConnectRNSpec.cpp +4 -0
  84. package/nitrogen/generated/shared/c++/HybridAcousticConnectRNSpec.hpp +4 -0
  85. package/package.json +1 -1
  86. package/scripts/ConnectConfig.json +1 -1
  87. package/src/TLTRN.ts +75 -0
  88. package/src/components/Connect.tsx +92 -101
  89. package/src/docs/DialogTracking.md +252 -0
  90. package/src/docs/NativeImplementation.md +176 -0
  91. package/src/examples/DialogTrackingExample.tsx +163 -0
  92. package/src/examples/HOCDialogExample.tsx +253 -0
  93. package/src/index.ts +5 -1
  94. package/src/specs/react-native-acoustic-connect.nitro.ts +5 -0
  95. package/src/utils/DialogDebugger.ts +224 -0
  96. package/src/utils/DialogListener.ts +238 -0
  97. package/src/utils/useDialogTracking.ts +102 -0
  98. package/src/utils/withAcousticAutoDialog.tsx +312 -0
@@ -9,6 +9,18 @@ Object.defineProperty(exports, "Connect", {
9
9
  return _Connect.default;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "DialogDebugger", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _DialogDebugger.default;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "DialogListener", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _DialogListener.default;
22
+ }
23
+ });
12
24
  Object.defineProperty(exports, "KeyboardListener", {
13
25
  enumerable: true,
14
26
  get: function () {
@@ -22,9 +34,25 @@ Object.defineProperty(exports, "TLTRN", {
22
34
  }
23
35
  });
24
36
  exports.default = void 0;
37
+ Object.defineProperty(exports, "useDialogTracking", {
38
+ enumerable: true,
39
+ get: function () {
40
+ return _useDialogTracking.default;
41
+ }
42
+ });
43
+ Object.defineProperty(exports, "withAcousticAutoDialog", {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _withAcousticAutoDialog.withAcousticAutoDialog;
47
+ }
48
+ });
25
49
  var _reactNativeNitroModules = require("react-native-nitro-modules");
26
50
  var _Connect = _interopRequireDefault(require("./components/Connect"));
27
51
  var _KeyboardListener = _interopRequireDefault(require("./utils/KeyboardListener"));
52
+ var _DialogListener = _interopRequireDefault(require("./utils/DialogListener"));
53
+ var _useDialogTracking = _interopRequireDefault(require("./utils/useDialogTracking"));
54
+ var _withAcousticAutoDialog = require("./utils/withAcousticAutoDialog");
55
+ var _DialogDebugger = _interopRequireDefault(require("./utils/DialogDebugger"));
28
56
  var _TLTRN = _interopRequireDefault(require("./TLTRN"));
29
57
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
30
58
  /********************************************************************************************
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNativeNitroModules","require","_Connect","_interopRequireDefault","_KeyboardListener","_TLTRN","e","__esModule","default","AcousticConnectRN","NitroModules","createHybridObject","_default","exports"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAAA,wBAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF,OAAA;AAA2B,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAjB3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,MAAMG,iBAAiB,GAAGC,qCAAY,CAACC,kBAAkB,CAAwB,mBAAmB,CAAC;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAL,OAAA,GAGtFC,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["_reactNativeNitroModules","require","_Connect","_interopRequireDefault","_KeyboardListener","_DialogListener","_useDialogTracking","_withAcousticAutoDialog","_DialogDebugger","_TLTRN","e","__esModule","default","AcousticConnectRN","NitroModules","createHybridObject","_default","exports"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAAA,wBAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,eAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,kBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,uBAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,MAAA,GAAAN,sBAAA,CAAAF,OAAA;AAA2B,SAAAE,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AArB3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA,MAAMG,iBAAiB,GAAGC,qCAAY,CAACC,kBAAkB,CAAwB,mBAAmB,CAAC;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAL,OAAA,GAGtFC,iBAAiB","ignoreList":[]}
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.DialogDebugger = void 0;
7
+ var _reactNative = require("react-native");
8
+ var _DialogListener = _interopRequireDefault(require("./DialogListener"));
9
+ var _TLTRN = _interopRequireDefault(require("../TLTRN"));
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ /********************************************************************************************
12
+ * Copyright (C) 2025 Acoustic, L.P. All rights reserved.
13
+ *
14
+ * NOTICE: This file contains material that is confidential and proprietary to
15
+ * Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
16
+ * industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
17
+ * Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
18
+ * prohibited.
19
+ ********************************************************************************************/
20
+
21
+ /**
22
+ * Debug utility for dialog event tracking
23
+ * Helps identify issues with dialog event interception and logging
24
+ */
25
+ class DialogDebugger {
26
+ isEnabled = false;
27
+ constructor() {
28
+ this.originalAlert = _reactNative.Alert.alert;
29
+ }
30
+ static getInstance() {
31
+ if (!DialogDebugger.instance) {
32
+ DialogDebugger.instance = new DialogDebugger();
33
+ }
34
+ return DialogDebugger.instance;
35
+ }
36
+
37
+ /**
38
+ * Enable debug mode
39
+ */
40
+ enable() {
41
+ this.isEnabled = true;
42
+ console.log('🔍 DialogDebugger: Debug mode enabled');
43
+ }
44
+
45
+ /**
46
+ * Disable debug mode
47
+ */
48
+ disable() {
49
+ this.isEnabled = false;
50
+ console.log('🔍 DialogDebugger: Debug mode disabled');
51
+ }
52
+
53
+ /**
54
+ * Test the complete dialog event flow
55
+ */
56
+ testDialogEventFlow() {
57
+ console.log('🔍 DialogDebugger: Testing dialog event flow...');
58
+
59
+ // Test 1: Check if DialogListener is working
60
+ this.testDialogListener();
61
+
62
+ // Test 2: Check if TLTRN methods are accessible
63
+ this.testTLTRNMethods();
64
+
65
+ // Test 3: Check if Alert.alert override is working
66
+ this.testAlertOverride();
67
+
68
+ // Test 4: Test native method calls
69
+ this.testNativeMethods();
70
+ }
71
+
72
+ /**
73
+ * Test DialogListener functionality
74
+ */
75
+ testDialogListener() {
76
+ console.log('🔍 DialogDebugger: Testing DialogListener...');
77
+ try {
78
+ const dialogListener = _DialogListener.default.getInstance();
79
+ console.log('✅ DialogListener.getInstance() - SUCCESS');
80
+
81
+ // Test event listener
82
+ const unsubscribe = dialogListener.addEventListener(event => {
83
+ console.log('🔍 DialogDebugger: DialogListener event received:', event);
84
+ });
85
+ console.log('✅ DialogListener.addEventListener() - SUCCESS');
86
+
87
+ // Test manual tracking
88
+ dialogListener.trackCustomDialogShow('test-dialog-id', 'Test Dialog', []);
89
+ console.log('✅ DialogListener.trackCustomDialogShow() - SUCCESS');
90
+ unsubscribe();
91
+ } catch (error) {
92
+ console.error('❌ DialogDebugger: DialogListener test failed:', error);
93
+ }
94
+ }
95
+
96
+ /**
97
+ * Test TLTRN methods
98
+ */
99
+ testTLTRNMethods() {
100
+ console.log('🔍 DialogDebugger: Testing TLTRN methods...');
101
+ try {
102
+ // Test if TLTRN methods exist
103
+ if (typeof _TLTRN.default.logDialogShowEvent === 'function') {
104
+ console.log('✅ TLTRN.logDialogShowEvent - EXISTS');
105
+ } else {
106
+ console.error('❌ TLTRN.logDialogShowEvent - NOT FOUND');
107
+ }
108
+ if (typeof _TLTRN.default.interceptDialogEvents === 'function') {
109
+ console.log('✅ TLTRN.interceptDialogEvents - EXISTS');
110
+ } else {
111
+ console.error('❌ TLTRN.interceptDialogEvents - NOT FOUND');
112
+ }
113
+
114
+ // Test method call
115
+ _TLTRN.default.logDialogShowEvent('test-dialog-id', 'Test Dialog', 'test');
116
+ console.log('✅ TLTRN.logDialogShowEvent() - CALLED');
117
+ } catch (error) {
118
+ console.error('❌ DialogDebugger: TLTRN test failed:', error);
119
+ }
120
+ }
121
+
122
+ /**
123
+ * Test Alert.alert override
124
+ */
125
+ testAlertOverride() {
126
+ console.log('🔍 DialogDebugger: Testing Alert.alert override...');
127
+ try {
128
+ // Check if Alert.alert is overridden
129
+ if (_reactNative.Alert.alert !== this.originalAlert) {
130
+ console.log('✅ Alert.alert is overridden');
131
+ } else {
132
+ console.error('❌ Alert.alert is NOT overridden');
133
+ }
134
+
135
+ // Test Alert.alert call
136
+ _reactNative.Alert.alert('Debug Test', 'This is a test alert', [{
137
+ text: 'OK',
138
+ onPress: () => console.log('🔍 DialogDebugger: Alert OK pressed')
139
+ }]);
140
+ console.log('✅ Alert.alert() - CALLED');
141
+ } catch (error) {
142
+ console.error('❌ DialogDebugger: Alert.alert test failed:', error);
143
+ }
144
+ }
145
+
146
+ /**
147
+ * Test native method calls
148
+ */
149
+ testNativeMethods() {
150
+ console.log('🔍 DialogDebugger: Testing native method calls...');
151
+ try {
152
+ // Import AcousticConnectRN to test native calls
153
+ const AcousticConnectRN = require('../index').default;
154
+ if (AcousticConnectRN && typeof AcousticConnectRN.logDialogShowEvent === 'function') {
155
+ console.log('✅ AcousticConnectRN.logDialogShowEvent - EXISTS');
156
+
157
+ // Test native call
158
+ const result = AcousticConnectRN.logDialogShowEvent('test-dialog-id', 'Test Dialog', 'test');
159
+ console.log('✅ AcousticConnectRN.logDialogShowEvent() - CALLED, result:', result);
160
+ } else {
161
+ console.error('❌ AcousticConnectRN.logDialogShowEvent - NOT FOUND');
162
+ }
163
+ } catch (error) {
164
+ console.error('❌ DialogDebugger: Native method test failed:', error);
165
+ }
166
+ }
167
+
168
+ /**
169
+ * Check if dialog tracking is properly enabled
170
+ */
171
+ checkDialogTrackingStatus() {
172
+ console.log('🔍 DialogDebugger: Checking dialog tracking status...');
173
+
174
+ // Check DialogListener status
175
+ const dialogListener = _DialogListener.default.getInstance();
176
+ console.log('DialogListener status:', {
177
+ isIntercepting: dialogListener.isIntercepting,
178
+ eventCallbacksCount: dialogListener.eventCallbacks?.length || 0
179
+ });
180
+
181
+ // Check if Alert.alert is overridden
182
+ console.log('Alert.alert override status:', {
183
+ isOverridden: _reactNative.Alert.alert !== this.originalAlert,
184
+ originalAlert: this.originalAlert,
185
+ currentAlert: _reactNative.Alert.alert
186
+ });
187
+
188
+ // Check TLTRN methods
189
+ console.log('TLTRN methods status:', {
190
+ logDialogShowEvent: typeof _TLTRN.default.logDialogShowEvent,
191
+ interceptDialogEvents: typeof _TLTRN.default.interceptDialogEvents
192
+ });
193
+ }
194
+
195
+ /**
196
+ * Force enable dialog tracking for testing
197
+ */
198
+ forceEnableDialogTracking() {
199
+ console.log('🔍 DialogDebugger: Force enabling dialog tracking...');
200
+ try {
201
+ // Force enable DialogListener
202
+ const dialogListener = _DialogListener.default.getInstance();
203
+ dialogListener.isIntercepting = true;
204
+ console.log('✅ DialogListener interception forced enabled');
205
+
206
+ // Force enable TLTRN dialog events
207
+ _TLTRN.default.interceptDialogEvents(true);
208
+ console.log('✅ TLTRN dialog events forced enabled');
209
+ } catch (error) {
210
+ console.error('❌ DialogDebugger: Force enable failed:', error);
211
+ }
212
+ }
213
+ }
214
+ exports.DialogDebugger = DialogDebugger;
215
+ var _default = exports.default = DialogDebugger;
216
+ //# sourceMappingURL=DialogDebugger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_DialogListener","_interopRequireDefault","_TLTRN","e","__esModule","default","DialogDebugger","isEnabled","constructor","originalAlert","Alert","alert","getInstance","instance","enable","console","log","disable","testDialogEventFlow","testDialogListener","testTLTRNMethods","testAlertOverride","testNativeMethods","dialogListener","DialogListener","unsubscribe","addEventListener","event","trackCustomDialogShow","error","TLTRN","logDialogShowEvent","interceptDialogEvents","text","onPress","AcousticConnectRN","result","checkDialogTrackingStatus","isIntercepting","eventCallbacksCount","eventCallbacks","length","isOverridden","currentAlert","forceEnableDialogTracking","exports","_default"],"sourceRoot":"../../../src","sources":["utils/DialogDebugger.ts"],"mappings":";;;;;;AAUA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAD,sBAAA,CAAAF,OAAA;AAA6B,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAZ7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACO,MAAMG,cAAc,CAAC;EAEhBC,SAAS,GAAY,KAAK;EAG1BC,WAAWA,CAAA,EAAG;IAClB,IAAI,CAACC,aAAa,GAAGC,kBAAK,CAACC,KAAK;EACpC;EAEA,OAAOC,WAAWA,CAAA,EAAmB;IACjC,IAAI,CAACN,cAAc,CAACO,QAAQ,EAAE;MAC1BP,cAAc,CAACO,QAAQ,GAAG,IAAIP,cAAc,CAAC,CAAC;IAClD;IACA,OAAOA,cAAc,CAACO,QAAQ;EAClC;;EAEA;AACJ;AACA;EACIC,MAAMA,CAAA,EAAS;IACX,IAAI,CAACP,SAAS,GAAG,IAAI;IACrBQ,OAAO,CAACC,GAAG,CAAC,uCAAuC,CAAC;EACxD;;EAEA;AACJ;AACA;EACIC,OAAOA,CAAA,EAAS;IACZ,IAAI,CAACV,SAAS,GAAG,KAAK;IACtBQ,OAAO,CAACC,GAAG,CAAC,wCAAwC,CAAC;EACzD;;EAEA;AACJ;AACA;EACIE,mBAAmBA,CAAA,EAAS;IACxBH,OAAO,CAACC,GAAG,CAAC,iDAAiD,CAAC;;IAE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ClDW,cAAc,CAASe,cAAc,GAAG,IAAI;MAC7CvB,OAAO,CAACC,GAAG,CAAC,8CAA8C,CAAC;;MAE3D;MACAc,cAAK,CAACE,qBAAqB,CAAC,IAAI,CAAC;MACjCjB,OAAO,CAACC,GAAG,CAAC,sCAAsC,CAAC;IAEvD,CAAC,CAAC,OAAOa,KAAK,EAAE;MACZd,OAAO,CAACc,KAAK,CAAC,wCAAwC,EAAEA,KAAK,CAAC;IAClE;EACJ;AACJ;AAACgB,OAAA,CAAAvC,cAAA,GAAAA,cAAA;AAAA,IAAAwC,QAAA,GAAAD,OAAA,CAAAxC,OAAA,GAEcC,cAAc","ignoreList":[]}
@@ -0,0 +1,203 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactNative = require("react-native");
8
+ /********************************************************************************************
9
+ * Copyright (C) 2025 Acoustic, L.P. All rights reserved.
10
+ *
11
+ * NOTICE: This file contains material that is confidential and proprietary to
12
+ * Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
13
+ * industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
14
+ * Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
15
+ * prohibited.
16
+ ********************************************************************************************/
17
+
18
+ // Simple ID generator
19
+ function generateId() {
20
+ return Math.random().toString(36).substr(2, 9) + Date.now().toString(36);
21
+ }
22
+ class DialogListener {
23
+ activeDialogs = new Map();
24
+ isIntercepting = false;
25
+ eventCallbacks = [];
26
+ constructor() {
27
+ this.originalAlert = _reactNative.Alert.alert;
28
+ this.interceptAlertAPI();
29
+ }
30
+ static getInstance() {
31
+ if (!DialogListener.instance) {
32
+ DialogListener.instance = new DialogListener();
33
+ }
34
+ return DialogListener.instance;
35
+ }
36
+
37
+ /**
38
+ * Start intercepting dialog events
39
+ */
40
+ startIntercepting() {
41
+ if (this.isIntercepting) return;
42
+ this.isIntercepting = true;
43
+ console.log('DialogListener: Started intercepting dialog events');
44
+ }
45
+
46
+ /**
47
+ * Stop intercepting dialog events
48
+ */
49
+ stopIntercepting() {
50
+ if (!this.isIntercepting) return;
51
+ this.isIntercepting = false;
52
+ console.log('DialogListener: Stopped intercepting dialog events');
53
+ }
54
+
55
+ /**
56
+ * Add event callback for dialog events
57
+ */
58
+ addEventListener(callback) {
59
+ this.eventCallbacks.push(callback);
60
+ return () => {
61
+ const index = this.eventCallbacks.indexOf(callback);
62
+ if (index > -1) {
63
+ this.eventCallbacks.splice(index, 1);
64
+ }
65
+ };
66
+ }
67
+
68
+ /**
69
+ * Intercept React Native's Alert.alert API
70
+ */
71
+ interceptAlertAPI() {
72
+ const self = this;
73
+ _reactNative.Alert.alert = function (title, message, buttons, options) {
74
+ if (self.isIntercepting) {
75
+ const dialogId = generateId();
76
+ const dialogEvent = {
77
+ dialogId,
78
+ dialogTitle: title,
79
+ dialogType: 'alert',
80
+ timestamp: Date.now(),
81
+ buttons: buttons || []
82
+ };
83
+ self.activeDialogs.set(dialogId, dialogEvent);
84
+ self.emitEvent(dialogEvent);
85
+
86
+ // Create wrapped buttons that log events
87
+ const wrappedButtons = buttons?.map((button, index) => ({
88
+ ...button,
89
+ onPress: () => {
90
+ const buttonClickEvent = {
91
+ dialogId,
92
+ buttonText: button.text || '',
93
+ buttonIndex: index,
94
+ timestamp: Date.now()
95
+ };
96
+ self.emitEvent(buttonClickEvent);
97
+ self.activeDialogs.delete(dialogId);
98
+
99
+ // Call original onPress if it exists
100
+ if (button.onPress) {
101
+ button.onPress();
102
+ }
103
+ }
104
+ }));
105
+
106
+ // Call original Alert.alert with wrapped buttons
107
+ self.originalAlert.call(_reactNative.Alert, title, message, wrappedButtons, options);
108
+ } else {
109
+ // Call original Alert.alert without interception
110
+ self.originalAlert.call(_reactNative.Alert, title, message, buttons, options);
111
+ }
112
+ };
113
+ }
114
+
115
+ /**
116
+ * Manually track custom dialog show event
117
+ */
118
+ trackCustomDialogShow(dialogId, title, buttons) {
119
+ if (!this.isIntercepting) return;
120
+ const dialogEvent = {
121
+ dialogId,
122
+ dialogTitle: title,
123
+ dialogType: 'custom',
124
+ timestamp: Date.now(),
125
+ buttons: buttons || []
126
+ };
127
+ this.activeDialogs.set(dialogId, dialogEvent);
128
+ this.emitEvent(dialogEvent);
129
+ }
130
+
131
+ /**
132
+ * Manually track custom dialog dismiss event
133
+ */
134
+ trackCustomDialogDismiss(dialogId, reason = 'manual') {
135
+ if (!this.isIntercepting) return;
136
+ const dialogEvent = this.activeDialogs.get(dialogId);
137
+ if (dialogEvent) {
138
+ this.activeDialogs.delete(dialogId);
139
+ // Emit proper dismiss event
140
+ const dismissEvent = {
141
+ dialogId,
142
+ dialogTitle: dialogEvent.dialogTitle,
143
+ dialogType: dialogEvent.dialogType,
144
+ dismissReason: reason,
145
+ timestamp: Date.now()
146
+ };
147
+ this.emitEvent(dismissEvent);
148
+
149
+ // Log the dismiss reason for debugging
150
+ console.log(`Dialog ${dialogId} dismissed with reason: ${reason}`);
151
+ }
152
+ }
153
+
154
+ /**
155
+ * Manually track custom dialog button click event
156
+ */
157
+ trackCustomDialogButtonClick(dialogId, buttonText, buttonIndex) {
158
+ if (!this.isIntercepting) return;
159
+ const buttonClickEvent = {
160
+ dialogId,
161
+ buttonText,
162
+ buttonIndex,
163
+ timestamp: Date.now()
164
+ };
165
+ this.emitEvent(buttonClickEvent);
166
+ }
167
+
168
+ /**
169
+ * Get currently active dialogs
170
+ */
171
+ getActiveDialogs() {
172
+ return Array.from(this.activeDialogs.values());
173
+ }
174
+
175
+ /**
176
+ * Clear all active dialogs
177
+ */
178
+ clearActiveDialogs() {
179
+ this.activeDialogs.clear();
180
+ }
181
+
182
+ /**
183
+ * Emit event to all registered callbacks
184
+ */
185
+ emitEvent(event) {
186
+ this.eventCallbacks.forEach(callback => {
187
+ try {
188
+ callback(event);
189
+ } catch (error) {
190
+ console.error('DialogListener: Error in event callback:', error);
191
+ }
192
+ });
193
+ }
194
+
195
+ /**
196
+ * Restore original Alert.alert API
197
+ */
198
+ restoreOriginalAlert() {
199
+ _reactNative.Alert.alert = this.originalAlert;
200
+ }
201
+ }
202
+ var _default = exports.default = DialogListener;
203
+ //# sourceMappingURL=DialogListener.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","generateId","Math","random","toString","substr","Date","now","DialogListener","activeDialogs","Map","isIntercepting","eventCallbacks","constructor","originalAlert","Alert","alert","interceptAlertAPI","getInstance","instance","startIntercepting","console","log","stopIntercepting","addEventListener","callback","push","index","indexOf","splice","self","title","message","buttons","options","dialogId","dialogEvent","dialogTitle","dialogType","timestamp","set","emitEvent","wrappedButtons","map","button","onPress","buttonClickEvent","buttonText","text","buttonIndex","delete","call","trackCustomDialogShow","trackCustomDialogDismiss","reason","get","dismissEvent","dismissReason","trackCustomDialogButtonClick","getActiveDialogs","Array","from","values","clearActiveDialogs","clear","event","forEach","error","restoreOriginalAlert","_default","exports","default"],"sourceRoot":"../../../src","sources":["utils/DialogListener.ts"],"mappings":";;;;;;AAUA,IAAAA,YAAA,GAAAC,OAAA;AAVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA4BA;AACA,SAASC,UAAUA,CAAA,EAAW;EAC1B,OAAOC,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,CAACH,QAAQ,CAAC,EAAE,CAAC;AAC5E;AAEA,MAAMI,cAAc,CAAC;EAETC,aAAa,GAA6B,IAAIC,GAAG,CAAC,CAAC;EAEnDC,cAAc,GAAY,KAAK;EAC/BC,cAAc,GAAsF,EAAE;EAEtGC,WAAWA,CAAA,EAAG;IAClB,IAAI,CAACC,aAAa,GAAGC,kBAAK,CAACC,KAAK;IAChC,IAAI,CAACC,iBAAiB,CAAC,CAAC;EAC5B;EAEA,OAAOC,WAAWA,CAAA,EAAmB;IACjC,IAAI,CAACV,cAAc,CA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,MAAM,CAAC,CAAC,CAAC;EAClD;;EAEA;AACJ;AACA;EACIC,kBAAkBA,CAAA,EAAS;IACvB,IAAI,CAACtD,aAAa,CAACuD,KAAK,CAAC,CAAC;EAC9B;;EAEA;AACJ;AACA;EACYvB,SAASA,CAACwB,KAAgE,EAAQ;IACtF,IAAI,CAACrD,cAAc,CAACsD,OAAO,CAACzC,QAAQ,IAAI;MACpC,IAAI;QACAA,QAAQ,CAACwC,KAAK,CAAC;MACnB,CAAC,CAAC,OAAOE,KAAK,EAAE;QACZ9C,OAAO,CAAC8C,KAAK,CAAC,0CAA0C,EAAEA,KAAK,CAAC;MACpE;IACJ,CAAC,CAAC;EACN;;EAEA;AACJ;AACA;EACIC,oBAAoBA,CAAA,EAAS;IACzBrD,kBAAK,CAACC,KAAK,GAAG,IAAI,CAACF,aAAa;EACpC;AACJ;AAAC,IAAAuD,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc/D,cAAc","ignoreList":[]}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useDialogTracking = exports.default = void 0;
7
+ var _react = require("react");
8
+ var _DialogListener = _interopRequireDefault(require("./DialogListener"));
9
+ var _TLTRN = _interopRequireDefault(require("../TLTRN"));
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ /********************************************************************************************
12
+ * Copyright (C) 2025 Acoustic, L.P. All rights reserved.
13
+ *
14
+ * NOTICE: This file contains material that is confidential and proprietary to
15
+ * Acoustic, L.P. and/or other developers. No license is granted under any intellectual or
16
+ * industrial property rights of Acoustic, L.P. except as may be provided in an agreement with
17
+ * Acoustic, L.P. Any unauthorized copying or distribution of content from this file is
18
+ * prohibited.
19
+ ********************************************************************************************/
20
+
21
+ /**
22
+ * React hook for tracking custom dialog events
23
+ * Provides utilities to track dialog show, dismiss, and button click events
24
+ */
25
+ const useDialogTracking = () => {
26
+ const dialogIds = (0, _react.useRef)(new Set());
27
+
28
+ /**
29
+ * Generate a unique dialog ID
30
+ */
31
+ const generateDialogId = (0, _react.useCallback)(() => {
32
+ const id = Math.random().toString(36).substr(2, 9) + Date.now().toString(36);
33
+ dialogIds.current.add(id);
34
+ return id;
35
+ }, []);
36
+
37
+ /**
38
+ * Track a custom dialog show event
39
+ */
40
+ const trackDialogShow = (0, _react.useCallback)((dialogId, title, buttons) => {
41
+ _DialogListener.default.getInstance().trackCustomDialogShow(dialogId, title, buttons);
42
+ // Note: The actual native call is handled by the DialogListener event system
43
+ // No need to call TLTRN.logDialogShowEvent directly here
44
+ }, []);
45
+
46
+ /**
47
+ * Track a custom dialog dismiss event
48
+ */
49
+ const trackDialogDismiss = (0, _react.useCallback)((dialogId, reason = 'manual') => {
50
+ _DialogListener.default.getInstance().trackCustomDialogDismiss(dialogId, reason);
51
+ // Note: The actual native call is handled by the DialogListener event system
52
+ // No need to call TLTRN.logDialogDismissEvent directly here
53
+ }, []);
54
+
55
+ /**
56
+ * Track a custom dialog button click event
57
+ */
58
+ const trackDialogButtonClick = (0, _react.useCallback)((dialogId, buttonText, buttonIndex) => {
59
+ _DialogListener.default.getInstance().trackCustomDialogButtonClick(dialogId, buttonText, buttonIndex);
60
+ // Note: The actual native call is handled by the DialogListener event system
61
+ // No need to call TLTRN.logDialogButtonClickEvent directly here
62
+ }, []);
63
+
64
+ /**
65
+ * Track a custom dialog event
66
+ */
67
+ const trackDialogCustomEvent = (0, _react.useCallback)((dialogId, eventName, values) => {
68
+ _TLTRN.default.logDialogCustomEvent(dialogId, eventName, values);
69
+ }, []);
70
+
71
+ /**
72
+ * Create a wrapped button with automatic tracking
73
+ */
74
+ const createTrackedButton = (0, _react.useCallback)((dialogId, button, buttonIndex) => {
75
+ return {
76
+ ...button,
77
+ onPress: () => {
78
+ // Track the button click
79
+ trackDialogButtonClick(dialogId, button.text || '', buttonIndex);
80
+
81
+ // Call the original onPress if it exists
82
+ if (button.onPress) {
83
+ button.onPress();
84
+ }
85
+ }
86
+ };
87
+ }, [trackDialogButtonClick]);
88
+
89
+ /**
90
+ * Clean up dialog tracking
91
+ */
92
+ const cleanup = (0, _react.useCallback)(() => {
93
+ dialogIds.current.clear();
94
+ }, []);
95
+ return {
96
+ generateDialogId,
97
+ trackDialogShow,
98
+ trackDialogDismiss,
99
+ trackDialogButtonClick,
100
+ trackDialogCustomEvent,
101
+ createTrackedButton,
102
+ cleanup
103
+ };
104
+ };
105
+ exports.useDialogTracking = useDialogTracking;
106
+ var _default = exports.default = useDialogTracking;
107
+ //# sourceMappingURL=useDialogTracking.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_DialogListener","_interopRequireDefault","_TLTRN","e","__esModule","default","useDialogTracking","dialogIds","useRef","Set","generateDialogId","useCallback","id","Math","random","toString","substr","Date","now","current","add","trackDialogShow","dialogId","title","buttons","DialogListener","getInstance","trackCustomDialogShow","trackDialogDismiss","reason","trackCustomDialogDismiss","trackDialogButtonClick","buttonText","buttonIndex","trackCustomDialogButtonClick","trackDialogCustomEvent","eventName","values","TLTRN","logDialogCustomEvent","createTrackedButton","button","onPress","text","cleanup","clear","exports","_default"],"sourceRoot":"../../../src","sources":["utils/useDialogTracking.ts"],"mappings":";;;;;;AAUA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAD,sBAAA,CAAAF,OAAA;AAA6B,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAb7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACO,MAAMG,iBAAiB,GAAGA,CAAA,KAAM;EACnC,MAAMC,SAAS,GAAG,IAAAC,aAAM,EAAc,IAAIC,GAAG,CAAC,CAAC,CAAC;;EAEhD;AACJ;AACA;EACI,MAAMC,gBAAgB,GAAG,IA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