@testernest/react-native 0.1.1 → 0.1.4

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 (139) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +64 -54
  3. package/android/gradle.properties +3 -3
  4. package/dist/index.js +20 -0
  5. package/dist/native.d.ts +14 -0
  6. package/dist/native.js +48 -0
  7. package/dist/testernestConnectPrompt.d.ts +13 -0
  8. package/dist/testernestConnectPrompt.js +165 -0
  9. package/package.json +35 -9
  10. package/android/build/.transforms/8ce4b91dc8d15c015a4e81859b96eec6/results.bin +0 -1
  11. package/android/build/.transforms/8ce4b91dc8d15c015a4e81859b96eec6/transformed/classes/classes.dex +0 -0
  12. package/android/build/generated/source/buildConfig/debug/com/testernest/reactnative/BuildConfig.java +0 -10
  13. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -7
  14. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -18
  15. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -5
  16. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
  17. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  18. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  19. package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -1986
  20. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -1
  21. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
  22. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
  23. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
  24. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
  25. package/android/build/intermediates/javac/debug/classes/com/testernest/reactnative/BuildConfig.class +0 -0
  26. package/android/build/intermediates/library_java_res/debug/res.jar +0 -0
  27. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -2
  28. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -8
  29. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +0 -7
  30. package/android/build/intermediates/navigation_json/debug/navigation.json +0 -1
  31. package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +0 -18
  32. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  33. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1479
  34. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  35. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  36. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  37. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  38. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  39. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  40. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  41. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  42. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  43. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  44. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  45. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  46. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  47. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  48. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  49. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  50. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  51. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  52. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  53. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  54. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  55. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
  56. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
  57. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
  58. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
  59. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
  60. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
  61. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len +0 -0
  62. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  63. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  64. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  65. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  66. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  67. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  68. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  69. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab +0 -0
  70. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream +0 -0
  71. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.keystream.len +0 -0
  72. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.len +0 -0
  73. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab.values.at +0 -0
  74. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i +0 -0
  75. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/java-sources-proto-map.tab_i.len +0 -0
  76. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  77. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  78. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  79. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  80. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  81. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  82. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  83. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  84. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  85. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  86. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  87. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  88. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  89. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  90. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  91. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  92. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  93. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  94. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  95. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  96. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  97. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  98. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  99. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  100. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  101. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  102. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  103. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  104. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +0 -2
  105. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  106. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  107. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  108. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  109. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  110. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  111. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  112. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  113. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  114. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  115. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  116. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  117. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  118. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  119. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  120. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  121. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  122. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  123. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  124. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  125. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  126. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  127. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  128. package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -25
  129. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  130. package/android/build/tmp/kotlin-classes/debug/META-INF/react-native-testernest_debug.kotlin_module +0 -0
  131. package/android/build/tmp/kotlin-classes/debug/com/testernest/reactnative/TesternestModule$Companion.class +0 -0
  132. package/android/build/tmp/kotlin-classes/debug/com/testernest/reactnative/TesternestModule$logClaimResultAsync$poll$1.class +0 -0
  133. package/android/build/tmp/kotlin-classes/debug/com/testernest/reactnative/TesternestModule$redactTokens$1.class +0 -0
  134. package/android/build/tmp/kotlin-classes/debug/com/testernest/reactnative/TesternestModule$redactTokens$2.class +0 -0
  135. package/android/build/tmp/kotlin-classes/debug/com/testernest/reactnative/TesternestModule.class +0 -0
  136. package/android/build/tmp/kotlin-classes/debug/com/testernest/reactnative/TesternestPackage.class +0 -0
  137. package/src/native.ts +0 -69
  138. package/src/testernestConnectPrompt.tsx +0 -173
  139. /package/{src/index.ts → dist/index.d.ts} +0 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hari Bhaskaran
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,86 +1,100 @@
1
1
  # @testernest/react-native
2
2
 
3
- React Native bridge for the Testernest Android SDK.
3
+ React Native bridge for the TesterNest Android SDK.
4
4
 
5
- Only 6-digit connect is supported (no claim token).
5
+ Android-only for now. iOS is not supported yet.
6
6
 
7
7
  ## Install
8
8
 
9
- ```sh
10
- yarn add @testernest/react-native
9
+ ```bash
10
+ npm i @testernest/react-native
11
11
  ```
12
12
 
13
- ## Windows quick test
14
-
15
- 1) From `react-native-testernest/`, run `RN_TEST_RUNBOOK.cmd`.
16
- 2) When it prompts, enter the 6-digit code in the app and wait for log capture to finish.
17
- 3) Run `RN_TEST_VERIFY.cmd` to check for BOOTSTRAP/BATCH/CLAIM 200 in `_evidence/rn_logcat_live.txt`.
18
-
19
- ### Android setup (Maven Central)
20
-
21
- 1) Ensure `google()` + `mavenCentral()` are in your Android repositories (project or settings).
22
- 2) Install the package and rebuild the app.
23
-
24
- Verify (Windows CMD):
25
-
26
- ```bat
27
- adb logcat -v time | findstr /i "TesternestRN Testernest BOOTSTRAP BATCH CLAIM HTTP AndroidRuntime ReactNativeJS"
13
+ ```bash
14
+ yarn add @testernest/react-native
28
15
  ```
29
16
 
30
- ## Android Quickstart (RN)
31
-
32
- 1) Set your public key in `react-native-testernest/example/src/App.js` (`PUBLIC_KEY`).
33
- 2) Run `RN_TEST_RUNBOOK.cmd` from the repo root.
34
- 3) On the phone, tap "Init SDK", then tap "Show Connect Prompt" (if it does not auto-show).
35
- 4) Enter the 6-digit code in the prompt and watch logcat for BOOTSTRAP/BATCH/CLAIM lines.
36
-
37
- Windows CMD logcat filter:
38
-
39
- ```bat
40
- adb logcat -v time | findstr /i "TesternestRN Testernest BOOTSTRAP BATCH CLAIM HTTP AndroidRuntime ReactNativeJS"
41
- ```
17
+ Ensure `google()` and `mavenCentral()` are present in your Android repositories.
42
18
 
43
- ## Usage
19
+ ## Quickstart
44
20
 
45
- ```ts
21
+ ```tsx
46
22
  import {
47
23
  init,
48
24
  track,
49
25
  flush,
50
26
  setCurrentScreen,
51
27
  connectTester,
52
- disconnectTester,
53
- getDebugSnapshot,
54
28
  TesternestConnectPrompt,
55
29
  } from '@testernest/react-native';
56
30
 
57
31
  await init({
58
32
  publicKey: 'YOUR_PUBLIC_KEY',
59
- baseUrl: 'https://myappcrew-tw.pages.dev',
33
+ baseUrl: 'https://testernest.com',
60
34
  enableLogs: true,
61
35
  });
62
36
 
63
37
  track('signup_start', { plan: 'pro' });
64
38
  setCurrentScreen('Checkout');
65
- await connectTester('123456');
39
+ await connectTester('123456'); // 6-digit code only
66
40
  await flush();
67
- const snapshot = await getDebugSnapshot();
68
- await disconnectTester();
69
41
  ```
70
42
 
71
- Auto connect prompt (1-line integration):
43
+ Render the prompt once near app root:
72
44
 
73
45
  ```tsx
74
46
  <TesternestConnectPrompt
75
47
  publicKey="YOUR_PUBLIC_KEY"
76
- baseUrl="https://myappcrew-tw.pages.dev"
48
+ baseUrl="https://testernest.com"
77
49
  />
78
50
  ```
79
51
 
80
- ## Troubleshooting
52
+ ## Screen Tracking (React Navigation)
53
+
54
+ ```tsx
55
+ import { NavigationContainer, createNavigationContainerRef } from '@react-navigation/native';
56
+ import { setCurrentScreen } from '@testernest/react-native';
57
+ import React, { useRef } from 'react';
58
+
59
+ const navigationRef = createNavigationContainerRef();
60
+
61
+ export function AppNavigation() {
62
+ const routeNameRef = useRef<string | undefined>();
63
+
64
+ return (
65
+ <NavigationContainer
66
+ onReady={() => {
67
+ // Set initial screen name
68
+ routeNameRef.current = navigationRef.getCurrentRoute()?.name;
69
+ if (routeNameRef.current) setCurrentScreen(routeNameRef.current);
70
+ }}
71
+ onStateChange={() => {
72
+ // Keep SDK screen context in sync with navigation
73
+ const currentRouteName = navigationRef.getCurrentRoute()?.name;
74
+ if (currentRouteName && routeNameRef.current !== currentRouteName) {
75
+ routeNameRef.current = currentRouteName;
76
+ setCurrentScreen(currentRouteName);
77
+ }
78
+ }}
79
+ ref={navigationRef}
80
+ >
81
+ {/* app screens */}
82
+ </NavigationContainer>
83
+ );
84
+ }
85
+ ```
86
+
87
+ ## Verify
88
+
89
+ Windows CMD:
90
+
91
+ ```bat
92
+ adb logcat -v time | findstr /i "TesternestRN Testernest BOOTSTRAP BATCH CLAIM HTTP AndroidRuntime ReactNativeJS"
93
+ ```
94
+
95
+ ## Security Note
81
96
 
82
- - White screen: run `RN_TEST_RUNBOOK.cmd`, ensure Metro is running, and check `AndroidRuntime`/`ReactNativeJS` in logcat.
83
- - Unable to connect: verify `baseUrl`/`publicKey` match the dashboard app, regenerate the 6-digit code, and retry.
97
+ Never commit real `publicKey` values or production endpoints in examples, docs, screenshots, or test fixtures.
84
98
 
85
99
  ## API
86
100
 
@@ -94,15 +108,11 @@ Auto connect prompt (1-line integration):
94
108
  - `isConnected(): Promise<boolean>`
95
109
  - `TesternestConnectPrompt`
96
110
 
97
- ## Build
111
+ ## Local Package Commands
98
112
 
99
- ```sh
100
- cd android
101
- ./gradlew assembleRelease
113
+ ```bash
114
+ npm run clean
115
+ npm run build
116
+ npm pack --dry-run
117
+ npm publish --dry-run --access public
102
118
  ```
103
-
104
- ## Publish checklist
105
-
106
- 1) `npm login`
107
- 2) `npm publish --access public`
108
- 3) `git tag vX.Y.Z`
@@ -1,3 +1,3 @@
1
- android.useAndroidX=true
2
- android.enableJetifier=true
3
- TESTERNEST_ANDROID_VERSION=0.1.2
1
+ android.useAndroidX=true
2
+ android.enableJetifier=true
3
+ TESTERNEST_ANDROID_VERSION=0.1.3
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.TesternestConnectPrompt = void 0;
18
+ __exportStar(require("./native"), exports);
19
+ var testernestConnectPrompt_1 = require("./testernestConnectPrompt");
20
+ Object.defineProperty(exports, "TesternestConnectPrompt", { enumerable: true, get: function () { return testernestConnectPrompt_1.TesternestConnectPrompt; } });
@@ -0,0 +1,14 @@
1
+ export type InitOptions = {
2
+ publicKey: string;
3
+ baseUrl?: string;
4
+ enableLogs?: boolean;
5
+ };
6
+ export type DebugSnapshot = Record<string, any>;
7
+ export declare function init(options: InitOptions): Promise<void>;
8
+ export declare function track(name: string, properties?: Record<string, any>): void;
9
+ export declare function flush(): Promise<void>;
10
+ export declare function setCurrentScreen(screen: string | null): void;
11
+ export declare function connectTester(code6: string): Promise<void>;
12
+ export declare function disconnectTester(): Promise<void>;
13
+ export declare function getDebugSnapshot(): Promise<DebugSnapshot>;
14
+ export declare function isConnected(): Promise<boolean>;
package/dist/native.js ADDED
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.init = init;
4
+ exports.track = track;
5
+ exports.flush = flush;
6
+ exports.setCurrentScreen = setCurrentScreen;
7
+ exports.connectTester = connectTester;
8
+ exports.disconnectTester = disconnectTester;
9
+ exports.getDebugSnapshot = getDebugSnapshot;
10
+ exports.isConnected = isConnected;
11
+ const react_native_1 = require("react-native");
12
+ const LINKING_ERROR = `The package '@testernest/react-native' doesn't seem to be linked. Make sure: \n\n` +
13
+ react_native_1.Platform.select({
14
+ ios: "- You have run 'pod install'\n",
15
+ default: '- You have rebuilt the app after installing the package\n',
16
+ }) +
17
+ '- You are not using Expo Go\n';
18
+ const Testernest = react_native_1.NativeModules.Testernest;
19
+ function getModule() {
20
+ if (!Testernest) {
21
+ throw new Error(LINKING_ERROR);
22
+ }
23
+ return Testernest;
24
+ }
25
+ function init(options) {
26
+ return getModule().init(options);
27
+ }
28
+ function track(name, properties) {
29
+ getModule().track(name, properties !== null && properties !== void 0 ? properties : null);
30
+ }
31
+ function flush() {
32
+ return getModule().flush();
33
+ }
34
+ function setCurrentScreen(screen) {
35
+ getModule().setCurrentScreen(screen);
36
+ }
37
+ function connectTester(code6) {
38
+ return getModule().connectTester(code6);
39
+ }
40
+ function disconnectTester() {
41
+ return getModule().disconnectTester();
42
+ }
43
+ function getDebugSnapshot() {
44
+ return getModule().getDebugSnapshot();
45
+ }
46
+ function isConnected() {
47
+ return getModule().isConnected();
48
+ }
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export type TesternestConnectPromptProps = {
3
+ publicKey: string;
4
+ baseUrl?: string;
5
+ enableLogs?: boolean;
6
+ title?: string;
7
+ subtitle?: string;
8
+ appName?: string;
9
+ showSkipButton?: boolean;
10
+ autoInit?: boolean;
11
+ forceVisibleToken?: number;
12
+ };
13
+ export declare function TesternestConnectPrompt({ publicKey, baseUrl, enableLogs, title, subtitle, appName, showSkipButton, autoInit, forceVisibleToken, }: TesternestConnectPromptProps): React.JSX.Element;
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.TesternestConnectPrompt = TesternestConnectPrompt;
37
+ const react_1 = __importStar(require("react"));
38
+ const react_native_1 = require("react-native");
39
+ const native_1 = require("./native");
40
+ const styles = react_native_1.StyleSheet.create({
41
+ backdrop: { flex: 1, backgroundColor: 'rgba(0,0,0,0.4)', justifyContent: 'center', padding: 24 },
42
+ card: { backgroundColor: '#fff7ec', borderRadius: 16, padding: 20 },
43
+ title: { fontSize: 20, fontWeight: '700', color: '#1f1b16' },
44
+ subtitle: { marginTop: 8, fontSize: 14, color: '#4b3f35' },
45
+ appName: { marginTop: 6, fontSize: 14, fontWeight: '600', color: '#4b3f35' },
46
+ input: {
47
+ marginTop: 16,
48
+ borderWidth: 1,
49
+ borderColor: '#d4c2ae',
50
+ borderRadius: 10,
51
+ padding: 10,
52
+ backgroundColor: '#fff',
53
+ },
54
+ error: { marginTop: 8, color: '#b00020', fontSize: 13 },
55
+ buttonRow: { flexDirection: 'row', marginTop: 16 },
56
+ skipButton: { flex: 1, marginRight: 8, padding: 12, borderRadius: 10, backgroundColor: '#efe0d1' },
57
+ skipText: { textAlign: 'center', color: '#4b3f35', fontWeight: '600' },
58
+ connectButton: { flex: 1, marginLeft: 8, padding: 12, borderRadius: 10, backgroundColor: '#1f6d5f' },
59
+ connectText: { textAlign: 'center', color: '#fff', fontWeight: '700' },
60
+ });
61
+ function TesternestConnectPrompt({ publicKey, baseUrl, enableLogs = false, title = 'Connect Tester', subtitle = 'Enter your 6-digit code to connect.', appName, showSkipButton = true, autoInit = true, forceVisibleToken, }) {
62
+ const [visible, setVisible] = (0, react_1.useState)(false);
63
+ const [code, setCode] = (0, react_1.useState)('');
64
+ const [error, setError] = (0, react_1.useState)(null);
65
+ const [connecting, setConnecting] = (0, react_1.useState)(false);
66
+ const dismissedRef = (0, react_1.useRef)(false);
67
+ const isSixDigit = (0, react_1.useMemo)(() => /^\d{6}$/.test(code.trim()), [code]);
68
+ (0, react_1.useEffect)(() => {
69
+ dismissedRef.current = false;
70
+ }, [publicKey, baseUrl]);
71
+ (0, react_1.useEffect)(() => {
72
+ let active = true;
73
+ if (!autoInit || !publicKey) {
74
+ return undefined;
75
+ }
76
+ (async () => {
77
+ try {
78
+ await (0, native_1.init)({ publicKey, baseUrl, enableLogs });
79
+ const connected = await (0, native_1.isConnected)();
80
+ if (active && !connected && !dismissedRef.current) {
81
+ setVisible(true);
82
+ }
83
+ }
84
+ catch (e) {
85
+ if (active) {
86
+ setError(e instanceof Error ? e.message : String(e));
87
+ setVisible(true);
88
+ }
89
+ }
90
+ })();
91
+ return () => {
92
+ active = false;
93
+ };
94
+ }, [publicKey, baseUrl, enableLogs, autoInit]);
95
+ (0, react_1.useEffect)(() => {
96
+ if (!forceVisibleToken || forceVisibleToken <= 0) {
97
+ return;
98
+ }
99
+ dismissedRef.current = false;
100
+ setError(null);
101
+ setCode('');
102
+ setVisible(true);
103
+ }, [forceVisibleToken]);
104
+ const handleSkip = () => {
105
+ dismissedRef.current = true;
106
+ setVisible(false);
107
+ };
108
+ const pollConnected = () => {
109
+ const startedAt = Date.now();
110
+ const interval = setInterval(async () => {
111
+ try {
112
+ const connected = await (0, native_1.isConnected)();
113
+ if (connected) {
114
+ clearInterval(interval);
115
+ dismissedRef.current = true;
116
+ setVisible(false);
117
+ setConnecting(false);
118
+ return;
119
+ }
120
+ }
121
+ catch (e) {
122
+ clearInterval(interval);
123
+ setConnecting(false);
124
+ setError(e instanceof Error ? e.message : String(e));
125
+ return;
126
+ }
127
+ if (Date.now() - startedAt > 8000) {
128
+ clearInterval(interval);
129
+ setConnecting(false);
130
+ setError('Unable to connect. Check the code and try again.');
131
+ }
132
+ }, 400);
133
+ };
134
+ const handleConnect = async () => {
135
+ if (connecting)
136
+ return;
137
+ if (!isSixDigit) {
138
+ setError('Enter a 6-digit code.');
139
+ return;
140
+ }
141
+ setError(null);
142
+ setConnecting(true);
143
+ try {
144
+ await (0, native_1.connectTester)(code.trim());
145
+ pollConnected();
146
+ }
147
+ catch (e) {
148
+ setConnecting(false);
149
+ setError(e instanceof Error ? e.message : String(e));
150
+ }
151
+ };
152
+ return (react_1.default.createElement(react_native_1.Modal, { transparent: true, visible: visible, animationType: "fade", onRequestClose: handleSkip },
153
+ react_1.default.createElement(react_native_1.View, { style: styles.backdrop },
154
+ react_1.default.createElement(react_native_1.View, { style: styles.card },
155
+ react_1.default.createElement(react_native_1.Text, { style: styles.title }, title),
156
+ subtitle ? react_1.default.createElement(react_native_1.Text, { style: styles.subtitle }, subtitle) : null,
157
+ appName ? react_1.default.createElement(react_native_1.Text, { style: styles.appName }, appName) : null,
158
+ react_1.default.createElement(react_native_1.TextInput, { style: styles.input, value: code, onChangeText: setCode, placeholder: "123456", keyboardType: "number-pad" }),
159
+ error ? react_1.default.createElement(react_native_1.Text, { style: styles.error }, error) : null,
160
+ react_1.default.createElement(react_native_1.View, { style: styles.buttonRow },
161
+ showSkipButton ? (react_1.default.createElement(react_native_1.TouchableOpacity, { style: styles.skipButton, onPress: handleSkip },
162
+ react_1.default.createElement(react_native_1.Text, { style: styles.skipText }, "Not now"))) : null,
163
+ react_1.default.createElement(react_native_1.TouchableOpacity, { style: styles.connectButton, onPress: handleConnect },
164
+ react_1.default.createElement(react_native_1.Text, { style: styles.connectText }, connecting ? 'Connecting...' : 'Connect')))))));
165
+ }
package/package.json CHANGED
@@ -1,30 +1,56 @@
1
1
  {
2
2
  "name": "@testernest/react-native",
3
- "version": "0.1.1",
3
+ "version": "0.1.4",
4
4
  "description": "React Native bridge for Testernest Android SDK",
5
- "main": "src/index.ts",
6
- "react-native": "src/index.ts",
7
- "types": "src/index.ts",
5
+ "main": "dist/index.js",
6
+ "react-native": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
8
14
  "files": [
15
+ "dist",
9
16
  "android",
10
- "src",
11
17
  "react-native.config.js",
12
- "README.md"
18
+ "README.md",
19
+ "LICENSE"
13
20
  ],
14
21
  "scripts": {
22
+ "clean": "node -e \"const fs=require('fs');['dist','android/build'].forEach(p=>fs.rmSync(p,{recursive:true,force:true}));\"",
15
23
  "build": "tsc -p tsconfig.json",
24
+ "prepack": "npm run clean && npm run build",
25
+ "test": "echo \"No tests configured\"",
16
26
  "android:build": "cd android && ./gradlew assembleRelease"
17
27
  },
28
+ "license": "MIT",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/harifreelancer88/testernest-sdk.git",
32
+ "directory": "react-native-testernest"
33
+ },
34
+ "homepage": "https://github.com/harifreelancer88/testernest-sdk/tree/main/react-native-testernest",
35
+ "bugs": {
36
+ "url": "https://github.com/harifreelancer88/testernest-sdk/issues"
37
+ },
18
38
  "keywords": [
19
39
  "react-native",
20
40
  "android",
21
- "testernest"
41
+ "testernest",
42
+ "analytics",
43
+ "mobile-sdk"
22
44
  ],
45
+ "author": "TesterNest",
23
46
  "peerDependencies": {
24
47
  "react": "*",
25
48
  "react-native": ">=0.60"
26
- },
49
+ },
27
50
  "devDependencies": {
51
+ "@types/react": "^18.2.66",
52
+ "react": "18.2.0",
53
+ "react-native": "0.72.6",
28
54
  "typescript": "^5.4.2"
29
55
  }
30
- }
56
+ }
@@ -1,10 +0,0 @@
1
- /**
2
- * Automatically generated file. DO NOT MODIFY
3
- */
4
- package com.testernest.reactnative;
5
-
6
- public final class BuildConfig {
7
- public static final boolean DEBUG = Boolean.parseBoolean("true");
8
- public static final String LIBRARY_PACKAGE_NAME = "com.testernest.reactnative";
9
- public static final String BUILD_TYPE = "debug";
10
- }
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
- package="com.testernest.reactnative" >
4
-
5
- <uses-sdk android:minSdkVersion="21" />
6
-
7
- </manifest>
@@ -1,18 +0,0 @@
1
- {
2
- "version": 3,
3
- "artifactType": {
4
- "type": "AAPT_FRIENDLY_MERGED_MANIFESTS",
5
- "kind": "Directory"
6
- },
7
- "applicationId": "com.testernest.reactnative",
8
- "variantName": "debug",
9
- "elements": [
10
- {
11
- "type": "SINGLE",
12
- "filters": [],
13
- "attributes": [],
14
- "outputFile": "AndroidManifest.xml"
15
- }
16
- ],
17
- "elementType": "File"
18
- }
@@ -1,5 +0,0 @@
1
- aarFormatVersion=1.0
2
- aarMetadataVersion=1.0
3
- minCompileSdk=1
4
- minCompileSdkExtension=0
5
- minAndroidGradlePluginVersion=1.0.0