@dashx/react-native 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/android/build/.transforms/9dceace6c3787533d2dbb1a387e9284c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/DashXReactNativeModule.dex +0 -0
- package/android/build/.transforms/9dceace6c3787533d2dbb1a387e9284c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/ReactNativeLibraryInfoProvider.dex +0 -0
- package/android/build/.transforms/9dceace6c3787533d2dbb1a387e9284c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/util/Utils.dex +0 -0
- package/android/build/.transforms/f3c6049e7ab4bb564c79f3a246b8575e/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/java_res/debug/processDebugJavaRes/out/META-INF/services/com.dashx.android.DashXLibraryInfoProvider +1 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/dashx/rn/sdk/DashXReactNativeModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/dashx/rn/sdk/ReactNativeLibraryInfoProvider.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/dashx/rn/sdk/util/Utils.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +1 -1
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/dashx/rn/sdk/DashXReactNativeModule.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/dashx/rn/sdk/ReactNativeLibraryInfoProvider.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/com/dashx/rn/sdk/util/Utils.class +0 -0
- package/android/build.gradle +3 -4
- package/android/src/main/java/com/dashx/rn/sdk/DashXReactNativeModule.kt +13 -4
- package/android/src/main/java/com/dashx/rn/sdk/ReactNativeLibraryInfoProvider.kt +8 -0
- package/android/src/main/resources/META-INF/services/com.dashx.android.DashXLibraryInfoProvider +1 -0
- package/index.d.ts +92 -0
- package/index.js +104 -63
- package/package.json +5 -10
- package/yarn.lock +1555 -2562
- package/ContentOptionsBuilder.js +0 -62
- package/android/build/.transforms/103e3bf16f310520880af8bd348f4f94/results.bin +0 -1
- package/android/build/.transforms/103e3bf16f310520880af8bd348f4f94/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/results.bin +0 -1
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/BuildConfig.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/DashXPackage.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/DashXReactNativeModule.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/util/ArrayUtil$1.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/util/ArrayUtil.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/util/MapUtil$1.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/util/MapUtil.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/util/Utils$WhenMappings.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/dashx/rn/sdk/util/Utils.dex +0 -0
- package/android/build/.transforms/1a91a107d670af17a51b8ccf1674f99e/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
- package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
- package/utils/RestAPIClient.js +0 -154
- package/utils.js +0 -21
package/README.md
CHANGED
|
@@ -232,6 +232,22 @@ Unsubscribe:
|
|
|
232
232
|
DashX.unsubscribe();
|
|
233
233
|
```
|
|
234
234
|
|
|
235
|
+
### Listen for incoming messages
|
|
236
|
+
|
|
237
|
+
Register a listener to handle push notifications when they arrive:
|
|
238
|
+
|
|
239
|
+
```js
|
|
240
|
+
import { useEffect } from 'react';
|
|
241
|
+
|
|
242
|
+
useEffect(() => {
|
|
243
|
+
const subscription = DashX.onMessageReceived((message) => {
|
|
244
|
+
console.log('Notification received:', message);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
return () => subscription.remove();
|
|
248
|
+
}, []);
|
|
249
|
+
```
|
|
250
|
+
|
|
235
251
|
### Notification preferences
|
|
236
252
|
|
|
237
253
|
Fetch the user's stored notification preferences:
|
|
@@ -323,6 +339,7 @@ const styles = StyleSheet.create({
|
|
|
323
339
|
| `fetchStoredPreferences` | `()` | `Promise<object>` | Fetch stored notification preferences |
|
|
324
340
|
| `saveStoredPreferences` | `(data: object)` | `Promise<object>` | Save notification preferences |
|
|
325
341
|
| `setLogLevel` | `(level: number)` | `void` | Set SDK log verbosity |
|
|
342
|
+
| `onMessageReceived` | `(callback: function)` | `EmitterSubscription` | Listen for incoming push notifications |
|
|
326
343
|
|
|
327
344
|
For detailed usage and advanced features, refer to the [DashX documentation](https://docs.dashx.com/developer).
|
|
328
345
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
#
|
|
1
|
+
#Tue Mar 17 06:39:15 IST 2026
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
com.dashx.rn.sdk.ReactNativeLibraryInfoProvider
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i
CHANGED
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len
CHANGED
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i
CHANGED
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i
CHANGED
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
4
|
|
2
2
|
0
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len
CHANGED
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/tmp/kotlin-classes/debug/com/dashx/rn/sdk/DashXReactNativeModule.class
CHANGED
|
Binary file
|
package/android/build/tmp/kotlin-classes/debug/com/dashx/rn/sdk/ReactNativeLibraryInfoProvider.class
ADDED
|
Binary file
|
|
Binary file
|
package/android/build.gradle
CHANGED
|
@@ -48,10 +48,9 @@ repositories {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
dependencies {
|
|
51
|
-
|
|
52
|
-
implementation 'com.facebook.react:react-native:+'
|
|
51
|
+
compileOnly 'com.facebook.react:react-android:+'
|
|
53
52
|
implementation 'com.google.code.gson:gson:2.9.0'
|
|
54
|
-
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.
|
|
53
|
+
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0'
|
|
55
54
|
|
|
56
|
-
implementation "com.dashx:dashx-android:1.1.
|
|
55
|
+
implementation "com.dashx:dashx-android:1.1.3"
|
|
57
56
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
package com.dashx.rn.sdk
|
|
2
2
|
|
|
3
|
-
import android.net.Uri
|
|
4
3
|
import com.dashx.rn.sdk.util.*
|
|
5
4
|
import com.dashx.android.DashX
|
|
6
5
|
import com.dashx.android.DashXLog
|
|
@@ -37,7 +36,9 @@ class DashXReactNativeModule(private val reactContext: ReactApplicationContext)
|
|
|
37
36
|
@ReactMethod
|
|
38
37
|
fun identify(options: ReadableMap?) {
|
|
39
38
|
val optionsHashMap = options?.toHashMap()
|
|
40
|
-
|
|
39
|
+
?.filterValues { it != null }
|
|
40
|
+
?.mapValues { it.value.toString() }
|
|
41
|
+
DashX.identify(optionsHashMap?.let { HashMap(it) })
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
@ReactMethod
|
|
@@ -53,7 +54,10 @@ class DashXReactNativeModule(private val reactContext: ReactApplicationContext)
|
|
|
53
54
|
@ReactMethod
|
|
54
55
|
fun track(event: String, data: ReadableMap?) {
|
|
55
56
|
val jsonData = try {
|
|
56
|
-
data?.toHashMap()
|
|
57
|
+
data?.toHashMap()
|
|
58
|
+
?.filterValues { it != null }
|
|
59
|
+
?.mapValues { it.value.toString() }
|
|
60
|
+
?.let { HashMap(it) }
|
|
57
61
|
} catch (e: Exception) {
|
|
58
62
|
DashXLog.d(tag, e.message)
|
|
59
63
|
return
|
|
@@ -64,7 +68,12 @@ class DashXReactNativeModule(private val reactContext: ReactApplicationContext)
|
|
|
64
68
|
|
|
65
69
|
@ReactMethod
|
|
66
70
|
fun screen(screenName: String, data: ReadableMap?) {
|
|
67
|
-
|
|
71
|
+
val screenData = data?.toHashMap()
|
|
72
|
+
?.filterValues { it != null }
|
|
73
|
+
?.mapValues { it.value.toString() }
|
|
74
|
+
?.let { HashMap(it) }
|
|
75
|
+
?: HashMap()
|
|
76
|
+
DashX.screen(screenName, screenData)
|
|
68
77
|
}
|
|
69
78
|
|
|
70
79
|
@ReactMethod
|
package/android/src/main/resources/META-INF/services/com.dashx.android.DashXLibraryInfoProvider
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
com.dashx.rn.sdk.ReactNativeLibraryInfoProvider
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { EmitterSubscription } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export interface ConfigureOptions {
|
|
4
|
+
publicKey: string;
|
|
5
|
+
baseURI?: string;
|
|
6
|
+
targetEnvironment?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface IdentifyOptions {
|
|
10
|
+
firstName?: string;
|
|
11
|
+
lastName?: string;
|
|
12
|
+
email?: string;
|
|
13
|
+
phone?: string;
|
|
14
|
+
[key: string]: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type LogLevel = 0 | 1 | 2;
|
|
18
|
+
|
|
19
|
+
export interface NotificationMessage {
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface DashXInstance {
|
|
24
|
+
/**
|
|
25
|
+
* Initialize the SDK with your public key and optional configuration.
|
|
26
|
+
* Call this as early as possible, e.g. in your root component.
|
|
27
|
+
*/
|
|
28
|
+
configure(options: ConfigureOptions): void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Identify the current user with traits such as name and email.
|
|
32
|
+
*/
|
|
33
|
+
identify(options: IdentifyOptions): void;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Set user identity using a UID and authentication token.
|
|
37
|
+
*/
|
|
38
|
+
setIdentity(uid: string, token: string): void;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Clear the current user identity and reset SDK state.
|
|
42
|
+
*/
|
|
43
|
+
reset(): void;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Track a named event with optional metadata.
|
|
47
|
+
*/
|
|
48
|
+
track(event: string, data?: Record<string, unknown>): void;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Track a screen view with optional metadata.
|
|
52
|
+
*/
|
|
53
|
+
screen(screenName: string, data?: Record<string, unknown>): void;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Subscribe the current device to push notifications.
|
|
57
|
+
*/
|
|
58
|
+
subscribe(): void;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Unsubscribe the current device from push notifications.
|
|
62
|
+
*/
|
|
63
|
+
unsubscribe(): void;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Fetch stored notification preferences for the current user.
|
|
67
|
+
*/
|
|
68
|
+
fetchStoredPreferences(): Promise<Record<string, unknown>>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Save notification preferences for the current user.
|
|
72
|
+
*/
|
|
73
|
+
saveStoredPreferences(
|
|
74
|
+
data: Record<string, unknown>
|
|
75
|
+
): Promise<Record<string, unknown>>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Set SDK log verbosity. 0 = off, 1 = errors, 2 = debug.
|
|
79
|
+
*/
|
|
80
|
+
setLogLevel(level: LogLevel): void;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Register a listener for incoming push notification messages.
|
|
84
|
+
* Returns a subscription that can be removed via `.remove()`.
|
|
85
|
+
*/
|
|
86
|
+
onMessageReceived(
|
|
87
|
+
callback: (message: NotificationMessage) => void
|
|
88
|
+
): EmitterSubscription;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
declare const DashX: DashXInstance;
|
|
92
|
+
export default DashX;
|
package/index.js
CHANGED
|
@@ -1,78 +1,119 @@
|
|
|
1
|
-
import { NativeModules, Platform } from 'react-native';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const DashX = NativeModules.DashXReactNative
|
|
10
|
-
? NativeModules.DashXReactNative
|
|
11
|
-
: new Proxy(
|
|
12
|
-
{},
|
|
13
|
-
{
|
|
14
|
-
get() {
|
|
15
|
-
throw new Error(LINKING_ERROR);
|
|
16
|
-
},
|
|
17
|
-
}
|
|
1
|
+
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
function getLinkingError() {
|
|
4
|
+
return (
|
|
5
|
+
`The package 'dashx-react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
6
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
7
|
+
'- You rebuilt the app after installing the package\n' +
|
|
8
|
+
'- You are not using Expo Go\n'
|
|
18
9
|
);
|
|
10
|
+
}
|
|
19
11
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return configure(options);
|
|
12
|
+
let _nativeDashX = null;
|
|
13
|
+
function getNativeDashX() {
|
|
14
|
+
if (!_nativeDashX) {
|
|
15
|
+
_nativeDashX = NativeModules.DashXReactNative
|
|
16
|
+
? NativeModules.DashXReactNative
|
|
17
|
+
: new Proxy(
|
|
18
|
+
{},
|
|
19
|
+
{
|
|
20
|
+
get() {
|
|
21
|
+
throw new Error(getLinkingError());
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
return _nativeDashX;
|
|
36
27
|
}
|
|
37
28
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
let _eventEmitter = null;
|
|
30
|
+
function getEventEmitter() {
|
|
31
|
+
if (!_eventEmitter) {
|
|
32
|
+
_eventEmitter = new NativeEventEmitter(getNativeDashX());
|
|
33
|
+
}
|
|
34
|
+
return _eventEmitter;
|
|
35
|
+
}
|
|
41
36
|
|
|
42
|
-
DashX
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
const DashX = {
|
|
38
|
+
configure(options) {
|
|
39
|
+
if (!options || typeof options !== 'object') {
|
|
40
|
+
throw new Error('DashX.configure: options must be an object');
|
|
41
|
+
}
|
|
42
|
+
if (!options.publicKey || typeof options.publicKey !== 'string') {
|
|
43
|
+
throw new Error('DashX.configure: publicKey is required and must be a string');
|
|
44
|
+
}
|
|
45
|
+
return getNativeDashX().configure(options);
|
|
46
|
+
},
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
identify(options) {
|
|
49
|
+
if (!options || typeof options !== 'object') {
|
|
50
|
+
throw new Error('DashX.identify: options must be an object');
|
|
51
|
+
}
|
|
52
|
+
return getNativeDashX().identify(options);
|
|
53
|
+
},
|
|
49
54
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
setIdentity(uid, token) {
|
|
56
|
+
if (!uid || typeof uid !== 'string') {
|
|
57
|
+
throw new Error('DashX.setIdentity: uid is required and must be a string');
|
|
58
|
+
}
|
|
59
|
+
if (!token || typeof token !== 'string') {
|
|
60
|
+
throw new Error('DashX.setIdentity: token is required and must be a string');
|
|
61
|
+
}
|
|
62
|
+
return getNativeDashX().setIdentity(uid, token);
|
|
63
|
+
},
|
|
53
64
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
65
|
+
reset() {
|
|
66
|
+
return getNativeDashX().reset();
|
|
67
|
+
},
|
|
57
68
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
69
|
+
track(event, data) {
|
|
70
|
+
if (!event || typeof event !== 'string') {
|
|
71
|
+
throw new Error('DashX.track: event is required and must be a string');
|
|
72
|
+
}
|
|
73
|
+
return getNativeDashX().track(event, data || null);
|
|
74
|
+
},
|
|
61
75
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
76
|
+
screen(screenName, data) {
|
|
77
|
+
if (!screenName || typeof screenName !== 'string') {
|
|
78
|
+
throw new Error('DashX.screen: screenName is required and must be a string');
|
|
79
|
+
}
|
|
80
|
+
return getNativeDashX().screen(screenName, data || null);
|
|
81
|
+
},
|
|
65
82
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
83
|
+
fetchStoredPreferences() {
|
|
84
|
+
return getNativeDashX().fetchStoredPreferences();
|
|
85
|
+
},
|
|
69
86
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
87
|
+
saveStoredPreferences(preferenceData) {
|
|
88
|
+
if (!preferenceData || typeof preferenceData !== 'object') {
|
|
89
|
+
throw new Error(
|
|
90
|
+
'DashX.saveStoredPreferences: preferenceData is required and must be an object'
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
return getNativeDashX().saveStoredPreferences(preferenceData);
|
|
94
|
+
},
|
|
73
95
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
96
|
+
subscribe() {
|
|
97
|
+
return getNativeDashX().subscribe();
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
unsubscribe() {
|
|
101
|
+
return getNativeDashX().unsubscribe();
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
setLogLevel(level) {
|
|
105
|
+
if (typeof level !== 'number') {
|
|
106
|
+
throw new Error('DashX.setLogLevel: level must be a number');
|
|
107
|
+
}
|
|
108
|
+
return getNativeDashX().setLogLevel(level);
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
onMessageReceived(callback) {
|
|
112
|
+
if (typeof callback !== 'function') {
|
|
113
|
+
throw new Error('DashX.onMessageReceived: callback must be a function');
|
|
114
|
+
}
|
|
115
|
+
return getEventEmitter().addListener('messageReceived', callback);
|
|
116
|
+
},
|
|
117
|
+
};
|
|
77
118
|
|
|
78
119
|
export default DashX;
|