@capillarytech/react-native-hydra-lib 1.7.0-beta.9 → 1.8.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.
Files changed (61) hide show
  1. package/README.md +8 -438
  2. package/android/build.gradle +17 -8
  3. package/android/libs/repo/com/capillarytech/hydra-anonymous/1.10.0/hydra-anonymous-1.10.0.aar +0 -0
  4. package/android/libs/repo/com/capillarytech/hydra-anonymous/1.10.0/hydra-anonymous-1.10.0.module +114 -0
  5. package/android/libs/repo/com/capillarytech/hydra-anonymous/1.10.0/hydra-anonymous-1.10.0.pom +73 -0
  6. package/android/libs/repo/com/capillarytech/hydra-core/1.10.0/hydra-core-1.10.0.aar +0 -0
  7. package/android/libs/repo/com/capillarytech/hydra-core/1.10.0/hydra-core-1.10.0.module +195 -0
  8. package/android/libs/repo/com/capillarytech/hydra-core/1.10.0/hydra-core-1.10.0.pom +122 -0
  9. package/android/libs/repo/com/capillarytech/hydra-firebase/1.10.0/hydra-firebase-1.10.0.aar +0 -0
  10. package/android/libs/repo/com/capillarytech/hydra-firebase/1.10.0/hydra-firebase-1.10.0.module +139 -0
  11. package/android/libs/repo/com/capillarytech/hydra-firebase/1.10.0/hydra-firebase-1.10.0.pom +96 -0
  12. package/android/libs/repo/com/capillarytech/hydra-gamification/1.10.0/hydra-gamification-1.10.0.aar +0 -0
  13. package/android/libs/repo/com/capillarytech/hydra-gamification/1.10.0/hydra-gamification-1.10.0.module +114 -0
  14. package/android/libs/repo/com/capillarytech/hydra-gamification/1.10.0/hydra-gamification-1.10.0.pom +73 -0
  15. package/android/libs/repo/com/capillarytech/hydra-gamification-ui/1.10.0/hydra-gamification-ui-1.10.0.aar +0 -0
  16. package/android/libs/repo/com/capillarytech/hydra-gamification-ui/1.10.0/hydra-gamification-ui-1.10.0.module +163 -0
  17. package/android/libs/repo/com/capillarytech/hydra-gamification-ui/1.10.0/hydra-gamification-ui-1.10.0.pom +109 -0
  18. package/android/libs/repo/com/capillarytech/hydra-inapp/1.10.0/hydra-inapp-1.10.0.aar +0 -0
  19. package/android/libs/repo/com/capillarytech/hydra-inapp/1.10.0/hydra-inapp-1.10.0.module +172 -0
  20. package/android/libs/repo/com/capillarytech/hydra-inapp/1.10.0/hydra-inapp-1.10.0.pom +128 -0
  21. package/android/libs/repo/com/capillarytech/hydra-inbox-core/1.10.0/hydra-inbox-core-1.10.0.aar +0 -0
  22. package/android/libs/repo/com/capillarytech/hydra-inbox-core/1.10.0/hydra-inbox-core-1.10.0.module +111 -0
  23. package/android/libs/repo/com/capillarytech/hydra-inbox-core/1.10.0/hydra-inbox-core-1.10.0.pom +68 -0
  24. package/android/libs/repo/com/capillarytech/hydra-inbox-ui/1.10.0/hydra-inbox-ui-1.10.0.aar +0 -0
  25. package/android/libs/repo/com/capillarytech/hydra-inbox-ui/1.10.0/hydra-inbox-ui-1.10.0.module +132 -0
  26. package/android/libs/repo/com/capillarytech/hydra-inbox-ui/1.10.0/hydra-inbox-ui-1.10.0.pom +86 -0
  27. package/android/libs/repo/com/capillarytech/hydra-pushbase/1.10.0/hydra-pushbase-1.10.0.aar +0 -0
  28. package/android/libs/repo/com/capillarytech/hydra-pushbase/1.10.0/hydra-pushbase-1.10.0.module +172 -0
  29. package/android/libs/repo/com/capillarytech/hydra-pushbase/1.10.0/hydra-pushbase-1.10.0.pom +128 -0
  30. package/android/libs/repo/com/capillarytech/hydra-richnotification/1.10.0/hydra-richnotification-1.10.0.aar +0 -0
  31. package/android/libs/repo/com/capillarytech/hydra-richnotification/1.10.0/hydra-richnotification-1.10.0.module +172 -0
  32. package/android/libs/repo/com/capillarytech/hydra-richnotification/1.10.0/hydra-richnotification-1.10.0.pom +128 -0
  33. package/android/src/main/java/com/hydralib/eventemitter/HydraEventEmitter.kt +31 -1
  34. package/android/src/main/java/com/hydralib/eventemitter/HydraEventType.kt +3 -1
  35. package/android/src/main/java/com/hydralib/gamification/GamificationBannerViewManager.kt +3 -3
  36. package/android/src/main/java/com/hydralib/gamification/GamificationEmbedViewManager.kt +3 -3
  37. package/android/src/main/java/com/hydralib/gamification/GamificationLoyaltyViewManager.kt +2 -2
  38. package/android/src/main/java/com/hydralib/hydrasdk/HydraCore.kt +6 -0
  39. package/ios/EventEmitter/HydraEventType.swift +1 -0
  40. package/ios/HydraSDK/HydraSDKCore.swift +38 -0
  41. package/lib/commonjs/hydra-apis/HydraNativeEventEmitter.js +5 -0
  42. package/lib/commonjs/hydra-apis/HydraNativeEventEmitter.js.map +1 -1
  43. package/lib/commonjs/models/HydraNativeEvent.js +1 -0
  44. package/lib/commonjs/models/HydraNativeEvent.js.map +1 -1
  45. package/lib/module/hydra-apis/HydraNativeEventEmitter.js +5 -0
  46. package/lib/module/hydra-apis/HydraNativeEventEmitter.js.map +1 -1
  47. package/lib/module/models/HydraNativeEvent.js +1 -0
  48. package/lib/module/models/HydraNativeEvent.js.map +1 -1
  49. package/lib/typescript/commonjs/src/hydra-apis/HydraNativeEventEmitter.d.ts +1 -0
  50. package/lib/typescript/commonjs/src/hydra-apis/HydraNativeEventEmitter.d.ts.map +1 -1
  51. package/lib/typescript/commonjs/src/models/HydraNativeEvent.d.ts +2 -1
  52. package/lib/typescript/commonjs/src/models/HydraNativeEvent.d.ts.map +1 -1
  53. package/lib/typescript/module/src/hydra-apis/HydraNativeEventEmitter.d.ts +1 -0
  54. package/lib/typescript/module/src/hydra-apis/HydraNativeEventEmitter.d.ts.map +1 -1
  55. package/lib/typescript/module/src/models/HydraNativeEvent.d.ts +2 -1
  56. package/lib/typescript/module/src/models/HydraNativeEvent.d.ts.map +1 -1
  57. package/package.json +1 -1
  58. package/sbom.spdx.json +4 -4
  59. package/scripts/HydraPods.rb +1 -1
  60. package/src/hydra-apis/HydraNativeEventEmitter.ts +11 -0
  61. package/src/models/HydraNativeEvent.ts +1 -0
@@ -0,0 +1,128 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4
+ <!-- This module was also published with a richer model, Gradle metadata, -->
5
+ <!-- which should be used instead. Do not delete the following line which -->
6
+ <!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
7
+ <!-- that they should prefer consuming it instead. -->
8
+ <!-- do_not_remove: published-with-gradle-metadata -->
9
+ <modelVersion>4.0.0</modelVersion>
10
+ <groupId>com.capillarytech</groupId>
11
+ <artifactId>hydra-pushbase</artifactId>
12
+ <version>1.10.0</version>
13
+ <packaging>aar</packaging>
14
+ <name>hydra-pushbase</name>
15
+ <description>Capillary Hydra PushBase SDK</description>
16
+ <url>https://github.com/Capillary/hydra-sdk-android</url>
17
+ <licenses>
18
+ <license>
19
+ <name>The Apache Software License, Version 2.0</name>
20
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
21
+ </license>
22
+ </licenses>
23
+ <developers>
24
+ <developer>
25
+ <id>capillary</id>
26
+ <name>Capillary</name>
27
+ <email>support@capillarytech.com</email>
28
+ </developer>
29
+ </developers>
30
+ <dependencies>
31
+ <dependency>
32
+ <groupId>org.jetbrains.kotlin</groupId>
33
+ <artifactId>kotlin-parcelize-runtime</artifactId>
34
+ <version>1.7.0</version>
35
+ <scope>runtime</scope>
36
+ </dependency>
37
+ <dependency>
38
+ <groupId>androidx.security</groupId>
39
+ <artifactId>security-crypto</artifactId>
40
+ <version>1.1.0-alpha03</version>
41
+ <scope>runtime</scope>
42
+ </dependency>
43
+ <dependency>
44
+ <groupId>androidx.test.ext</groupId>
45
+ <artifactId>junit-ktx</artifactId>
46
+ <version>1.1.4-rc01</version>
47
+ <scope>runtime</scope>
48
+ </dependency>
49
+ <dependency>
50
+ <groupId>androidx.room</groupId>
51
+ <artifactId>room-ktx</artifactId>
52
+ <version>2.4.3</version>
53
+ <scope>runtime</scope>
54
+ </dependency>
55
+ <dependency>
56
+ <groupId>org.jetbrains.kotlinx</groupId>
57
+ <artifactId>kotlinx-datetime</artifactId>
58
+ <version>0.3.0</version>
59
+ <scope>runtime</scope>
60
+ </dependency>
61
+ <dependency>
62
+ <groupId>androidx.work</groupId>
63
+ <artifactId>work-runtime-ktx</artifactId>
64
+ <version>2.7.1</version>
65
+ <scope>runtime</scope>
66
+ </dependency>
67
+ <dependency>
68
+ <groupId>androidx.sqlite</groupId>
69
+ <artifactId>sqlite</artifactId>
70
+ <version>2.2.0</version>
71
+ <scope>runtime</scope>
72
+ </dependency>
73
+ <dependency>
74
+ <groupId>androidx.sqlite</groupId>
75
+ <artifactId>sqlite-framework</artifactId>
76
+ <version>2.2.0</version>
77
+ <scope>runtime</scope>
78
+ </dependency>
79
+ <dependency>
80
+ <groupId>androidx.core</groupId>
81
+ <artifactId>core-ktx</artifactId>
82
+ <version>1.8.0</version>
83
+ <scope>runtime</scope>
84
+ </dependency>
85
+ <dependency>
86
+ <groupId>org.jetbrains.kotlin</groupId>
87
+ <artifactId>kotlin-stdlib-jdk7</artifactId>
88
+ <version>1.6.0</version>
89
+ <scope>runtime</scope>
90
+ </dependency>
91
+ <dependency>
92
+ <groupId>androidx.appcompat</groupId>
93
+ <artifactId>appcompat</artifactId>
94
+ <version>1.5.0</version>
95
+ <scope>runtime</scope>
96
+ </dependency>
97
+ <dependency>
98
+ <groupId>com.google.android.material</groupId>
99
+ <artifactId>material</artifactId>
100
+ <version>1.6.1</version>
101
+ <scope>runtime</scope>
102
+ </dependency>
103
+ <dependency>
104
+ <groupId>com.squareup.okhttp3</groupId>
105
+ <artifactId>okhttp</artifactId>
106
+ <version>4.11.0</version>
107
+ <scope>runtime</scope>
108
+ </dependency>
109
+ <dependency>
110
+ <groupId>com.google.android.exoplayer</groupId>
111
+ <artifactId>exoplayer</artifactId>
112
+ <version>2.19.1</version>
113
+ <scope>runtime</scope>
114
+ </dependency>
115
+ <dependency>
116
+ <groupId>com.google.android.exoplayer</groupId>
117
+ <artifactId>exoplayer-hls</artifactId>
118
+ <version>2.19.1</version>
119
+ <scope>runtime</scope>
120
+ </dependency>
121
+ <dependency>
122
+ <groupId>com.google.android.exoplayer</groupId>
123
+ <artifactId>exoplayer-ui</artifactId>
124
+ <version>2.19.1</version>
125
+ <scope>runtime</scope>
126
+ </dependency>
127
+ </dependencies>
128
+ </project>
@@ -0,0 +1,172 @@
1
+ {
2
+ "formatVersion": "1.1",
3
+ "component": {
4
+ "group": "com.capillarytech",
5
+ "module": "hydra-richnotification",
6
+ "version": "1.10.0",
7
+ "attributes": {
8
+ "org.gradle.status": "release"
9
+ }
10
+ },
11
+ "createdBy": {
12
+ "gradle": {
13
+ "version": "7.3.3"
14
+ }
15
+ },
16
+ "variants": [
17
+ {
18
+ "name": "releaseVariantReleaseApiPublication",
19
+ "attributes": {
20
+ "org.gradle.category": "library",
21
+ "org.gradle.dependency.bundling": "external",
22
+ "org.gradle.libraryelements": "aar",
23
+ "org.gradle.usage": "java-api"
24
+ },
25
+ "files": [
26
+ {
27
+ "name": "hydra-richnotification-1.10.0.aar",
28
+ "url": "hydra-richnotification-1.10.0.aar",
29
+ "size": 50723,
30
+ "sha512": "e6199b39512cb9f0b7a23fe6c163ffef48a35e4c4cac58c2f433b1d133e0be8c358c3380d54816782f8f131705b6efdbf10a609132c8f573e3004ea22b902300",
31
+ "sha256": "afb51395823c22929cd77523fc195f542930c2790183ceeea554f72e46f5a41d",
32
+ "sha1": "848cd6b76a53bc0f12f57dfa07358bc9d68d1265",
33
+ "md5": "a3cefb8017c5572eb26f290a7d5ae524"
34
+ }
35
+ ]
36
+ },
37
+ {
38
+ "name": "releaseVariantReleaseRuntimePublication",
39
+ "attributes": {
40
+ "org.gradle.category": "library",
41
+ "org.gradle.dependency.bundling": "external",
42
+ "org.gradle.libraryelements": "aar",
43
+ "org.gradle.usage": "java-runtime"
44
+ },
45
+ "dependencies": [
46
+ {
47
+ "group": "org.jetbrains.kotlin",
48
+ "module": "kotlin-parcelize-runtime",
49
+ "version": {
50
+ "requires": "1.7.0"
51
+ }
52
+ },
53
+ {
54
+ "group": "androidx.test.ext",
55
+ "module": "junit-ktx",
56
+ "version": {
57
+ "requires": "1.1.4-rc01"
58
+ }
59
+ },
60
+ {
61
+ "group": "androidx.core",
62
+ "module": "core-ktx",
63
+ "version": {
64
+ "requires": "1.8.0"
65
+ }
66
+ },
67
+ {
68
+ "group": "org.jetbrains.kotlin",
69
+ "module": "kotlin-stdlib-jdk7",
70
+ "version": {
71
+ "requires": "1.6.0"
72
+ }
73
+ },
74
+ {
75
+ "group": "org.jetbrains.kotlin",
76
+ "module": "kotlin-reflect",
77
+ "version": {
78
+ "requires": "1.6.0"
79
+ }
80
+ },
81
+ {
82
+ "group": "com.google.code.gson",
83
+ "module": "gson",
84
+ "version": {
85
+ "requires": "2.8.9"
86
+ }
87
+ },
88
+ {
89
+ "group": "androidx.room",
90
+ "module": "room-ktx",
91
+ "version": {
92
+ "requires": "2.4.3"
93
+ }
94
+ },
95
+ {
96
+ "group": "org.jetbrains.kotlinx",
97
+ "module": "kotlinx-datetime",
98
+ "version": {
99
+ "requires": "0.3.0"
100
+ }
101
+ },
102
+ {
103
+ "group": "androidx.lifecycle",
104
+ "module": "lifecycle-common",
105
+ "version": {
106
+ "requires": "2.5.1"
107
+ }
108
+ },
109
+ {
110
+ "group": "androidx.lifecycle",
111
+ "module": "lifecycle-process",
112
+ "version": {
113
+ "requires": "2.5.1"
114
+ }
115
+ },
116
+ {
117
+ "group": "androidx.appcompat",
118
+ "module": "appcompat",
119
+ "version": {
120
+ "requires": "1.5.0"
121
+ }
122
+ },
123
+ {
124
+ "group": "com.google.android.material",
125
+ "module": "material",
126
+ "version": {
127
+ "requires": "1.6.1"
128
+ }
129
+ },
130
+ {
131
+ "group": "com.github.bumptech.glide",
132
+ "module": "glide",
133
+ "version": {
134
+ "requires": "4.12.0"
135
+ }
136
+ },
137
+ {
138
+ "group": "androidx.media3",
139
+ "module": "media3-exoplayer",
140
+ "version": {
141
+ "requires": "1.2.1"
142
+ }
143
+ },
144
+ {
145
+ "group": "androidx.media3",
146
+ "module": "media3-ui",
147
+ "version": {
148
+ "requires": "1.2.1"
149
+ }
150
+ },
151
+ {
152
+ "group": "com.capillarytech",
153
+ "module": "hydra-pushbase",
154
+ "version": {
155
+ "requires": "1.10.0"
156
+ }
157
+ }
158
+ ],
159
+ "files": [
160
+ {
161
+ "name": "hydra-richnotification-1.10.0.aar",
162
+ "url": "hydra-richnotification-1.10.0.aar",
163
+ "size": 50723,
164
+ "sha512": "e6199b39512cb9f0b7a23fe6c163ffef48a35e4c4cac58c2f433b1d133e0be8c358c3380d54816782f8f131705b6efdbf10a609132c8f573e3004ea22b902300",
165
+ "sha256": "afb51395823c22929cd77523fc195f542930c2790183ceeea554f72e46f5a41d",
166
+ "sha1": "848cd6b76a53bc0f12f57dfa07358bc9d68d1265",
167
+ "md5": "a3cefb8017c5572eb26f290a7d5ae524"
168
+ }
169
+ ]
170
+ }
171
+ ]
172
+ }
@@ -0,0 +1,128 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4
+ <!-- This module was also published with a richer model, Gradle metadata, -->
5
+ <!-- which should be used instead. Do not delete the following line which -->
6
+ <!-- is to indicate to Gradle or any Gradle module metadata file consumer -->
7
+ <!-- that they should prefer consuming it instead. -->
8
+ <!-- do_not_remove: published-with-gradle-metadata -->
9
+ <modelVersion>4.0.0</modelVersion>
10
+ <groupId>com.capillarytech</groupId>
11
+ <artifactId>hydra-richnotification</artifactId>
12
+ <version>1.10.0</version>
13
+ <packaging>aar</packaging>
14
+ <name>hydra-richnotification</name>
15
+ <description>Capillary Hydra Rich Notification SDK</description>
16
+ <url>https://github.com/Capillary/hydra-sdk-android</url>
17
+ <licenses>
18
+ <license>
19
+ <name>The Apache Software License, Version 2.0</name>
20
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
21
+ </license>
22
+ </licenses>
23
+ <developers>
24
+ <developer>
25
+ <id>capillary</id>
26
+ <name>Capillary</name>
27
+ <email>support@capillarytech.com</email>
28
+ </developer>
29
+ </developers>
30
+ <dependencies>
31
+ <dependency>
32
+ <groupId>org.jetbrains.kotlin</groupId>
33
+ <artifactId>kotlin-parcelize-runtime</artifactId>
34
+ <version>1.7.0</version>
35
+ <scope>runtime</scope>
36
+ </dependency>
37
+ <dependency>
38
+ <groupId>androidx.test.ext</groupId>
39
+ <artifactId>junit-ktx</artifactId>
40
+ <version>1.1.4-rc01</version>
41
+ <scope>runtime</scope>
42
+ </dependency>
43
+ <dependency>
44
+ <groupId>androidx.core</groupId>
45
+ <artifactId>core-ktx</artifactId>
46
+ <version>1.8.0</version>
47
+ <scope>runtime</scope>
48
+ </dependency>
49
+ <dependency>
50
+ <groupId>org.jetbrains.kotlin</groupId>
51
+ <artifactId>kotlin-stdlib-jdk7</artifactId>
52
+ <version>1.6.0</version>
53
+ <scope>runtime</scope>
54
+ </dependency>
55
+ <dependency>
56
+ <groupId>org.jetbrains.kotlin</groupId>
57
+ <artifactId>kotlin-reflect</artifactId>
58
+ <version>1.6.0</version>
59
+ <scope>runtime</scope>
60
+ </dependency>
61
+ <dependency>
62
+ <groupId>com.google.code.gson</groupId>
63
+ <artifactId>gson</artifactId>
64
+ <version>2.8.9</version>
65
+ <scope>runtime</scope>
66
+ </dependency>
67
+ <dependency>
68
+ <groupId>androidx.room</groupId>
69
+ <artifactId>room-ktx</artifactId>
70
+ <version>2.4.3</version>
71
+ <scope>runtime</scope>
72
+ </dependency>
73
+ <dependency>
74
+ <groupId>org.jetbrains.kotlinx</groupId>
75
+ <artifactId>kotlinx-datetime</artifactId>
76
+ <version>0.3.0</version>
77
+ <scope>runtime</scope>
78
+ </dependency>
79
+ <dependency>
80
+ <groupId>androidx.lifecycle</groupId>
81
+ <artifactId>lifecycle-common</artifactId>
82
+ <version>2.5.1</version>
83
+ <scope>runtime</scope>
84
+ </dependency>
85
+ <dependency>
86
+ <groupId>androidx.lifecycle</groupId>
87
+ <artifactId>lifecycle-process</artifactId>
88
+ <version>2.5.1</version>
89
+ <scope>runtime</scope>
90
+ </dependency>
91
+ <dependency>
92
+ <groupId>androidx.appcompat</groupId>
93
+ <artifactId>appcompat</artifactId>
94
+ <version>1.5.0</version>
95
+ <scope>runtime</scope>
96
+ </dependency>
97
+ <dependency>
98
+ <groupId>com.google.android.material</groupId>
99
+ <artifactId>material</artifactId>
100
+ <version>1.6.1</version>
101
+ <scope>runtime</scope>
102
+ </dependency>
103
+ <dependency>
104
+ <groupId>com.github.bumptech.glide</groupId>
105
+ <artifactId>glide</artifactId>
106
+ <version>4.12.0</version>
107
+ <scope>runtime</scope>
108
+ </dependency>
109
+ <dependency>
110
+ <groupId>androidx.media3</groupId>
111
+ <artifactId>media3-exoplayer</artifactId>
112
+ <version>1.2.1</version>
113
+ <scope>runtime</scope>
114
+ </dependency>
115
+ <dependency>
116
+ <groupId>androidx.media3</groupId>
117
+ <artifactId>media3-ui</artifactId>
118
+ <version>1.2.1</version>
119
+ <scope>runtime</scope>
120
+ </dependency>
121
+ <dependency>
122
+ <groupId>com.capillarytech</groupId>
123
+ <artifactId>hydra-pushbase</artifactId>
124
+ <version>1.10.0</version>
125
+ <scope>runtime</scope>
126
+ </dependency>
127
+ </dependencies>
128
+ </project>
@@ -8,6 +8,8 @@ import com.facebook.react.bridge.Promise
8
8
  import com.facebook.react.bridge.ReactApplicationContext
9
9
  import com.facebook.react.bridge.ReadableMap
10
10
  import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter
11
+ import org.json.JSONArray
12
+ import org.json.JSONObject
11
13
 
12
14
 
13
15
  // Callback interface for event completion
@@ -147,11 +149,39 @@ object HydraEventEmitter {
147
149
  }
148
150
  }
149
151
 
152
+ // org.json.JSONObject.opt()/JSONArray.opt() return raw org.json types for nested
153
+ // object/array fields — Arguments.makeNativeMap has no idea what those are and throws
154
+ // ("Could not convert class org.json.JSONObject") the moment a payload has one nested
155
+ // inside it, which is common for gamification analytics payloads (campaign_details,
156
+ // page_details, etc). Recursively convert them to plain Map/List first.
157
+ private fun sanitizeValue(value: Any?): Any? {
158
+ return when (value) {
159
+ null, JSONObject.NULL -> null
160
+ is JSONObject -> {
161
+ val map = mutableMapOf<String, Any?>()
162
+ value.keys().forEach { key -> map[key] = sanitizeValue(value.opt(key)) }
163
+ map
164
+ }
165
+ is JSONArray -> (0 until value.length()).map { i -> sanitizeValue(value.opt(i)) }
166
+ is Map<*, *> -> {
167
+ val map = mutableMapOf<String, Any?>()
168
+ value.forEach { (k, v) -> if (k is String) map[k] = sanitizeValue(v) }
169
+ map
170
+ }
171
+ is List<*> -> value.map { sanitizeValue(it) }
172
+ is Array<*> -> value.map { sanitizeValue(it) }
173
+ else -> value
174
+ }
175
+ }
176
+
150
177
  private fun convertMapToMutable(originalMap: Map<*, *>): Map<String, Any> {
151
178
  val resultMap = mutableMapOf<String, Any>()
152
179
  originalMap.forEach {
153
180
  if (it.key is String && it.value != null) {
154
- resultMap[it.key as String] = it.value!!
181
+ val sanitized = sanitizeValue(it.value)
182
+ if (sanitized != null) {
183
+ resultMap[it.key as String] = sanitized
184
+ }
155
185
  }
156
186
  }
157
187
  return resultMap
@@ -19,7 +19,8 @@ enum class HydraEventType(val event: String) {
19
19
  ON_USER_STATE_CHANGED("onUserStateChanged"),
20
20
  ON_GAMIFICATION_VIEW_HEIGHT_CHANGED("onGamificationViewHeightChanged"),
21
21
  ON_GAMIFICATION_ANALYTICS_EVENT("gamificationAnalyticsEvent"),
22
- ON_GAMIFICATION_DEEPLINK("gamificationDeeplink");
22
+ ON_GAMIFICATION_DEEPLINK("gamificationDeeplink"),
23
+ ON_GAMIFICATION_EVENT_TRIGGER("gamificationEventTrigger");
23
24
 
24
25
  companion object {
25
26
  fun from(eventName: String?): HydraEventType? = when (eventName) {
@@ -42,6 +43,7 @@ enum class HydraEventType(val event: String) {
42
43
  ON_GAMIFICATION_VIEW_HEIGHT_CHANGED.event -> ON_GAMIFICATION_VIEW_HEIGHT_CHANGED
43
44
  ON_GAMIFICATION_ANALYTICS_EVENT.event -> ON_GAMIFICATION_ANALYTICS_EVENT
44
45
  ON_GAMIFICATION_DEEPLINK.event -> ON_GAMIFICATION_DEEPLINK
46
+ ON_GAMIFICATION_EVENT_TRIGGER.event -> ON_GAMIFICATION_EVENT_TRIGGER
45
47
  else -> throw IllegalArgumentException()
46
48
  }
47
49
  }
@@ -37,7 +37,7 @@ class GamificationBannerViewManager : SimpleViewManager<BannerView>() {
37
37
  val data = findEntryPointByBannerId(bannerId) ?: return
38
38
 
39
39
  // Defer bind until Yoga has measured and laid out the view
40
- if (view.width > 0 && view.height > 0) {
40
+ if (view.width > 0 && view.height >= 0) {
41
41
  view.tag = bannerId
42
42
  bindWithLayout(view, data, bannerId)
43
43
  } else {
@@ -46,7 +46,7 @@ class GamificationBannerViewManager : SimpleViewManager<BannerView>() {
46
46
  v: View, left: Int, top: Int, right: Int, bottom: Int,
47
47
  oldLeft: Int, oldTop: Int, oldRight: Int, oldBottom: Int
48
48
  ) {
49
- if (right - left > 0 && bottom - top > 0) {
49
+ if (right - left > 0 && bottom - top >= 0) {
50
50
  view.removeOnLayoutChangeListener(this)
51
51
  view.tag = bannerId
52
52
  bindWithLayout(view, data, bannerId)
@@ -120,7 +120,7 @@ class GamificationBannerViewManager : SimpleViewManager<BannerView>() {
120
120
  view.layout(view.left, view.top, view.left + w, view.top + finalHeight)
121
121
 
122
122
  // Emit the SDK-computed height to RN so JS side can update its style
123
- if (finalHeight > 0) {
123
+ if (finalHeight >= 0) {
124
124
  val heightDp = finalHeight / view.resources.displayMetrics.density
125
125
  HydraEventEmitter.sendEvent(
126
126
  HydraEventType.ON_GAMIFICATION_VIEW_HEIGHT_CHANGED,
@@ -42,7 +42,7 @@ class GamificationEmbedViewManager : SimpleViewManager<EmbedWebView>() {
42
42
  val data = findEntryPointByEmbedId(embedId) ?: return
43
43
 
44
44
  // Defer bind until Yoga has measured and laid out the view
45
- if (view.width > 0 && view.height > 0) {
45
+ if (view.width > 0 && view.height >= 0) {
46
46
  view.tag = embedId
47
47
  bindWithLayout(view, data, embedId)
48
48
  } else {
@@ -51,7 +51,7 @@ class GamificationEmbedViewManager : SimpleViewManager<EmbedWebView>() {
51
51
  v: View, left: Int, top: Int, right: Int, bottom: Int,
52
52
  oldLeft: Int, oldTop: Int, oldRight: Int, oldBottom: Int
53
53
  ) {
54
- if (right - left > 0 && bottom - top > 0) {
54
+ if (right - left > 0 && bottom - top >= 0) {
55
55
  view.removeOnLayoutChangeListener(this)
56
56
  view.tag = embedId
57
57
  bindWithLayout(view, data, embedId)
@@ -121,7 +121,7 @@ class GamificationEmbedViewManager : SimpleViewManager<EmbedWebView>() {
121
121
  val preDrawListener = object : ViewTreeObserver.OnPreDrawListener {
122
122
  override fun onPreDraw(): Boolean {
123
123
  val newHeight = view.layoutParams?.height ?: return true
124
- if (newHeight > 0 && newHeight != lastEmittedHeight) {
124
+ if (newHeight != lastEmittedHeight) {
125
125
  lastEmittedHeight = newHeight
126
126
  val heightDp = newHeight / view.resources.displayMetrics.density
127
127
  HydraEventEmitter.sendEvent(
@@ -34,7 +34,7 @@ class GamificationLoyaltyViewManager : SimpleViewManager<LoyaltyEmbedView>() {
34
34
  val loyaltyUrl = findLoyaltyUrlById(loyaltyId) ?: return
35
35
 
36
36
  // Defer bind until Yoga has measured and laid out the view
37
- if (view.width > 0 && view.height > 0) {
37
+ if (view.width > 0 && view.height >= 0) {
38
38
  view.tag = loyaltyId
39
39
  bindWithLayout(view, loyaltyUrl)
40
40
  } else {
@@ -43,7 +43,7 @@ class GamificationLoyaltyViewManager : SimpleViewManager<LoyaltyEmbedView>() {
43
43
  v: View, left: Int, top: Int, right: Int, bottom: Int,
44
44
  oldLeft: Int, oldTop: Int, oldRight: Int, oldBottom: Int
45
45
  ) {
46
- if (right - left > 0 && bottom - top > 0) {
46
+ if (right - left > 0 && bottom - top >= 0) {
47
47
  view.removeOnLayoutChangeListener(this)
48
48
  view.tag = loyaltyId
49
49
  bindWithLayout(view, loyaltyUrl)
@@ -279,6 +279,12 @@ object HydraCore {
279
279
  deepLink
280
280
  )
281
281
  }
282
+ override fun onGameEventTrigger(eventName: String, data: Map<String, Any?>) {
283
+ HydraEventEmitter.sendEvent(
284
+ HydraEventType.ON_GAMIFICATION_EVENT_TRIGGER,
285
+ mapOf("name" to eventName, "payload" to data)
286
+ )
287
+ }
282
288
  }
283
289
  // Synchronized against gamificationScreenAppeared's check-then-set so a screen name
284
290
  // set concurrently with init can't be missed by this read-and-clear.
@@ -27,4 +27,5 @@ enum HydraEventType : String, CaseIterable{
27
27
  case ON_GAMIFICATION_VIEW_HEIGHT_CHANGED = "onGamificationViewHeightChanged"
28
28
  case ON_GAMIFICATION_ANALYTICS_EVENT = "gamificationAnalyticsEvent"
29
29
  case ON_GAMIFICATION_DEEPLINK = "gamificationDeeplink"
30
+ case ON_GAMIFICATION_EVENT_TRIGGER = "gamificationEventTrigger"
30
31
  }
@@ -61,7 +61,45 @@ import FirebaseRemoteConfig
61
61
  )
62
62
  }
63
63
 
64
+ public func gamificationEventTrigger(eventName: String, info: [String : Any]) {
65
+ Logger.debug("[Gamification] event triggered: \(eventName) info: \(info)")
66
+ let payload = HydraSDKCore.jsonSafe(info)
67
+ Logger.debug("[Gamification] forwarding event trigger to RN: \(eventName) payload: \(payload)")
68
+ HydraEventEmitter.shared.sendEvent(
69
+ HydraEventType.ON_GAMIFICATION_EVENT_TRIGGER.rawValue,
70
+ body: ["name": eventName, "payload": payload]
71
+ )
72
+ }
64
73
 
74
+ // [String: Any] from the SDK can hold Swift-only values (wrapped Optionals, structs,
75
+ // enums, Date, URL) that bridge to ObjC as opaque __SwiftValue - RN can't serialize
76
+ // those and drops the whole event. Recursively reduce everything to JSON types.
77
+ private static func jsonSafe(_ value: Any) -> Any {
78
+ let mirror = Mirror(reflecting: value)
79
+ if mirror.displayStyle == .optional {
80
+ guard let wrapped = mirror.children.first?.value else { return NSNull() }
81
+ return jsonSafe(wrapped)
82
+ }
83
+ switch value {
84
+ case is NSNull:
85
+ return value
86
+ case let string as String:
87
+ return string
88
+ case let number as NSNumber:
89
+ return number
90
+ case let dict as [String: Any]:
91
+ return dict.mapValues { jsonSafe($0) }
92
+ case let array as [Any]:
93
+ return array.map { jsonSafe($0) }
94
+ case let date as Date:
95
+ return ISO8601DateFormatter().string(from: date)
96
+ case let url as URL:
97
+ return url.absoluteString
98
+ default:
99
+ return String(describing: value)
100
+ }
101
+ }
102
+
65
103
  @objc public static let shared = HydraSDKCore()
66
104
 
67
105
  // Reads HydraConfig.plist ahead of Hydra initialization, for the flags that
@@ -111,6 +111,11 @@ class HydraNativeEventEmitter {
111
111
  listener(eventData);
112
112
  });
113
113
  }
114
+ addGamificationEventTriggerListener(listener) {
115
+ return this.addListener(_HydraNativeEvent.HydraNativeEvent.gamificationEventTrigger, eventData => {
116
+ listener(eventData['name'], eventData['payload']);
117
+ });
118
+ }
114
119
  addListener(eventType, listener) {
115
120
  const subscription = this.emitter.addListener(eventType, listener);
116
121
  if (this.eventListenerSubscriptionMap[eventType] === undefined) {