@capillarytech/react-native-hydra-lib 1.7.0-beta.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 (446) hide show
  1. package/CHANGELOG.md +252 -0
  2. package/DEPRECATION_POLICY.md +220 -0
  3. package/LICENSE +20 -0
  4. package/MIGRATION.md +361 -0
  5. package/README.md +491 -0
  6. package/RELEASE_NOTES.md +528 -0
  7. package/android/build.gradle +565 -0
  8. package/android/generated/java/com/hydralib/NativeHydraLibSpec.java +185 -0
  9. package/android/generated/jni/CMakeLists.txt +36 -0
  10. package/android/generated/jni/RNHydraLibSpec-generated.cpp +248 -0
  11. package/android/generated/jni/RNHydraLibSpec.h +31 -0
  12. package/android/generated/jni/react/renderer/components/RNHydraLibSpec/ComponentDescriptors.cpp +24 -0
  13. package/android/generated/jni/react/renderer/components/RNHydraLibSpec/ComponentDescriptors.h +26 -0
  14. package/android/generated/jni/react/renderer/components/RNHydraLibSpec/EventEmitters.cpp +18 -0
  15. package/android/generated/jni/react/renderer/components/RNHydraLibSpec/EventEmitters.h +37 -0
  16. package/android/generated/jni/react/renderer/components/RNHydraLibSpec/Props.cpp +39 -0
  17. package/android/generated/jni/react/renderer/components/RNHydraLibSpec/Props.h +47 -0
  18. package/android/generated/jni/react/renderer/components/RNHydraLibSpec/RNHydraLibSpecJSI-generated.cpp +283 -0
  19. package/android/generated/jni/react/renderer/components/RNHydraLibSpec/RNHydraLibSpecJSI.h +395 -0
  20. package/android/generated/jni/react/renderer/components/RNHydraLibSpec/ShadowNodes.cpp +19 -0
  21. package/android/generated/jni/react/renderer/components/RNHydraLibSpec/ShadowNodes.h +54 -0
  22. package/android/generated/jni/react/renderer/components/RNHydraLibSpec/States.cpp +16 -0
  23. package/android/generated/jni/react/renderer/components/RNHydraLibSpec/States.h +53 -0
  24. package/android/gradle.properties +5 -0
  25. package/android/src/main/AndroidManifest.xml +11 -0
  26. package/android/src/main/AndroidManifestNew.xml +16 -0
  27. package/android/src/main/AndroidManifestNoFirebaseIcon.xml +5 -0
  28. package/android/src/main/java/com/hydralib/delegates/HydraActivityCallbacks.kt +90 -0
  29. package/android/src/main/java/com/hydralib/delegates/NonHydraNotificationActivity.kt +43 -0
  30. package/android/src/main/java/com/hydralib/eventemitter/HydraEventEmitter.kt +150 -0
  31. package/android/src/main/java/com/hydralib/eventemitter/HydraEventType.kt +44 -0
  32. package/android/src/main/java/com/hydralib/gamification/GamificationBannerViewManager.kt +121 -0
  33. package/android/src/main/java/com/hydralib/gamification/GamificationEmbedViewManager.kt +153 -0
  34. package/android/src/main/java/com/hydralib/gamification/GamificationLoyaltyViewManager.kt +95 -0
  35. package/android/src/main/java/com/hydralib/hydrasdk/HydraCore.kt +860 -0
  36. package/android/src/main/java/com/hydralib/hydrasdk/HydraExtenstions.kt +331 -0
  37. package/android/src/main/java/com/hydralib/hydrasdk/HydraInAppMessages.kt +136 -0
  38. package/android/src/main/java/com/hydralib/hydrasdk/HydraInbox.kt +70 -0
  39. package/android/src/main/java/com/hydralib/hydrasdk/HydraInboxUI.kt +54 -0
  40. package/android/src/main/java/com/hydralib/hydrasdk/HydraPushNotification.kt +299 -0
  41. package/android/src/main/java/com/hydralib/nativeapis/Hydra.kt +28 -0
  42. package/android/src/main/java/com/hydralib/nativeapis/HydraFirebaseRemoteConfigKeys.kt +76 -0
  43. package/android/src/main/java/com/hydralib/nativeapis/HydraInitializer.kt +130 -0
  44. package/android/src/main/java/com/hydralib/nativeapis/HydraNativeMessaging.kt +18 -0
  45. package/android/src/main/java/com/hydralib/nativeapis/HydraRemoteConfig.kt +59 -0
  46. package/android/src/main/java/com/hydralib/utils/RNHydraPreferencesManager.kt +154 -0
  47. package/android/src/main/java/com/hydralib/utils/ResourceUtil.kt +10 -0
  48. package/android/src/newarch/HydraLibModule.kt +218 -0
  49. package/android/src/oldarch/HydraLibModule.kt +258 -0
  50. package/android/src/rn72OrLess/HydraLibPackage.kt +43 -0
  51. package/android/src/rn73OrMore/HydraLibPackage.kt +53 -0
  52. package/ios/Delegates/HydraApplicationDelegate.swift +196 -0
  53. package/ios/Delegates/HydraFirebaseMessagingDelegate.swift +20 -0
  54. package/ios/Delegates/HydraUNUserNotificationCenterDelegate.swift +26 -0
  55. package/ios/EventEmitter/HydraEventEmitter.swift +98 -0
  56. package/ios/EventEmitter/HydraEventType.swift +28 -0
  57. package/ios/EventEmitter/HydraNativeEmitterBrigde.h +15 -0
  58. package/ios/EventEmitter/HydraNativeEmitterBrigde.mm +48 -0
  59. package/ios/GamificationViews/GamificationBannerViewComponentView.h +14 -0
  60. package/ios/GamificationViews/GamificationBannerViewComponentView.mm +125 -0
  61. package/ios/GamificationViews/GamificationEmbedViewComponentView.h +14 -0
  62. package/ios/GamificationViews/GamificationEmbedViewComponentView.mm +131 -0
  63. package/ios/GamificationViews/GamificationLoyaltyViewComponentView.h +14 -0
  64. package/ios/GamificationViews/GamificationLoyaltyViewComponentView.mm +120 -0
  65. package/ios/HydraLib.h +16 -0
  66. package/ios/HydraLib.mm +207 -0
  67. package/ios/HydraSDK/HydraInAppMessages.swift +93 -0
  68. package/ios/HydraSDK/HydraInbox.swift +97 -0
  69. package/ios/HydraSDK/HydraInboxUI.swift +105 -0
  70. package/ios/HydraSDK/HydraPushNotification.swift +476 -0
  71. package/ios/HydraSDK/HydraSDKCore.swift +707 -0
  72. package/ios/NativeAPIs/Hydra.h +34 -0
  73. package/ios/NativeAPIs/Hydra.mm +47 -0
  74. package/ios/NativeAPIs/HydraNativeFirebaseRemoteConfigKeys.h +23 -0
  75. package/ios/NativeAPIs/HydraNativeFirebaseRemoteConfigKeys.mm +80 -0
  76. package/ios/NativeAPIs/HydraNativeInitializer.h +16 -0
  77. package/ios/NativeAPIs/HydraNativeInitializer.mm +39 -0
  78. package/ios/NativeAPIs/HydraNativeMessaging.h +24 -0
  79. package/ios/NativeAPIs/HydraNativeMessaging.mm +53 -0
  80. package/ios/NativeAPIs/HydraNativeRemoteConfig.h +27 -0
  81. package/ios/NativeAPIs/HydraNativeRemoteConfig.mm +89 -0
  82. package/ios/Utils/HydraExtensions.swift +322 -0
  83. package/ios/Utils/HydraRNConstants.swift +13 -0
  84. package/ios/Utils/RNHydraLogger.swift +31 -0
  85. package/ios/generated/RNHydraLibSpec/ComponentDescriptors.cpp +24 -0
  86. package/ios/generated/RNHydraLibSpec/ComponentDescriptors.h +26 -0
  87. package/ios/generated/RNHydraLibSpec/EventEmitters.cpp +18 -0
  88. package/ios/generated/RNHydraLibSpec/EventEmitters.h +37 -0
  89. package/ios/generated/RNHydraLibSpec/Props.cpp +39 -0
  90. package/ios/generated/RNHydraLibSpec/Props.h +47 -0
  91. package/ios/generated/RNHydraLibSpec/RCTComponentViewHelpers.h +28 -0
  92. package/ios/generated/RNHydraLibSpec/RNHydraLibSpec-generated.mm +291 -0
  93. package/ios/generated/RNHydraLibSpec/RNHydraLibSpec.h +167 -0
  94. package/ios/generated/RNHydraLibSpec/ShadowNodes.cpp +19 -0
  95. package/ios/generated/RNHydraLibSpec/ShadowNodes.h +54 -0
  96. package/ios/generated/RNHydraLibSpec/States.cpp +16 -0
  97. package/ios/generated/RNHydraLibSpec/States.h +53 -0
  98. package/ios/generated/RNHydraLibSpecJSI-generated.cpp +283 -0
  99. package/ios/generated/RNHydraLibSpecJSI.h +395 -0
  100. package/lib/commonjs/GamificationBannerViewNativeComponent.js +10 -0
  101. package/lib/commonjs/GamificationBannerViewNativeComponent.js.map +1 -0
  102. package/lib/commonjs/GamificationEmbedViewNativeComponent.js +10 -0
  103. package/lib/commonjs/GamificationEmbedViewNativeComponent.js.map +1 -0
  104. package/lib/commonjs/GamificationLoyaltyViewNativeComponent.js +10 -0
  105. package/lib/commonjs/GamificationLoyaltyViewNativeComponent.js.map +1 -0
  106. package/lib/commonjs/NativeHydraLib.js +11 -0
  107. package/lib/commonjs/NativeHydraLib.js.map +1 -0
  108. package/lib/commonjs/components/GamificationBannerView.js +15 -0
  109. package/lib/commonjs/components/GamificationBannerView.js.map +1 -0
  110. package/lib/commonjs/components/GamificationEmbedView.js +15 -0
  111. package/lib/commonjs/components/GamificationEmbedView.js.map +1 -0
  112. package/lib/commonjs/components/GamificationLoyaltyView.js +15 -0
  113. package/lib/commonjs/components/GamificationLoyaltyView.js.map +1 -0
  114. package/lib/commonjs/hydra-apis/Hydra.js +43 -0
  115. package/lib/commonjs/hydra-apis/Hydra.js.map +1 -0
  116. package/lib/commonjs/hydra-apis/HydraCore.js +42 -0
  117. package/lib/commonjs/hydra-apis/HydraCore.js.map +1 -0
  118. package/lib/commonjs/hydra-apis/HydraInAppMessaging.js +24 -0
  119. package/lib/commonjs/hydra-apis/HydraInAppMessaging.js.map +1 -0
  120. package/lib/commonjs/hydra-apis/HydraInbox.js +29 -0
  121. package/lib/commonjs/hydra-apis/HydraInbox.js.map +1 -0
  122. package/lib/commonjs/hydra-apis/HydraInboxUI.js +18 -0
  123. package/lib/commonjs/hydra-apis/HydraInboxUI.js.map +1 -0
  124. package/lib/commonjs/hydra-apis/HydraNativeEventEmitter.js +133 -0
  125. package/lib/commonjs/hydra-apis/HydraNativeEventEmitter.js.map +1 -0
  126. package/lib/commonjs/hydra-apis/HydraPushNotification.js +21 -0
  127. package/lib/commonjs/hydra-apis/HydraPushNotification.js.map +1 -0
  128. package/lib/commonjs/index.js +230 -0
  129. package/lib/commonjs/index.js.map +1 -0
  130. package/lib/commonjs/models/HydraAccountConfig.js +41 -0
  131. package/lib/commonjs/models/HydraAccountConfig.js.map +1 -0
  132. package/lib/commonjs/models/HydraFirebaseRemoteConfigKeys.js +40 -0
  133. package/lib/commonjs/models/HydraFirebaseRemoteConfigKeys.js.map +1 -0
  134. package/lib/commonjs/models/HydraGeoConfig.js +24 -0
  135. package/lib/commonjs/models/HydraGeoConfig.js.map +1 -0
  136. package/lib/commonjs/models/HydraInAppMessage/HydraInAppButtonComponent.js +26 -0
  137. package/lib/commonjs/models/HydraInAppMessage/HydraInAppButtonComponent.js.map +1 -0
  138. package/lib/commonjs/models/HydraInAppMessage/HydraInAppComponentStyle.js +26 -0
  139. package/lib/commonjs/models/HydraInAppMessage/HydraInAppComponentStyle.js.map +1 -0
  140. package/lib/commonjs/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.js +39 -0
  141. package/lib/commonjs/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.js.map +1 -0
  142. package/lib/commonjs/models/HydraInAppMessage/HydraInAppMessage.js +60 -0
  143. package/lib/commonjs/models/HydraInAppMessage/HydraInAppMessage.js.map +1 -0
  144. package/lib/commonjs/models/HydraInAppMessage/HydraInAppTemplateType.js +66 -0
  145. package/lib/commonjs/models/HydraInAppMessage/HydraInAppTemplateType.js.map +1 -0
  146. package/lib/commonjs/models/HydraInAppMessage/HydraInAppTextComponent.js +21 -0
  147. package/lib/commonjs/models/HydraInAppMessage/HydraInAppTextComponent.js.map +1 -0
  148. package/lib/commonjs/models/HydraLogLevel.js +16 -0
  149. package/lib/commonjs/models/HydraLogLevel.js.map +1 -0
  150. package/lib/commonjs/models/HydraNativeEvent.js +27 -0
  151. package/lib/commonjs/models/HydraNativeEvent.js.map +1 -0
  152. package/lib/commonjs/models/HydraNotification/HydraNotification.js +70 -0
  153. package/lib/commonjs/models/HydraNotification/HydraNotification.js.map +1 -0
  154. package/lib/commonjs/models/HydraNotification/HydraNotificationBody.js +25 -0
  155. package/lib/commonjs/models/HydraNotification/HydraNotificationBody.js.map +1 -0
  156. package/lib/commonjs/models/HydraNotification/HydraNotificationCta.js +23 -0
  157. package/lib/commonjs/models/HydraNotification/HydraNotificationCta.js.map +1 -0
  158. package/lib/commonjs/models/HydraNotification/HydraNotificationCtaType.js +62 -0
  159. package/lib/commonjs/models/HydraNotification/HydraNotificationCtaType.js.map +1 -0
  160. package/lib/commonjs/models/HydraNotification/HydraNotificationExpandedDetails.js +25 -0
  161. package/lib/commonjs/models/HydraNotification/HydraNotificationExpandedDetails.js.map +1 -0
  162. package/lib/commonjs/models/HydraNotification/HydraNotificationGateway.js +13 -0
  163. package/lib/commonjs/models/HydraNotification/HydraNotificationGateway.js.map +1 -0
  164. package/lib/commonjs/models/HydraPushPreferences.js +20 -0
  165. package/lib/commonjs/models/HydraPushPreferences.js.map +1 -0
  166. package/lib/commonjs/models/HydraUserDetails.js +26 -0
  167. package/lib/commonjs/models/HydraUserDetails.js.map +1 -0
  168. package/lib/commonjs/models/HydraVisitorInfo.js +19 -0
  169. package/lib/commonjs/models/HydraVisitorInfo.js.map +1 -0
  170. package/lib/commonjs/models/NonHydraNotification.js +18 -0
  171. package/lib/commonjs/models/NonHydraNotification.js.map +1 -0
  172. package/lib/commonjs/models/UserState.js +41 -0
  173. package/lib/commonjs/models/UserState.js.map +1 -0
  174. package/lib/module/GamificationBannerViewNativeComponent.js +5 -0
  175. package/lib/module/GamificationBannerViewNativeComponent.js.map +1 -0
  176. package/lib/module/GamificationEmbedViewNativeComponent.js +5 -0
  177. package/lib/module/GamificationEmbedViewNativeComponent.js.map +1 -0
  178. package/lib/module/GamificationLoyaltyViewNativeComponent.js +5 -0
  179. package/lib/module/GamificationLoyaltyViewNativeComponent.js.map +1 -0
  180. package/lib/module/NativeHydraLib.js +7 -0
  181. package/lib/module/NativeHydraLib.js.map +1 -0
  182. package/lib/module/components/GamificationBannerView.js +10 -0
  183. package/lib/module/components/GamificationBannerView.js.map +1 -0
  184. package/lib/module/components/GamificationEmbedView.js +10 -0
  185. package/lib/module/components/GamificationEmbedView.js.map +1 -0
  186. package/lib/module/components/GamificationLoyaltyView.js +10 -0
  187. package/lib/module/components/GamificationLoyaltyView.js.map +1 -0
  188. package/lib/module/hydra-apis/Hydra.js +37 -0
  189. package/lib/module/hydra-apis/Hydra.js.map +1 -0
  190. package/lib/module/hydra-apis/HydraCore.js +36 -0
  191. package/lib/module/hydra-apis/HydraCore.js.map +1 -0
  192. package/lib/module/hydra-apis/HydraInAppMessaging.js +18 -0
  193. package/lib/module/hydra-apis/HydraInAppMessaging.js.map +1 -0
  194. package/lib/module/hydra-apis/HydraInbox.js +23 -0
  195. package/lib/module/hydra-apis/HydraInbox.js.map +1 -0
  196. package/lib/module/hydra-apis/HydraInboxUI.js +12 -0
  197. package/lib/module/hydra-apis/HydraInboxUI.js.map +1 -0
  198. package/lib/module/hydra-apis/HydraNativeEventEmitter.js +127 -0
  199. package/lib/module/hydra-apis/HydraNativeEventEmitter.js.map +1 -0
  200. package/lib/module/hydra-apis/HydraPushNotification.js +15 -0
  201. package/lib/module/hydra-apis/HydraPushNotification.js.map +1 -0
  202. package/lib/module/index.js +36 -0
  203. package/lib/module/index.js.map +1 -0
  204. package/lib/module/models/HydraAccountConfig.js +36 -0
  205. package/lib/module/models/HydraAccountConfig.js.map +1 -0
  206. package/lib/module/models/HydraFirebaseRemoteConfigKeys.js +35 -0
  207. package/lib/module/models/HydraFirebaseRemoteConfigKeys.js.map +1 -0
  208. package/lib/module/models/HydraGeoConfig.js +19 -0
  209. package/lib/module/models/HydraGeoConfig.js.map +1 -0
  210. package/lib/module/models/HydraInAppMessage/HydraInAppButtonComponent.js +21 -0
  211. package/lib/module/models/HydraInAppMessage/HydraInAppButtonComponent.js.map +1 -0
  212. package/lib/module/models/HydraInAppMessage/HydraInAppComponentStyle.js +21 -0
  213. package/lib/module/models/HydraInAppMessage/HydraInAppComponentStyle.js.map +1 -0
  214. package/lib/module/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.js +35 -0
  215. package/lib/module/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.js.map +1 -0
  216. package/lib/module/models/HydraInAppMessage/HydraInAppMessage.js +55 -0
  217. package/lib/module/models/HydraInAppMessage/HydraInAppMessage.js.map +1 -0
  218. package/lib/module/models/HydraInAppMessage/HydraInAppTemplateType.js +62 -0
  219. package/lib/module/models/HydraInAppMessage/HydraInAppTemplateType.js.map +1 -0
  220. package/lib/module/models/HydraInAppMessage/HydraInAppTextComponent.js +16 -0
  221. package/lib/module/models/HydraInAppMessage/HydraInAppTextComponent.js.map +1 -0
  222. package/lib/module/models/HydraLogLevel.js +12 -0
  223. package/lib/module/models/HydraLogLevel.js.map +1 -0
  224. package/lib/module/models/HydraNativeEvent.js +23 -0
  225. package/lib/module/models/HydraNativeEvent.js.map +1 -0
  226. package/lib/module/models/HydraNotification/HydraNotification.js +65 -0
  227. package/lib/module/models/HydraNotification/HydraNotification.js.map +1 -0
  228. package/lib/module/models/HydraNotification/HydraNotificationBody.js +20 -0
  229. package/lib/module/models/HydraNotification/HydraNotificationBody.js.map +1 -0
  230. package/lib/module/models/HydraNotification/HydraNotificationCta.js +18 -0
  231. package/lib/module/models/HydraNotification/HydraNotificationCta.js.map +1 -0
  232. package/lib/module/models/HydraNotification/HydraNotificationCtaType.js +58 -0
  233. package/lib/module/models/HydraNotification/HydraNotificationCtaType.js.map +1 -0
  234. package/lib/module/models/HydraNotification/HydraNotificationExpandedDetails.js +20 -0
  235. package/lib/module/models/HydraNotification/HydraNotificationExpandedDetails.js.map +1 -0
  236. package/lib/module/models/HydraNotification/HydraNotificationGateway.js +9 -0
  237. package/lib/module/models/HydraNotification/HydraNotificationGateway.js.map +1 -0
  238. package/lib/module/models/HydraPushPreferences.js +15 -0
  239. package/lib/module/models/HydraPushPreferences.js.map +1 -0
  240. package/lib/module/models/HydraUserDetails.js +21 -0
  241. package/lib/module/models/HydraUserDetails.js.map +1 -0
  242. package/lib/module/models/HydraVisitorInfo.js +14 -0
  243. package/lib/module/models/HydraVisitorInfo.js.map +1 -0
  244. package/lib/module/models/NonHydraNotification.js +13 -0
  245. package/lib/module/models/NonHydraNotification.js.map +1 -0
  246. package/lib/module/models/UserState.js +37 -0
  247. package/lib/module/models/UserState.js.map +1 -0
  248. package/lib/typescript/commonjs/package.json +1 -0
  249. package/lib/typescript/commonjs/src/GamificationBannerViewNativeComponent.d.ts +7 -0
  250. package/lib/typescript/commonjs/src/GamificationBannerViewNativeComponent.d.ts.map +1 -0
  251. package/lib/typescript/commonjs/src/GamificationEmbedViewNativeComponent.d.ts +7 -0
  252. package/lib/typescript/commonjs/src/GamificationEmbedViewNativeComponent.d.ts.map +1 -0
  253. package/lib/typescript/commonjs/src/GamificationLoyaltyViewNativeComponent.d.ts +7 -0
  254. package/lib/typescript/commonjs/src/GamificationLoyaltyViewNativeComponent.d.ts.map +1 -0
  255. package/lib/typescript/commonjs/src/NativeHydraLib.d.ts +46 -0
  256. package/lib/typescript/commonjs/src/NativeHydraLib.d.ts.map +1 -0
  257. package/lib/typescript/commonjs/src/components/GamificationBannerView.d.ts +6 -0
  258. package/lib/typescript/commonjs/src/components/GamificationBannerView.d.ts.map +1 -0
  259. package/lib/typescript/commonjs/src/components/GamificationEmbedView.d.ts +6 -0
  260. package/lib/typescript/commonjs/src/components/GamificationEmbedView.d.ts.map +1 -0
  261. package/lib/typescript/commonjs/src/components/GamificationLoyaltyView.d.ts +6 -0
  262. package/lib/typescript/commonjs/src/components/GamificationLoyaltyView.d.ts.map +1 -0
  263. package/lib/typescript/commonjs/src/hydra-apis/Hydra.d.ts +15 -0
  264. package/lib/typescript/commonjs/src/hydra-apis/Hydra.d.ts.map +1 -0
  265. package/lib/typescript/commonjs/src/hydra-apis/HydraCore.d.ts +18 -0
  266. package/lib/typescript/commonjs/src/hydra-apis/HydraCore.d.ts.map +1 -0
  267. package/lib/typescript/commonjs/src/hydra-apis/HydraInAppMessaging.d.ts +8 -0
  268. package/lib/typescript/commonjs/src/hydra-apis/HydraInAppMessaging.d.ts.map +1 -0
  269. package/lib/typescript/commonjs/src/hydra-apis/HydraInbox.d.ts +9 -0
  270. package/lib/typescript/commonjs/src/hydra-apis/HydraInbox.d.ts.map +1 -0
  271. package/lib/typescript/commonjs/src/hydra-apis/HydraInboxUI.d.ts +5 -0
  272. package/lib/typescript/commonjs/src/hydra-apis/HydraInboxUI.d.ts.map +1 -0
  273. package/lib/typescript/commonjs/src/hydra-apis/HydraNativeEventEmitter.d.ts +35 -0
  274. package/lib/typescript/commonjs/src/hydra-apis/HydraNativeEventEmitter.d.ts.map +1 -0
  275. package/lib/typescript/commonjs/src/hydra-apis/HydraPushNotification.d.ts +6 -0
  276. package/lib/typescript/commonjs/src/hydra-apis/HydraPushNotification.d.ts.map +1 -0
  277. package/lib/typescript/commonjs/src/index.d.ts +37 -0
  278. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  279. package/lib/typescript/commonjs/src/models/HydraAccountConfig.d.ts +14 -0
  280. package/lib/typescript/commonjs/src/models/HydraAccountConfig.d.ts.map +1 -0
  281. package/lib/typescript/commonjs/src/models/HydraFirebaseRemoteConfigKeys.d.ts +13 -0
  282. package/lib/typescript/commonjs/src/models/HydraFirebaseRemoteConfigKeys.d.ts.map +1 -0
  283. package/lib/typescript/commonjs/src/models/HydraGeoConfig.d.ts +14 -0
  284. package/lib/typescript/commonjs/src/models/HydraGeoConfig.d.ts.map +1 -0
  285. package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppButtonComponent.d.ts +16 -0
  286. package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppButtonComponent.d.ts.map +1 -0
  287. package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppComponentStyle.d.ts +10 -0
  288. package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppComponentStyle.d.ts.map +1 -0
  289. package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.d.ts +9 -0
  290. package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.d.ts.map +1 -0
  291. package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppMessage.d.ts +29 -0
  292. package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppMessage.d.ts.map +1 -0
  293. package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppTemplateType.d.ts +15 -0
  294. package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppTemplateType.d.ts.map +1 -0
  295. package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppTextComponent.d.ts +11 -0
  296. package/lib/typescript/commonjs/src/models/HydraInAppMessage/HydraInAppTextComponent.d.ts.map +1 -0
  297. package/lib/typescript/commonjs/src/models/HydraLogLevel.d.ts +9 -0
  298. package/lib/typescript/commonjs/src/models/HydraLogLevel.d.ts.map +1 -0
  299. package/lib/typescript/commonjs/src/models/HydraNativeEvent.d.ts +20 -0
  300. package/lib/typescript/commonjs/src/models/HydraNativeEvent.d.ts.map +1 -0
  301. package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotification.d.ts +32 -0
  302. package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotification.d.ts.map +1 -0
  303. package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationBody.d.ts +19 -0
  304. package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationBody.d.ts.map +1 -0
  305. package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationCta.d.ts +13 -0
  306. package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationCta.d.ts.map +1 -0
  307. package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationCtaType.d.ts +13 -0
  308. package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationCtaType.d.ts.map +1 -0
  309. package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationExpandedDetails.d.ts +19 -0
  310. package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationExpandedDetails.d.ts.map +1 -0
  311. package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationGateway.d.ts +6 -0
  312. package/lib/typescript/commonjs/src/models/HydraNotification/HydraNotificationGateway.d.ts.map +1 -0
  313. package/lib/typescript/commonjs/src/models/HydraPushPreferences.d.ts +10 -0
  314. package/lib/typescript/commonjs/src/models/HydraPushPreferences.d.ts.map +1 -0
  315. package/lib/typescript/commonjs/src/models/HydraUserDetails.d.ts +16 -0
  316. package/lib/typescript/commonjs/src/models/HydraUserDetails.d.ts.map +1 -0
  317. package/lib/typescript/commonjs/src/models/HydraVisitorInfo.d.ts +6 -0
  318. package/lib/typescript/commonjs/src/models/HydraVisitorInfo.d.ts.map +1 -0
  319. package/lib/typescript/commonjs/src/models/NonHydraNotification.d.ts +9 -0
  320. package/lib/typescript/commonjs/src/models/NonHydraNotification.d.ts.map +1 -0
  321. package/lib/typescript/commonjs/src/models/UserState.d.ts +11 -0
  322. package/lib/typescript/commonjs/src/models/UserState.d.ts.map +1 -0
  323. package/lib/typescript/module/package.json +1 -0
  324. package/lib/typescript/module/src/GamificationBannerViewNativeComponent.d.ts +7 -0
  325. package/lib/typescript/module/src/GamificationBannerViewNativeComponent.d.ts.map +1 -0
  326. package/lib/typescript/module/src/GamificationEmbedViewNativeComponent.d.ts +7 -0
  327. package/lib/typescript/module/src/GamificationEmbedViewNativeComponent.d.ts.map +1 -0
  328. package/lib/typescript/module/src/GamificationLoyaltyViewNativeComponent.d.ts +7 -0
  329. package/lib/typescript/module/src/GamificationLoyaltyViewNativeComponent.d.ts.map +1 -0
  330. package/lib/typescript/module/src/NativeHydraLib.d.ts +46 -0
  331. package/lib/typescript/module/src/NativeHydraLib.d.ts.map +1 -0
  332. package/lib/typescript/module/src/components/GamificationBannerView.d.ts +6 -0
  333. package/lib/typescript/module/src/components/GamificationBannerView.d.ts.map +1 -0
  334. package/lib/typescript/module/src/components/GamificationEmbedView.d.ts +6 -0
  335. package/lib/typescript/module/src/components/GamificationEmbedView.d.ts.map +1 -0
  336. package/lib/typescript/module/src/components/GamificationLoyaltyView.d.ts +6 -0
  337. package/lib/typescript/module/src/components/GamificationLoyaltyView.d.ts.map +1 -0
  338. package/lib/typescript/module/src/hydra-apis/Hydra.d.ts +15 -0
  339. package/lib/typescript/module/src/hydra-apis/Hydra.d.ts.map +1 -0
  340. package/lib/typescript/module/src/hydra-apis/HydraCore.d.ts +18 -0
  341. package/lib/typescript/module/src/hydra-apis/HydraCore.d.ts.map +1 -0
  342. package/lib/typescript/module/src/hydra-apis/HydraInAppMessaging.d.ts +8 -0
  343. package/lib/typescript/module/src/hydra-apis/HydraInAppMessaging.d.ts.map +1 -0
  344. package/lib/typescript/module/src/hydra-apis/HydraInbox.d.ts +9 -0
  345. package/lib/typescript/module/src/hydra-apis/HydraInbox.d.ts.map +1 -0
  346. package/lib/typescript/module/src/hydra-apis/HydraInboxUI.d.ts +5 -0
  347. package/lib/typescript/module/src/hydra-apis/HydraInboxUI.d.ts.map +1 -0
  348. package/lib/typescript/module/src/hydra-apis/HydraNativeEventEmitter.d.ts +35 -0
  349. package/lib/typescript/module/src/hydra-apis/HydraNativeEventEmitter.d.ts.map +1 -0
  350. package/lib/typescript/module/src/hydra-apis/HydraPushNotification.d.ts +6 -0
  351. package/lib/typescript/module/src/hydra-apis/HydraPushNotification.d.ts.map +1 -0
  352. package/lib/typescript/module/src/index.d.ts +37 -0
  353. package/lib/typescript/module/src/index.d.ts.map +1 -0
  354. package/lib/typescript/module/src/models/HydraAccountConfig.d.ts +14 -0
  355. package/lib/typescript/module/src/models/HydraAccountConfig.d.ts.map +1 -0
  356. package/lib/typescript/module/src/models/HydraFirebaseRemoteConfigKeys.d.ts +13 -0
  357. package/lib/typescript/module/src/models/HydraFirebaseRemoteConfigKeys.d.ts.map +1 -0
  358. package/lib/typescript/module/src/models/HydraGeoConfig.d.ts +14 -0
  359. package/lib/typescript/module/src/models/HydraGeoConfig.d.ts.map +1 -0
  360. package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppButtonComponent.d.ts +16 -0
  361. package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppButtonComponent.d.ts.map +1 -0
  362. package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppComponentStyle.d.ts +10 -0
  363. package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppComponentStyle.d.ts.map +1 -0
  364. package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.d.ts +9 -0
  365. package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.d.ts.map +1 -0
  366. package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppMessage.d.ts +29 -0
  367. package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppMessage.d.ts.map +1 -0
  368. package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppTemplateType.d.ts +15 -0
  369. package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppTemplateType.d.ts.map +1 -0
  370. package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppTextComponent.d.ts +11 -0
  371. package/lib/typescript/module/src/models/HydraInAppMessage/HydraInAppTextComponent.d.ts.map +1 -0
  372. package/lib/typescript/module/src/models/HydraLogLevel.d.ts +9 -0
  373. package/lib/typescript/module/src/models/HydraLogLevel.d.ts.map +1 -0
  374. package/lib/typescript/module/src/models/HydraNativeEvent.d.ts +20 -0
  375. package/lib/typescript/module/src/models/HydraNativeEvent.d.ts.map +1 -0
  376. package/lib/typescript/module/src/models/HydraNotification/HydraNotification.d.ts +32 -0
  377. package/lib/typescript/module/src/models/HydraNotification/HydraNotification.d.ts.map +1 -0
  378. package/lib/typescript/module/src/models/HydraNotification/HydraNotificationBody.d.ts +19 -0
  379. package/lib/typescript/module/src/models/HydraNotification/HydraNotificationBody.d.ts.map +1 -0
  380. package/lib/typescript/module/src/models/HydraNotification/HydraNotificationCta.d.ts +13 -0
  381. package/lib/typescript/module/src/models/HydraNotification/HydraNotificationCta.d.ts.map +1 -0
  382. package/lib/typescript/module/src/models/HydraNotification/HydraNotificationCtaType.d.ts +13 -0
  383. package/lib/typescript/module/src/models/HydraNotification/HydraNotificationCtaType.d.ts.map +1 -0
  384. package/lib/typescript/module/src/models/HydraNotification/HydraNotificationExpandedDetails.d.ts +19 -0
  385. package/lib/typescript/module/src/models/HydraNotification/HydraNotificationExpandedDetails.d.ts.map +1 -0
  386. package/lib/typescript/module/src/models/HydraNotification/HydraNotificationGateway.d.ts +6 -0
  387. package/lib/typescript/module/src/models/HydraNotification/HydraNotificationGateway.d.ts.map +1 -0
  388. package/lib/typescript/module/src/models/HydraPushPreferences.d.ts +10 -0
  389. package/lib/typescript/module/src/models/HydraPushPreferences.d.ts.map +1 -0
  390. package/lib/typescript/module/src/models/HydraUserDetails.d.ts +16 -0
  391. package/lib/typescript/module/src/models/HydraUserDetails.d.ts.map +1 -0
  392. package/lib/typescript/module/src/models/HydraVisitorInfo.d.ts +6 -0
  393. package/lib/typescript/module/src/models/HydraVisitorInfo.d.ts.map +1 -0
  394. package/lib/typescript/module/src/models/NonHydraNotification.d.ts +9 -0
  395. package/lib/typescript/module/src/models/NonHydraNotification.d.ts.map +1 -0
  396. package/lib/typescript/module/src/models/UserState.d.ts +11 -0
  397. package/lib/typescript/module/src/models/UserState.d.ts.map +1 -0
  398. package/package.json +225 -0
  399. package/react-native-hydra-lib.podspec +256 -0
  400. package/react-native.config.js +33 -0
  401. package/sbom.spdx.json +544 -0
  402. package/scripts/HydraPods.rb +151 -0
  403. package/scripts/generate-sbom.js +367 -0
  404. package/scripts/hydra-podspecs/HydraCore.podspec +13 -0
  405. package/scripts/hydra-podspecs/HydraInAppMessage.podspec +15 -0
  406. package/scripts/hydra-podspecs/HydraInboxCore.podspec +15 -0
  407. package/scripts/hydra-podspecs/HydraInboxUI.podspec +15 -0
  408. package/scripts/hydra-podspecs/HydraPushNotification.podspec +14 -0
  409. package/scripts/hydra-podspecs/HydraPushNotificationServiceExtension.podspec +15 -0
  410. package/src/GamificationBannerViewNativeComponent.ts +10 -0
  411. package/src/GamificationEmbedViewNativeComponent.ts +10 -0
  412. package/src/GamificationLoyaltyViewNativeComponent.ts +10 -0
  413. package/src/NativeHydraLib.ts +81 -0
  414. package/src/components/GamificationBannerView.tsx +10 -0
  415. package/src/components/GamificationEmbedView.tsx +10 -0
  416. package/src/components/GamificationLoyaltyView.tsx +10 -0
  417. package/src/hydra-apis/Hydra.ts +52 -0
  418. package/src/hydra-apis/HydraCore.ts +76 -0
  419. package/src/hydra-apis/HydraInAppMessaging.ts +25 -0
  420. package/src/hydra-apis/HydraInbox.ts +33 -0
  421. package/src/hydra-apis/HydraInboxUI.ts +10 -0
  422. package/src/hydra-apis/HydraNativeEventEmitter.ts +216 -0
  423. package/src/hydra-apis/HydraPushNotification.ts +15 -0
  424. package/src/index.tsx +71 -0
  425. package/src/models/HydraAccountConfig.ts +45 -0
  426. package/src/models/HydraFirebaseRemoteConfigKeys.ts +43 -0
  427. package/src/models/HydraGeoConfig.ts +27 -0
  428. package/src/models/HydraInAppMessage/HydraInAppButtonComponent.ts +27 -0
  429. package/src/models/HydraInAppMessage/HydraInAppComponentStyle.ts +24 -0
  430. package/src/models/HydraInAppMessage/HydraInAppFeedbackSelectionType.ts +35 -0
  431. package/src/models/HydraInAppMessage/HydraInAppMessage.ts +89 -0
  432. package/src/models/HydraInAppMessage/HydraInAppTemplateType.ts +57 -0
  433. package/src/models/HydraInAppMessage/HydraInAppTextComponent.ts +18 -0
  434. package/src/models/HydraLogLevel.ts +8 -0
  435. package/src/models/HydraNativeEvent.ts +19 -0
  436. package/src/models/HydraNotification/HydraNotification.ts +97 -0
  437. package/src/models/HydraNotification/HydraNotificationBody.ts +23 -0
  438. package/src/models/HydraNotification/HydraNotificationCta.ts +20 -0
  439. package/src/models/HydraNotification/HydraNotificationCtaType.ts +59 -0
  440. package/src/models/HydraNotification/HydraNotificationExpandedDetails.ts +28 -0
  441. package/src/models/HydraNotification/HydraNotificationGateway.ts +5 -0
  442. package/src/models/HydraPushPreferences.ts +16 -0
  443. package/src/models/HydraUserDetails.ts +31 -0
  444. package/src/models/HydraVisitorInfo.ts +14 -0
  445. package/src/models/NonHydraNotification.ts +15 -0
  446. package/src/models/UserState.ts +33 -0
@@ -0,0 +1,43 @@
1
+ package com.hydralib.delegates
2
+
3
+ import android.os.Bundle
4
+ import androidx.annotation.RestrictTo
5
+ import androidx.appcompat.app.AppCompatActivity
6
+ import com.capillary.hydra.android.sdk.utils.Logger
7
+ import com.google.gson.Gson
8
+ import com.google.gson.reflect.TypeToken
9
+ import com.hydralib.eventemitter.HydraEventEmitter
10
+ import com.hydralib.eventemitter.HydraEventType
11
+
12
+ class NonHydraNotificationActivity : AppCompatActivity() {
13
+
14
+ companion object Companion {
15
+ private const val TAG = "NonHydraNotificationActivity"
16
+
17
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
18
+ const val EXTRA_REMOTE_MESSAGE = "remote_message"
19
+ }
20
+
21
+ override fun onCreate(savedInstanceState: Bundle?) {
22
+ super.onCreate(savedInstanceState)
23
+
24
+ Logger.d(TAG, "NonHydraNotificationActivity created")
25
+
26
+ // Extract notification data from intent
27
+ val remoteMessage = intent.getStringExtra(EXTRA_REMOTE_MESSAGE)
28
+
29
+ Logger.d(TAG, "Remote Message: $remoteMessage")
30
+ val gson = Gson()
31
+ val type = object : TypeToken<Map<String, Any>>() {}.type
32
+ val remoteMessageMap = gson.fromJson<Map<String, Any>>(remoteMessage, type)
33
+
34
+ // Emit event to React Native
35
+ HydraEventEmitter.sendEvent(
36
+ HydraEventType.ON_NON_HYDRA_NOTIFICATION_CLICKED,
37
+ remoteMessageMap
38
+ )
39
+
40
+ Logger.d(TAG, "Event emitted to React Native: ON_NON_HYDRA_NOTIFICATION_CLICKED")
41
+ finish()
42
+ }
43
+ }
@@ -0,0 +1,150 @@
1
+ package com.hydralib.eventemitter
2
+
3
+ import android.os.Handler
4
+ import android.os.Looper
5
+ import com.capillary.hydra.android.sdk.utils.Logger
6
+ import com.facebook.react.bridge.Arguments
7
+ import com.facebook.react.bridge.Promise
8
+ import com.facebook.react.bridge.ReactApplicationContext
9
+ import com.facebook.react.bridge.ReadableMap
10
+ import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter
11
+
12
+
13
+ // Callback interface for event completion
14
+ fun interface EventResponse {
15
+ fun onEventResponse(response: Any)
16
+ }
17
+
18
+ private data class PendingEvent(
19
+ val body: Any?,
20
+ val callback: EventResponse?
21
+ )
22
+
23
+ object HydraEventEmitter {
24
+ private var emitter: RCTDeviceEventEmitter? = null
25
+ private val activeEventTypes: ArrayList<HydraEventType> = ArrayList()
26
+ private val pendingEvents = mutableMapOf<HydraEventType, MutableList<PendingEvent>>()
27
+ private val eventsWithPendingCallback: ArrayList<PendingEvent> = ArrayList()
28
+
29
+
30
+ fun initialize(reactContext: ReactApplicationContext) {
31
+ emitter = reactContext.getJSModule(RCTDeviceEventEmitter::class.java)
32
+ }
33
+
34
+ @Synchronized
35
+ fun sendEvent(eventType: HydraEventType, body: Any?, callback: EventResponse? = null) {
36
+ if (emitter == null) {
37
+ var pendingEventsForType: MutableList<PendingEvent>? = pendingEvents[eventType]
38
+ if (pendingEventsForType == null) {
39
+ pendingEventsForType = mutableListOf()
40
+ }
41
+ pendingEventsForType.add(PendingEvent(body, callback))
42
+ pendingEvents[eventType] = pendingEventsForType
43
+
44
+ Logger.d("HydraEventEmitter.sendEvent", "eventsList for type = ${pendingEvents[eventType]?.toList()}")
45
+ } else {
46
+ if (activeEventTypes.contains(eventType)) {
47
+ Logger.d(
48
+ "HydraEventEmitter.sendEvent",
49
+ "sending event for type = ${eventType.event}\n body = $body"
50
+ )
51
+ Logger.d("HydraEventEmitter.sendEvent", "java classname of body = ${body?.javaClass?.name}")
52
+ val processedBody = if (body is Map<*, *>) Arguments.makeNativeMap(
53
+ convertMapToMutable(body)
54
+ ) else body
55
+
56
+ emitter?.emit(
57
+ eventType.event,
58
+ processedBody
59
+ )
60
+ if(callback != null) {
61
+ eventsWithPendingCallback.add(PendingEvent(body, callback))
62
+ }
63
+ }
64
+ }
65
+ }
66
+
67
+ @Synchronized
68
+ private fun sendPendingEventOfType(eventType: HydraEventType) {
69
+ Logger.d(
70
+ "HydraEventEmitter.sendPendingEventOfType",
71
+ "sendPendingEventOfType called for eventType = ${eventType.event}"
72
+ )
73
+ pendingEvents[eventType]?.forEach {
74
+ sendEvent(eventType, it.body, it.callback)
75
+ }
76
+ pendingEvents.remove(eventType)
77
+ }
78
+
79
+ @Synchronized
80
+ fun addListener(eventName: String?) {
81
+ Logger.d(
82
+ "HydraEventEmitter.addListener",
83
+ "addListener called for eventName = $eventName"
84
+ )
85
+ val eventType = HydraEventType.from(eventName!!)
86
+ if (!activeEventTypes.contains(eventType!!)) {
87
+ Logger.d(
88
+ "HydraEventEmitter.addListener",
89
+ "adding event for eventName = $eventName"
90
+ )
91
+ activeEventTypes.add(eventType)
92
+
93
+ Logger.d(
94
+ "HydraEventEmitter.addListener",
95
+ "sending pending events for eventType = ${eventType.event}"
96
+ )
97
+ Handler(Looper.getMainLooper()).postDelayed({
98
+ sendPendingEventOfType(eventType)
99
+ }, 300)
100
+ }
101
+ }
102
+
103
+ @Synchronized
104
+ fun removeListener(eventName: String?) {
105
+ Logger.d(
106
+ "HydraEventEmitter.removeListener",
107
+ "removeListener called for eventName = $eventName"
108
+ )
109
+
110
+ if (activeEventTypes.contains(HydraEventType.from(eventName!!))) {
111
+ Logger.d(
112
+ "HydraEventEmitter.removeListener",
113
+ "removing event for eventName = $eventName"
114
+ )
115
+
116
+ activeEventTypes.remove(HydraEventType.from(eventName)!!)
117
+ }
118
+ }
119
+
120
+ private fun convertMapToMutable(originalMap: Map<*, *>): Map<String, Any> {
121
+ val resultMap = mutableMapOf<String, Any>()
122
+ originalMap.forEach {
123
+ if (it.key is String && it.value != null) {
124
+ resultMap[it.key as String] = it.value!!
125
+ }
126
+ }
127
+ return resultMap
128
+ }
129
+
130
+ @Synchronized
131
+ fun onSelfHandledInAppResponse(
132
+ message: ReadableMap?,
133
+ handled: Boolean,
134
+ promise: Promise?
135
+ ) {
136
+ Logger.d(
137
+ "HydraEventEmitter.onSelfHandledInAppResponse",
138
+ "message details - type = $message"
139
+ )
140
+ val scope = if (message?.getString("scope") is String) message.getString("scope") as String else "default"
141
+ for (event in eventsWithPendingCallback) {
142
+ if (event.body is Map<*, *> && (event.body as Map<*, *>)["scope"] == scope) {
143
+ event.callback!!.onEventResponse(handled)
144
+ break
145
+ }
146
+ }
147
+ promise?.resolve(true)
148
+ // sendEvent(HydraEventType.ON_HYDRA_IN_APP_MESSAGE, detailMap, callback)
149
+ }
150
+ }
@@ -0,0 +1,44 @@
1
+ package com.hydralib.eventemitter
2
+
3
+ enum class HydraEventType(val event: String) {
4
+ ON_TOKEN_AVAILABLE("onTokenAvailable"),
5
+ ON_NON_HYDRA_NOTIFICATION_RECEIVED("onNonHydraNotificationReceived"),
6
+ ON_NON_HYDRA_NOTIFICATION_CLICKED("onNonHydraNotificationClicked"),
7
+ ON_HYDRA_NOTIFICATION_RECEIVED("onHydraNotificationReceived"),
8
+ ON_HYDRA_NOTIFICATION_CLICKED("onHydraNotificationClicked"),
9
+ ON_HYDRA_NOTIFICATION_SHOWN("onHydraNotificationShown"),
10
+ ON_HYDRA_NOTIFICATION_DISMISSED("onHydraNotificationDismissed"),
11
+ ON_NOTIFICATION_CENTER_DISMISSED("onNotificationCenterDismissed"),
12
+ ON_INBOX_UPDATED("onInboxUpdated"),
13
+ HANDLE_CUSTOM_ACTION("handleCustomAction"),
14
+ ON_HYDRA_SDK_INITIALIZATION_RESULT("onHydraSdkInitializationResult"),
15
+ ON_HYDRA_IN_APP_MESSAGE("onHydraInAppMessage"),
16
+ ON_CONFIG_FETCHED_CALLBACK("onConfigFetchedCallback"),
17
+ ON_LEGACY_FLOW_READY("onLegacyFlowReady"),
18
+ ON_VISITOR_SESSION_READY("onVisitorSessionReady"),
19
+ ON_USER_STATE_CHANGED("onUserStateChanged"),
20
+ ON_GAMIFICATION_VIEW_HEIGHT_CHANGED("onGamificationViewHeightChanged");
21
+
22
+ companion object {
23
+ fun from(eventName: String?): HydraEventType? = when (eventName) {
24
+ ON_TOKEN_AVAILABLE.event -> ON_TOKEN_AVAILABLE
25
+ ON_NON_HYDRA_NOTIFICATION_RECEIVED.event -> ON_NON_HYDRA_NOTIFICATION_RECEIVED
26
+ ON_NON_HYDRA_NOTIFICATION_CLICKED.event -> ON_NON_HYDRA_NOTIFICATION_CLICKED
27
+ ON_HYDRA_NOTIFICATION_RECEIVED.event -> ON_HYDRA_NOTIFICATION_RECEIVED
28
+ ON_HYDRA_NOTIFICATION_CLICKED.event -> ON_HYDRA_NOTIFICATION_CLICKED
29
+ ON_HYDRA_NOTIFICATION_SHOWN.event -> ON_HYDRA_NOTIFICATION_SHOWN
30
+ ON_HYDRA_NOTIFICATION_DISMISSED.event -> ON_HYDRA_NOTIFICATION_DISMISSED
31
+ ON_NOTIFICATION_CENTER_DISMISSED.event -> ON_NOTIFICATION_CENTER_DISMISSED
32
+ ON_INBOX_UPDATED.event -> ON_INBOX_UPDATED
33
+ HANDLE_CUSTOM_ACTION.event -> HANDLE_CUSTOM_ACTION
34
+ ON_HYDRA_SDK_INITIALIZATION_RESULT.event -> ON_HYDRA_SDK_INITIALIZATION_RESULT
35
+ ON_HYDRA_IN_APP_MESSAGE.event -> ON_HYDRA_IN_APP_MESSAGE
36
+ ON_CONFIG_FETCHED_CALLBACK.event -> ON_CONFIG_FETCHED_CALLBACK
37
+ ON_LEGACY_FLOW_READY.event -> ON_LEGACY_FLOW_READY
38
+ ON_VISITOR_SESSION_READY.event -> ON_VISITOR_SESSION_READY
39
+ ON_USER_STATE_CHANGED.event -> ON_USER_STATE_CHANGED
40
+ ON_GAMIFICATION_VIEW_HEIGHT_CHANGED.event -> ON_GAMIFICATION_VIEW_HEIGHT_CHANGED
41
+ else -> throw IllegalArgumentException()
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,121 @@
1
+ package com.hydralib.gamification
2
+
3
+ import android.view.View
4
+ import com.capillary.hydra.gamification.model.ContentItem
5
+ import com.capillary.hydra.gamification.model.EntryPointData
6
+ import com.capillary.hydra.gamification.ui.GamificationUIManager
7
+ import com.capillary.hydra.gamification.ui.entrypoints.BannerView
8
+ import com.facebook.react.module.annotations.ReactModule
9
+ import com.facebook.react.uimanager.SimpleViewManager
10
+ import com.facebook.react.uimanager.ThemedReactContext
11
+ import com.facebook.react.uimanager.annotations.ReactProp
12
+ import com.hydralib.eventemitter.HydraEventEmitter
13
+ import com.hydralib.eventemitter.HydraEventType
14
+ import com.hydralib.hydrasdk.HydraCore
15
+
16
+ @ReactModule(name = GamificationBannerViewManager.NAME)
17
+ class GamificationBannerViewManager : SimpleViewManager<BannerView>() {
18
+
19
+ override fun getName(): String = NAME
20
+
21
+ override fun createViewInstance(context: ThemedReactContext): BannerView =
22
+ BannerView(HydraCore.curReactActivity ?: context)
23
+
24
+ @ReactProp(name = "bannerId")
25
+ fun setBannerId(view: BannerView, bannerId: String?) {
26
+ if (bannerId.isNullOrEmpty()) return
27
+ val data = findEntryPointByBannerId(bannerId) ?: return
28
+
29
+ // Defer bind until Yoga has measured and laid out the view
30
+ if (view.width > 0 && view.height > 0) {
31
+ bindWithLayout(view, data, bannerId)
32
+ } else {
33
+ view.addOnLayoutChangeListener(object : View.OnLayoutChangeListener {
34
+ override fun onLayoutChange(
35
+ v: View, left: Int, top: Int, right: Int, bottom: Int,
36
+ oldLeft: Int, oldTop: Int, oldRight: Int, oldBottom: Int
37
+ ) {
38
+ if (right - left > 0 && bottom - top > 0) {
39
+ view.removeOnLayoutChangeListener(this)
40
+ bindWithLayout(view, data, bannerId)
41
+ }
42
+ }
43
+ })
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Wire callbacks, let BannerView calculate height from dashboard config,
49
+ * then force a measure/layout pass with the SDK-computed dimensions.
50
+ *
51
+ * Height strategy:
52
+ * - Set layoutParams.height = 0 so BannerView enters SDK-managed path
53
+ * and uses dashboard container.height (direct dp value)
54
+ * - After bind(), BannerView updates layoutParams.height to the computed value
55
+ * - We read that back, force measure/layout, and emit to RN
56
+ */
57
+ private fun bindWithLayout(view: BannerView, data: EntryPointData, bannerId: String) {
58
+ val w = view.width
59
+ val activity = HydraCore.curReactActivity
60
+
61
+ // Set height to 0 so BannerView.bind() enters SDK-managed path
62
+ // and calculates height from dashboard container.height (dp)
63
+ view.layoutParams?.let { lp ->
64
+ lp.width = w
65
+ lp.height = 0
66
+ }
67
+
68
+ // Campaign banner lookup — resolves campaignId → CampaignBanner
69
+ // Required for DYNAMIC_MULTISTEP entry points
70
+ view.campaignBannerLookup = { campaignId ->
71
+ HydraCore.getFlowManager()?.getCampaignBanner(campaignId)
72
+ }
73
+
74
+ // Notify server that the entry point was shown
75
+ view.onEntryPointLoad = { ep ->
76
+ HydraCore.getFlowManager()?.onEntryPointShown(ep.id, "BANNER")
77
+ }
78
+
79
+ // Handle click — delegates to GamificationUIManager for action routing
80
+ // (OPEN_DEEPLINK, OPEN_WALLET, OPEN_WEBLINK, campaign opening)
81
+ view.onEntryPointClick = { ep, contentItem ->
82
+ if (activity != null) {
83
+ HydraCore.getGamificationUIManager()?.handleEntryPointAction(activity, ep, contentItem)
84
+ }
85
+ }
86
+
87
+ view.bind(data)
88
+
89
+ // After bind(), BannerView has computed the height from dashboard config
90
+ // and updated layoutParams.height. Read it back.
91
+ val sdkHeight = view.layoutParams?.height ?: 0
92
+ val finalHeight = if (sdkHeight > 0) sdkHeight else view.height
93
+
94
+ // Force measure/layout with SDK-computed dimensions — RN parent swallows
95
+ // requestLayout() so BannerView's internal views never get measured otherwise
96
+ view.measure(
97
+ View.MeasureSpec.makeMeasureSpec(w, View.MeasureSpec.EXACTLY),
98
+ View.MeasureSpec.makeMeasureSpec(finalHeight, View.MeasureSpec.EXACTLY)
99
+ )
100
+ view.layout(view.left, view.top, view.left + w, view.top + finalHeight)
101
+
102
+ // Emit the SDK-computed height to RN so JS side can update its style
103
+ if (finalHeight > 0) {
104
+ val heightDp = finalHeight / view.resources.displayMetrics.density
105
+ HydraEventEmitter.sendEvent(
106
+ HydraEventType.ON_GAMIFICATION_VIEW_HEIGHT_CHANGED,
107
+ mapOf("height" to heightDp, "entryPointId" to bannerId)
108
+ )
109
+ }
110
+ }
111
+
112
+ private fun findEntryPointByBannerId(bannerId: String): EntryPointData? {
113
+ val flowManager = HydraCore.getFlowManager() ?: return null
114
+ val entryPoints = flowManager.getFilteredEntryPoints(null)
115
+ return entryPoints.find { it.mobile?.container?.bannerId == bannerId }
116
+ }
117
+
118
+ companion object {
119
+ const val NAME = "GamificationBannerView"
120
+ }
121
+ }
@@ -0,0 +1,153 @@
1
+ package com.hydralib.gamification
2
+
3
+ import android.view.View
4
+ import android.view.ViewTreeObserver
5
+ import com.capillary.hydra.gamification.model.EntryPointData
6
+ import com.capillary.hydra.gamification.ui.entrypoints.EmbedWebView
7
+ import com.facebook.react.module.annotations.ReactModule
8
+ import com.facebook.react.uimanager.SimpleViewManager
9
+ import com.facebook.react.uimanager.ThemedReactContext
10
+ import com.facebook.react.uimanager.annotations.ReactProp
11
+ import com.hydralib.eventemitter.HydraEventEmitter
12
+ import com.hydralib.eventemitter.HydraEventType
13
+ import com.hydralib.hydrasdk.HydraCore
14
+ import kotlinx.coroutines.CoroutineScope
15
+ import kotlinx.coroutines.Dispatchers
16
+ import kotlinx.coroutines.launch
17
+
18
+ @ReactModule(name = GamificationEmbedViewManager.NAME)
19
+ class GamificationEmbedViewManager : SimpleViewManager<EmbedWebView>() {
20
+
21
+ // Tracks the active OnPreDrawListener per view so it can be removed on re-bind/drop
22
+ // instead of stacking a new listener on top on every setEmbedId call.
23
+ private val preDrawListeners = mutableMapOf<EmbedWebView, ViewTreeObserver.OnPreDrawListener>()
24
+
25
+ override fun getName(): String = NAME
26
+
27
+ override fun createViewInstance(context: ThemedReactContext): EmbedWebView =
28
+ EmbedWebView(HydraCore.curReactActivity ?: context)
29
+
30
+ @ReactProp(name = "embedId")
31
+ fun setEmbedId(view: EmbedWebView, embedId: String?) {
32
+ if (embedId.isNullOrEmpty()) return
33
+ // Guard: don't re-bind if already bound to this embedId. Without this, every RN
34
+ // re-render (triggered by the height-changed event) calls bindWithLayout again and
35
+ // accumulates an additional OnPreDrawListener, producing an infinite emit loop.
36
+ if (view.tag == embedId) return
37
+ val data = findEntryPointByEmbedId(embedId) ?: return
38
+
39
+ // Defer bind until Yoga has measured and laid out the view
40
+ if (view.width > 0 && view.height > 0) {
41
+ view.tag = embedId
42
+ bindWithLayout(view, data, embedId)
43
+ } else {
44
+ view.addOnLayoutChangeListener(object : View.OnLayoutChangeListener {
45
+ override fun onLayoutChange(
46
+ v: View, left: Int, top: Int, right: Int, bottom: Int,
47
+ oldLeft: Int, oldTop: Int, oldRight: Int, oldBottom: Int
48
+ ) {
49
+ if (right - left > 0 && bottom - top > 0) {
50
+ view.removeOnLayoutChangeListener(this)
51
+ view.tag = embedId
52
+ bindWithLayout(view, data, embedId)
53
+ }
54
+ }
55
+ })
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Sync layoutParams with Yoga's actual dimensions, wire callbacks, call bind(),
61
+ * then force a measure/layout pass on the children.
62
+ */
63
+ private fun bindWithLayout(view: EmbedWebView, data: EntryPointData, embedId: String) {
64
+ val w = view.width
65
+ val h = view.height
66
+ val activity = HydraCore.curReactActivity ?: return
67
+
68
+ // Sync layoutParams with Yoga's actual pixel dimensions
69
+ // so SDK sees a positive height and takes host-controlled path
70
+ view.layoutParams?.let { lp ->
71
+ lp.width = w
72
+ lp.height = h
73
+ }
74
+
75
+ // Campaign URL lookup — resolves campaignId → campaign WebView URL
76
+ view.campaignUrlLookup = { campaignId ->
77
+ HydraCore.getFlowManager()?.getCampaignUrl(campaignId)
78
+ }
79
+
80
+ // Resync after game played
81
+ view.onGamePlayed = {
82
+ CoroutineScope(Dispatchers.Main).launch {
83
+ HydraCore.getFlowManager()?.resync()
84
+ }
85
+ }
86
+
87
+ // Notify server that the entry point was shown
88
+ view.onEntryPointLoad = { ep ->
89
+ HydraCore.getFlowManager()?.onEntryPointShown(ep.id, "EMBEDDED")
90
+ }
91
+
92
+ view.bind(data, activity)
93
+
94
+ // Force measure/layout of children — RN parent swallows requestLayout()
95
+ // so EmbedWebView's internal WebView never gets measured otherwise
96
+ view.measure(
97
+ View.MeasureSpec.makeMeasureSpec(w, View.MeasureSpec.EXACTLY),
98
+ View.MeasureSpec.makeMeasureSpec(h, View.MeasureSpec.EXACTLY)
99
+ )
100
+ view.layout(view.left, view.top, view.right, view.bottom)
101
+
102
+ // Detect height changes from changeHeight() ValueAnimator.
103
+ // RN's Yoga parent swallows requestLayout(), so onLayoutChange never fires
104
+ // when layoutParams.height is updated by the animator. Instead, use
105
+ // OnPreDrawListener which fires before every draw — the animator drives
106
+ // draws on each frame, so we can detect layoutParams.height changes here.
107
+ // Remove any listener from a previous bind before adding a new one — setEmbedId's
108
+ // tag guard normally prevents re-binding, but this keeps the class correct on its own.
109
+ preDrawListeners.remove(view)?.let { view.viewTreeObserver.removeOnPreDrawListener(it) }
110
+
111
+ var lastEmittedHeight = h
112
+ val preDrawListener = object : ViewTreeObserver.OnPreDrawListener {
113
+ override fun onPreDraw(): Boolean {
114
+ val newHeight = view.layoutParams?.height ?: return true
115
+ if (newHeight > 0 && newHeight != lastEmittedHeight) {
116
+ lastEmittedHeight = newHeight
117
+ val heightDp = newHeight / view.resources.displayMetrics.density
118
+ HydraEventEmitter.sendEvent(
119
+ HydraEventType.ON_GAMIFICATION_VIEW_HEIGHT_CHANGED,
120
+ mapOf("height" to heightDp, "entryPointId" to embedId)
121
+ )
122
+
123
+ // Force re-measure/layout with new dimensions so WebView content
124
+ // doesn't clip — RN swallows requestLayout()
125
+ view.measure(
126
+ View.MeasureSpec.makeMeasureSpec(view.width, View.MeasureSpec.EXACTLY),
127
+ View.MeasureSpec.makeMeasureSpec(newHeight, View.MeasureSpec.EXACTLY)
128
+ )
129
+ view.layout(view.left, view.top, view.left + view.width, view.top + newHeight)
130
+ }
131
+ return true
132
+ }
133
+ }
134
+ view.viewTreeObserver.addOnPreDrawListener(preDrawListener)
135
+ preDrawListeners[view] = preDrawListener
136
+ }
137
+
138
+ private fun findEntryPointByEmbedId(embedId: String): EntryPointData? {
139
+ val flowManager = HydraCore.getFlowManager() ?: return null
140
+ val entryPoints = flowManager.getFilteredEntryPoints(null)
141
+ return entryPoints.find { it.mobile?.container?.bannerId == embedId }
142
+ }
143
+
144
+ override fun onDropViewInstance(view: EmbedWebView) {
145
+ preDrawListeners.remove(view)?.let { view.viewTreeObserver.removeOnPreDrawListener(it) }
146
+ view.destroy()
147
+ super.onDropViewInstance(view)
148
+ }
149
+
150
+ companion object {
151
+ const val NAME = "GamificationEmbedView"
152
+ }
153
+ }
@@ -0,0 +1,95 @@
1
+ package com.hydralib.gamification
2
+
3
+ import android.view.View
4
+ import com.capillary.hydra.gamification.model.LoyaltyUrl
5
+ import com.capillary.hydra.gamification.ui.entrypoints.LoyaltyEmbedView
6
+ import com.facebook.react.module.annotations.ReactModule
7
+ import com.facebook.react.uimanager.SimpleViewManager
8
+ import com.facebook.react.uimanager.ThemedReactContext
9
+ import com.facebook.react.uimanager.annotations.ReactProp
10
+ import com.hydralib.hydrasdk.HydraCore
11
+ import kotlinx.coroutines.CoroutineScope
12
+ import kotlinx.coroutines.Dispatchers
13
+ import kotlinx.coroutines.launch
14
+
15
+ @ReactModule(name = GamificationLoyaltyViewManager.NAME)
16
+ class GamificationLoyaltyViewManager : SimpleViewManager<LoyaltyEmbedView>() {
17
+
18
+ override fun getName(): String = NAME
19
+
20
+ override fun createViewInstance(context: ThemedReactContext): LoyaltyEmbedView =
21
+ LoyaltyEmbedView(HydraCore.curReactActivity ?: context)
22
+
23
+ @ReactProp(name = "loyaltyId")
24
+ fun setLoyaltyId(view: LoyaltyEmbedView, loyaltyId: String?) {
25
+ if (loyaltyId.isNullOrEmpty()) return
26
+ val loyaltyUrl = findLoyaltyUrlById(loyaltyId) ?: return
27
+
28
+ // Defer bind until Yoga has measured and laid out the view
29
+ if (view.width > 0 && view.height > 0) {
30
+ bindWithLayout(view, loyaltyUrl)
31
+ } else {
32
+ view.addOnLayoutChangeListener(object : View.OnLayoutChangeListener {
33
+ override fun onLayoutChange(
34
+ v: View, left: Int, top: Int, right: Int, bottom: Int,
35
+ oldLeft: Int, oldTop: Int, oldRight: Int, oldBottom: Int
36
+ ) {
37
+ if (right - left > 0 && bottom - top > 0) {
38
+ view.removeOnLayoutChangeListener(this)
39
+ bindWithLayout(view, loyaltyUrl)
40
+ }
41
+ }
42
+ })
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Loyalty height strategy: fill whatever RN gives, content scrolls inside.
48
+ * Same as native Android (MATCH_PARENT × MATCH_PARENT).
49
+ * No dashboard config, no DIMENSIONS_UPDATE, no dynamic resizing.
50
+ */
51
+ private fun bindWithLayout(view: LoyaltyEmbedView, loyaltyUrl: LoyaltyUrl) {
52
+ val w = view.width
53
+ val h = view.height
54
+ val activity = HydraCore.curReactActivity ?: return
55
+ val flowManager = HydraCore.getFlowManager() ?: return
56
+
57
+ // Sync layoutParams with Yoga's actual pixel dimensions
58
+ view.layoutParams?.let { lp ->
59
+ lp.width = w
60
+ lp.height = h
61
+ }
62
+
63
+ // Resync after game played
64
+ view.onGamePlayed = {
65
+ CoroutineScope(Dispatchers.Main).launch {
66
+ HydraCore.getFlowManager()?.resync()
67
+ }
68
+ }
69
+
70
+ val capToken = flowManager.getCapToken()
71
+ view.bind(loyaltyUrl.url, capToken, activity)
72
+
73
+ // Force measure/layout of children — RN parent swallows requestLayout()
74
+ // so LoyaltyEmbedView's internal WebView never gets measured otherwise
75
+ view.measure(
76
+ View.MeasureSpec.makeMeasureSpec(w, View.MeasureSpec.EXACTLY),
77
+ View.MeasureSpec.makeMeasureSpec(h, View.MeasureSpec.EXACTLY)
78
+ )
79
+ view.layout(view.left, view.top, view.right, view.bottom)
80
+ }
81
+
82
+ private fun findLoyaltyUrlById(loyaltyId: String): LoyaltyUrl? {
83
+ val flowManager = HydraCore.getFlowManager() ?: return null
84
+ return flowManager.getLoyaltyUrls().find { it.embedId == loyaltyId }
85
+ }
86
+
87
+ override fun onDropViewInstance(view: LoyaltyEmbedView) {
88
+ view.destroy()
89
+ super.onDropViewInstance(view)
90
+ }
91
+
92
+ companion object {
93
+ const val NAME = "GamificationLoyaltyView"
94
+ }
95
+ }