@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,53 @@
1
+ package com.hydralib
2
+
3
+ import com.facebook.react.TurboReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.module.model.ReactModuleInfo
7
+ import com.facebook.react.module.model.ReactModuleInfoProvider
8
+ import com.facebook.react.uimanager.ViewManager
9
+ import com.hydralib.gamification.GamificationBannerViewManager
10
+ import com.hydralib.gamification.GamificationEmbedViewManager
11
+ import com.hydralib.gamification.GamificationLoyaltyViewManager
12
+ import java.util.HashMap
13
+
14
+ class HydraLibPackage : TurboReactPackage() {
15
+ override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
16
+ return if (name == HydraLibModule.NAME) {
17
+ HydraLibModule(reactContext)
18
+ } else {
19
+ null
20
+ }
21
+ }
22
+
23
+ override fun createViewManagers(
24
+ reactContext: ReactApplicationContext
25
+ ): List<ViewManager<*, *>> = listOf(
26
+ GamificationBannerViewManager(),
27
+ GamificationEmbedViewManager(),
28
+ GamificationLoyaltyViewManager(),
29
+ )
30
+
31
+ override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
32
+ return ReactModuleInfoProvider {
33
+ val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
34
+ val isTurboModule: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
35
+ val name = HydraLibModule.NAME
36
+ val className = HydraLibModule.NAME
37
+ val canOverrideExistingModule = false
38
+ val needsEagerInit = false
39
+ val isCxxModule= false
40
+
41
+
42
+ moduleInfos[HydraLibModule.NAME] = ReactModuleInfo(
43
+ name,
44
+ className,
45
+ canOverrideExistingModule,
46
+ needsEagerInit,
47
+ isCxxModule,
48
+ isTurboModule // isTurboModule
49
+ )
50
+ moduleInfos
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,196 @@
1
+ //
2
+ // HydraApplicationDelegate.swift
3
+ // react-native-hydra-lib
4
+ //
5
+ // Created by Sandesh Kumar Jain on 01/01/25.
6
+ //
7
+
8
+ import Foundation
9
+ import FirebaseCore
10
+ import FirebaseMessaging
11
+ import FirebaseRemoteConfig
12
+ #if HYDRA_USE_SPM
13
+ // GoogleUtilities has no single SPM product matching the CocoaPods umbrella
14
+ // module - only granular GUL* products exist. The GULAppDelegateSwizzler
15
+ // product wraps a target literally named "GoogleUtilities-AppDelegateSwizzler"
16
+ // (see GoogleUtilities/Package.swift) - Swift mangles the hyphen to an
17
+ // underscore for the actual importable module name, which differs from the
18
+ // product name used for linking.
19
+ import GoogleUtilities_AppDelegateSwizzler
20
+ #else
21
+ import GoogleUtilities
22
+ #endif
23
+ import React
24
+ import HydraCore
25
+
26
+ @objc public final class HydraApplicationDelegate: NSObject, UIApplicationDelegate{
27
+ @objc public static let shared = HydraApplicationDelegate()
28
+
29
+
30
+ private override init() {
31
+
32
+ }
33
+
34
+ fileprivate func setupNavigationController(_ application: UIApplication) {
35
+ //Create and set NavigationController as rootController, will be required to show NotificationCenter
36
+ let storyboard = UIStoryboard(name: Bundle.main.infoDictionary?["UILaunchStoryboardName"] as? String ?? "LaunchScreen", bundle: nil)
37
+ let viewController = storyboard.instantiateInitialViewController()
38
+ let navigationController = UINavigationController(rootViewController: viewController!)
39
+ let rootController = application.delegate!.window!!.rootViewController!
40
+
41
+ application.delegate?.window??.rootViewController = navigationController
42
+ navigationController.setViewControllers([rootController], animated: true)
43
+ navigationController.delegate = self
44
+ HydraInboxUI.shared.setNavigationController(navController: navigationController)
45
+ }
46
+
47
+ fileprivate func setupAppDelegateProxy() {
48
+ var appDelegateProxyEnabled = true
49
+ if let hydraProxyEnabledPlistValue = Bundle.main.infoDictionary?["HydraAppDelegateProxyEnabled"], hydraProxyEnabledPlistValue is Bool{
50
+ appDelegateProxyEnabled = hydraProxyEnabledPlistValue as! Bool
51
+ }
52
+ if appDelegateProxyEnabled{
53
+ if HydraSDKCore.isPushNotificationEnabled(){
54
+ if FirebaseApp.app() == nil{
55
+ FirebaseApp.configure()
56
+ }
57
+ Messaging.messaging().delegate = HydraFirebaseMessagingDelegate.shared
58
+ }
59
+ UNUserNotificationCenter.current().delegate = HydraUNUserNotificationCenterDelegate.shared
60
+
61
+ GULAppDelegateSwizzler.proxyOriginalDelegate()
62
+ GULAppDelegateSwizzler.proxyOriginalDelegateIncludingAPNSMethods()
63
+ GULAppDelegateSwizzler.registerAppDelegateInterceptor(self)
64
+ }
65
+ Logger.info("HydraApplicationDelegate: setupAppDelegateProxy: appDelegateProxyEnabled = \(appDelegateProxyEnabled)")
66
+ }
67
+
68
+ @objc public func initApplication(
69
+ _ application: UIApplication,
70
+ didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?,
71
+ hydraRemoteConfig : HydraNativeRemoteConfig
72
+ ){
73
+ //SetUp NavigationController
74
+ setupNavigationController(application)
75
+
76
+ //Use AppDelegate swizzling to get the callbacks inside the library
77
+ setupAppDelegateProxy()
78
+
79
+ application.registerForRemoteNotifications()
80
+
81
+ Task{
82
+ let isInitialized = await initializeUsingPersistedData()
83
+ if !isInitialized{
84
+ Logger.debug("HydraApplicationDelegate: application: didFinishLaunchingWithOptions: initiliazing hydra using passed remote config")
85
+ HydraSDKCore.shared.initializeHydra(hydraRemoteConfig)
86
+ }
87
+ if HydraSDKCore.shared.hydra != nil {
88
+ HydraPushNotification.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
89
+ Logger.info("HydraApplicationDelegate: application: didFinishLaunchingWithOptions: hydraRemoteConfig")
90
+ }
91
+ }
92
+ }
93
+
94
+ @objc public func initApplicationWithFirebaseRemoteConfig(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) {
95
+ initApplicationWithFirebaseRemoteConfigKeys(application, didFinishLaunchingWithOptions: launchOptions, firebaseRemoteConfigKeys: HydraNativeFirebaseRemoteConfigKeys(keyForAccountId: "hydra_account_id", keyForBaseUrl: "hydra_base_url", keyForSsl: "hydra_ssl_public_key", keyForRemoteLogLevel: "hydra_remote_log_level", keyForOrgId: "hydra_org_id", keyForGamificationKey: "hydra_gamification_key", keyForGamificationRegion: "hydra_gamification_region", keyForGamificationBaseUrl: "hydra_gamification_base_url"))
96
+ }
97
+
98
+ @objc public func initApplicationWithFirebaseRemoteConfigKeys(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?, firebaseRemoteConfigKeys : HydraNativeFirebaseRemoteConfigKeys) {
99
+ //SetUp NavigationController
100
+ setupNavigationController(application)
101
+
102
+ //Use AppDelegate swizzling to get the callbacks inside the library
103
+ setupAppDelegateProxy()
104
+
105
+ application.registerForRemoteNotifications()
106
+
107
+ Task {
108
+ let isInitialized = await initializeUsingPersistedData()
109
+ if !isInitialized {
110
+ Logger.debug("HydraApplicationDelegate: application: didFinishLaunchingWithOptions: remoteConfig: using passed firebase remote config keys")
111
+ await fetchAndActivateRemoteConfigAndInitializeHydra(firebaseRemoteConfigKeys: firebaseRemoteConfigKeys)
112
+ }
113
+
114
+ if HydraSDKCore.shared.hydra != nil {
115
+ HydraPushNotification.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
116
+ Logger.info("HydraApplicationDelegate: application: didFinishLaunchingWithOptions: remoteConfig: Completed")
117
+ }
118
+ }
119
+ }
120
+
121
+ func loadPresistedHydraRemoteConfig() -> HydraNativeRemoteConfig? {
122
+ let configDict = Hydra.getSharedUserDefaults()?.dictionary(forKey: HydraRNConstants.hydraRemoreConfig)
123
+ if let configDict = configDict{
124
+ return HydraNativeRemoteConfig.fromDictionary(configDict)
125
+ }else{
126
+ return nil
127
+ }
128
+ }
129
+
130
+ func loadPersistedFirebaseRemoteConfigKeys() -> HydraNativeFirebaseRemoteConfigKeys? {
131
+ let configDict = Hydra.getSharedUserDefaults()?.dictionary(forKey: HydraRNConstants.hydraFirebaseRemoteConfigKeys)
132
+ if let configDict = configDict{
133
+ return HydraNativeFirebaseRemoteConfigKeys.fromDictionary(configDict)
134
+ }else{
135
+ return nil
136
+ }
137
+ }
138
+
139
+ private func initializeUsingPersistedData() async -> Bool{
140
+ if let persistedHydraRemoteConfig = loadPresistedHydraRemoteConfig() {
141
+ Logger.debug("HydraApplicationDelegate: initializeUsingPersistedData: Found persisted config, initializing Hydra")
142
+ HydraSDKCore.shared.initializeHydra(persistedHydraRemoteConfig)
143
+ return true
144
+ }
145
+
146
+ if let persistedFirebaseRemoteConfigKeys = loadPersistedFirebaseRemoteConfigKeys() {
147
+ Logger.debug("HydraApplicationDelegate: initializeUsingPersistedData: Found persisted firebase config keys, fetching and activating remote config")
148
+ await fetchAndActivateRemoteConfigAndInitializeHydra(firebaseRemoteConfigKeys: persistedFirebaseRemoteConfigKeys)
149
+ return true
150
+ }
151
+ return false
152
+ }
153
+
154
+ private func fetchAndActivateRemoteConfigAndInitializeHydra(firebaseRemoteConfigKeys: HydraNativeFirebaseRemoteConfigKeys)
155
+ async {
156
+ let remoteConfig = RemoteConfig.remoteConfig()
157
+ remoteConfig.configSettings.minimumFetchInterval = 0
158
+
159
+ do {
160
+ try await remoteConfig.fetchAndActivate()
161
+ let hydraRemoteConfig = HydraSDKCore.shared.processFirebaseRemoteConfig(firebaseRemoteConfigKeys)
162
+
163
+ if let hydraRemoteConfig = hydraRemoteConfig {
164
+ HydraSDKCore.shared.initializeHydra(hydraRemoteConfig)
165
+ }
166
+ else {
167
+ Logger.error("HydraApplicationDelegate: fetchAndActivateRemoteConfigAndInitializeHydra accountId or baseUrl or sslPublicKey doesnot have valid values")
168
+ HydraSDKCore.shared.sendHydraSdkInitializationResultEvent(false, "accountId or baseUrl or sslPublicKey doesnot have valid values")
169
+ }
170
+ } catch {
171
+ let errorMessage = "Failed to fetch remote config error = \(error)"
172
+ Logger.error("HydraApplicationDelegate: fetchAndActivateRemoteConfigAndInitializeHydra: \(errorMessage)")
173
+ HydraSDKCore.shared.sendHydraSdkInitializationResultEvent(false, errorMessage)
174
+ }
175
+ }
176
+
177
+
178
+
179
+ public func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
180
+ HydraPushNotification.shared.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken)
181
+ }
182
+
183
+ public func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: any Error) {
184
+ HydraPushNotification.shared.application(application, didFailToRegisterForRemoteNotificationsWithError: error)
185
+ }
186
+
187
+ public func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
188
+ HydraPushNotification.shared.application(application, didReceiveRemoteNotification: userInfo, fetchCompletionHandler: completionHandler)
189
+ }
190
+ }
191
+
192
+ extension HydraApplicationDelegate: UINavigationControllerDelegate{
193
+ public func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
194
+ HydraInboxUI.shared.navigationControllerViewWillChange(viewController)
195
+ }
196
+ }
@@ -0,0 +1,20 @@
1
+ //
2
+ // FirebaseMessagingDelegate.swift
3
+ // react-native-hydra-lib
4
+ //
5
+ // Created by Sandesh Kumar Jain on 24/12/24.
6
+ //
7
+
8
+ import Foundation
9
+ import FirebaseMessaging
10
+ final class HydraFirebaseMessagingDelegate : NSObject, MessagingDelegate{
11
+ public static let shared = HydraFirebaseMessagingDelegate()
12
+
13
+ private override init() {
14
+
15
+ }
16
+
17
+ public func messaging(_ messaging: Messaging, didReceiveRegistrationToken token: String?) {
18
+ HydraPushNotification.shared.messaging(messaging, didReceiveRegistrationToken: token)
19
+ }
20
+ }
@@ -0,0 +1,26 @@
1
+ //
2
+ // HydraUNUserNotificationCenterDelegate.swift
3
+ // react-native-hydra-lib
4
+ //
5
+ // Created by Sandesh Kumar Jain on 24/12/24.
6
+ //
7
+
8
+ import Foundation
9
+ import FirebaseMessaging
10
+
11
+ final class HydraUNUserNotificationCenterDelegate : NSObject, UNUserNotificationCenterDelegate{
12
+
13
+ public static let shared = HydraUNUserNotificationCenterDelegate()
14
+
15
+ private override init() {
16
+
17
+ }
18
+
19
+ public func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void){
20
+ HydraPushNotification.shared.userNotificationCenter(center, willPresent: notification, withCompletionHandler: completionHandler)
21
+ }
22
+
23
+ public func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void){
24
+ HydraPushNotification.shared.userNotificationCenter(center, didReceive: response, withCompletionHandler: completionHandler)
25
+ }
26
+ }
@@ -0,0 +1,98 @@
1
+ //
2
+ // HydraEventEmitter.swift
3
+ // react-native-hydra-lib
4
+ //
5
+ // Created by Sandesh Kumar Jain on 06/01/25.
6
+ //
7
+
8
+ import Foundation
9
+ import HydraCore
10
+ import React
11
+
12
+ // Callback protocol for event completion
13
+ @objc public protocol EventResponse {
14
+ func onEventResponse(_ response: Any)
15
+ }
16
+
17
+ // Struct to hold pending event data
18
+ private struct PendingEvent {
19
+ let body: Any?
20
+ let callback: EventResponse?
21
+ }
22
+
23
+ @objc public final class HydraEventEmitter : NSObject{
24
+
25
+ private var activeEventTypes : [String] = []
26
+ private var emitterInitialized : Bool = false
27
+ private var pendingEvents : [String : [PendingEvent]] = [:]
28
+ private var eventsWithPendingCallback: [PendingEvent] = []
29
+ @objc public static let shared = HydraEventEmitter()
30
+
31
+
32
+ private override init(){
33
+ super.init()
34
+ }
35
+
36
+ @objc public func setEmitterInitialized(){
37
+ emitterInitialized = true
38
+ }
39
+
40
+ @objc public func sendEvent(_ eventType: String, body: Any?, callback: EventResponse? = nil){
41
+ if emitterInitialized && activeEventTypes.contains(eventType) {
42
+ Logger.info("HydraEventEmitter: sendEvent: eventType = \(eventType), body = \(body ?? "")")
43
+ HydraNativeEmitterBrigde.sharedInstance().sendEvent(withName: eventType, body: body)
44
+
45
+ // Store callback if provided
46
+ if let callback = callback {
47
+ eventsWithPendingCallback.append(PendingEvent(body: body, callback: callback))
48
+ }
49
+ } else {
50
+ // Queue event — either emitter not yet initialized, or listener not yet registered
51
+ var pendingEventsForType = pendingEvents[eventType] ?? []
52
+ pendingEventsForType.append(PendingEvent(body: body, callback: callback))
53
+ pendingEvents[eventType] = pendingEventsForType
54
+ }
55
+ }
56
+
57
+ @objc public func supportedEvents() -> [String]{
58
+ HydraEventType.allCases.map { $0.rawValue }
59
+ }
60
+
61
+ private func sendPendingEventsOfType(_ eventType : String){
62
+ pendingEvents[eventType]?.forEach{ pendingEvent in
63
+ sendEvent(eventType, body: pendingEvent.body, callback: pendingEvent.callback)
64
+ }
65
+ pendingEvents[eventType] = nil
66
+ }
67
+
68
+ @objc public func addListener(eventName : String) {
69
+ if !activeEventTypes.contains(eventName){
70
+ Logger.debug("HydraEventEmitter: addListener: adding event = \(eventName)")
71
+ activeEventTypes.append(eventName)
72
+ sendPendingEventsOfType(eventName)
73
+ }
74
+ }
75
+
76
+ @objc public func removeListener(eventName : String) {
77
+ if activeEventTypes.contains(eventName) {
78
+ Logger.debug("HydraEventEmitter: removeListener: removing event = \(eventName)")
79
+ activeEventTypes.removeAll(where: {$0 == eventName})
80
+ }
81
+ }
82
+
83
+ @objc public func onSelfHandledInAppResponse(message: [String: Any]?, handled: Bool, resolve : RCTPromiseResolveBlock?, reject : RCTPromiseRejectBlock?) -> Void{
84
+ Logger.info("HydraEventEmitter: onSelfHandledInAppResponse: message details - type = \(message?["templateType"] ?? ""), title = \(message?["title"] ?? ""), message = \(message?["message"] ?? "")")
85
+
86
+ let scope = message?["scope"] as? String ?? "default"
87
+
88
+ // Find and execute callback for matching scope
89
+ for (index, event) in eventsWithPendingCallback.enumerated() {
90
+ if let eventBody = event.body as? [String: Any], eventBody["scope"] as? String == scope {
91
+ event.callback?.onEventResponse(handled)
92
+ eventsWithPendingCallback.remove(at: index)
93
+ break
94
+ }
95
+ }
96
+ resolve?(true)
97
+ }
98
+ }
@@ -0,0 +1,28 @@
1
+ //
2
+ // HydraEventType.swift
3
+ // react-native-hydra-lib
4
+ //
5
+ // Created by Sandesh Kumar Jain on 06/01/25.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ enum HydraEventType : String, CaseIterable{
11
+ case ON_TOKEN_AVAILABLE = "onTokenAvailable"
12
+ case ON_NON_HYDRA_NOTIFICATION_RECEIVED = "onNonHydraNotificationReceived"
13
+ case ON_NON_HYDRA_NOTIFICATION_CLICKED = "onNonHydraNotificationClicked"
14
+ case ON_HYDRA_NOTIFICATION_RECEIVED = "onHydraNotificationReceived"
15
+ case ON_HYDRA_NOTIFICATION_CLICKED = "onHydraNotificationClicked"
16
+ case ON_HYDRA_NOTIFICATION_SHOWN = "onHydraNotificationShown"
17
+ case ON_HYDRA_NOTIFICATION_DISMISSED = "onHydraNotificationDismissed"
18
+ case ON_INBOX_UPDATED = "onInboxUpdated"
19
+ case ON_NOTIFICATION_CENTER_DISMISSED = "onNotificationCenterDismissed"
20
+ case ON_NOTIFICATION_CENTER_SHOWN = "onNotificationCenterShown"
21
+ case ON_HYDRA_SDK_INITIALIZATION_RESULT = "onHydraSdkInitializationResult"
22
+ case ON_HYDRA_IN_APP_MESSAGE = "onHydraInAppMessage"
23
+ case ON_CONFIG_FETCHED_CALLBACK = "onConfigFetchedCallback"
24
+ case ON_LEGACY_FLOW_READY = "onLegacyFlowReady"
25
+ case ON_VISITOR_SESSION_READY = "onVisitorSessionReady"
26
+ case ON_USER_STATE_CHANGED = "onUserStateChanged"
27
+ case ON_GAMIFICATION_VIEW_HEIGHT_CHANGED = "onGamificationViewHeightChanged"
28
+ }
@@ -0,0 +1,15 @@
1
+ //
2
+ // HydraNativeEmitterBrigde.h
3
+ // react-native-hydra-lib
4
+ //
5
+ // Created by Sandesh Kumar Jain on 06/01/25.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ @interface HydraNativeEmitterBrigde : NSObject
11
+ + (instancetype)sharedInstance;
12
+ -(void)setHydraLib:(id)hydraLibIns;
13
+ - (NSArray<NSString *> *)supportedEvents;
14
+ - (void)sendEventWithName:(NSString *)eventName body:(id)body;
15
+ @end
@@ -0,0 +1,48 @@
1
+ //
2
+ // HydraNativeEmitterBrigde.m
3
+ // react-native-hydra-lib
4
+ //
5
+ // Created by Sandesh Kumar Jain on 06/01/25.
6
+ //
7
+
8
+ #import "HydraNativeEmitterBrigde.h"
9
+ #import <React/RCTBridgeModule.h>
10
+ #import <UserNotifications/UserNotifications.h>
11
+
12
+ #if __has_include("react_native_hydra_lib-Swift.h")
13
+ #import "react_native_hydra_lib-Swift.h"
14
+ #elif __has_include(<react_native_hydra_lib/react_native_hydra_lib-Swift.h>)
15
+ #import <react_native_hydra_lib/react_native_hydra_lib-Swift.h>
16
+ #endif
17
+
18
+ #import "HydraLib.h"
19
+
20
+ @implementation HydraNativeEmitterBrigde
21
+
22
+ HydraLib* hydraLib;
23
+
24
+ + (instancetype)sharedInstance {
25
+ static HydraNativeEmitterBrigde *shared = nil;
26
+ static dispatch_once_t onceToken;
27
+ dispatch_once(&onceToken, ^{
28
+ shared = [[self alloc] init];
29
+ });
30
+ return shared;
31
+ }
32
+
33
+ -(void)setHydraLib:(id)hydraLibIns{
34
+ if(hydraLibIns != nil){
35
+ NSAssert([hydraLibIns isKindOfClass:[HydraLib class]], @"hydraLibIns %@ is not kind of class %@", hydraLibIns, NSStringFromClass([HydraLib class]));
36
+ }
37
+ hydraLib = hydraLibIns;
38
+ [[HydraEventEmitter shared] setEmitterInitialized];
39
+ }
40
+
41
+ - (void)sendEventWithName:(NSString *)eventName body:(id)body;{
42
+ [hydraLib sendEventWithName:eventName body:body];
43
+ }
44
+
45
+ - (NSArray<NSString *> *)supportedEvents {
46
+ return [[HydraEventEmitter shared] supportedEvents];
47
+ }
48
+ @end
@@ -0,0 +1,14 @@
1
+ #ifdef RCT_NEW_ARCH_ENABLED
2
+
3
+ #import <React/RCTViewComponentView.h>
4
+ #import <UIKit/UIKit.h>
5
+
6
+ NS_ASSUME_NONNULL_BEGIN
7
+
8
+ @interface GamificationBannerViewComponentView : RCTViewComponentView
9
+
10
+ @end
11
+
12
+ NS_ASSUME_NONNULL_END
13
+
14
+ #endif
@@ -0,0 +1,125 @@
1
+ #ifdef RCT_NEW_ARCH_ENABLED
2
+
3
+ #import "GamificationBannerViewComponentView.h"
4
+
5
+ #import "../generated/RNHydraLibSpec/ComponentDescriptors.h"
6
+ #import "../generated/RNHydraLibSpec/EventEmitters.h"
7
+ #import "../generated/RNHydraLibSpec/Props.h"
8
+ #import "../generated/RNHydraLibSpec/RCTComponentViewHelpers.h"
9
+ #import "RCTFabricComponentsPlugins.h"
10
+ #import <React/RCTBridgeModule.h>
11
+ #import <React/RCTComponentViewFactory.h>
12
+ #import <UserNotifications/UserNotifications.h>
13
+ #if __has_include("react_native_hydra_lib-Swift.h")
14
+ #import "react_native_hydra_lib-Swift.h"
15
+ #elif __has_include(<react_native_hydra_lib/react_native_hydra_lib-Swift.h>)
16
+ #import <react_native_hydra_lib/react_native_hydra_lib-Swift.h>
17
+ #endif
18
+
19
+ using namespace facebook::react;
20
+
21
+ @interface GamificationBannerViewComponentView () <RCTGamificationBannerViewViewProtocol>
22
+ @end
23
+
24
+ @implementation GamificationBannerViewComponentView {
25
+ NSString *_bannerId;
26
+ BOOL _needsBannerView;
27
+ BOOL _retryPending;
28
+ }
29
+
30
+ + (void)load {
31
+ [[RCTComponentViewFactory currentComponentViewFactory] registerComponentViewClass:self];
32
+ }
33
+
34
+ + (ComponentDescriptorProvider)componentDescriptorProvider {
35
+ return concreteComponentDescriptorProvider<GamificationBannerViewComponentDescriptor>();
36
+ }
37
+
38
+ - (instancetype)initWithFrame:(CGRect)frame {
39
+ if (self = [super initWithFrame:frame]) {
40
+ static const auto defaultProps = std::make_shared<const GamificationBannerViewProps>();
41
+ _props = defaultProps;
42
+
43
+ [[NSNotificationCenter defaultCenter] addObserver:self
44
+ selector:@selector(gamificationDataReloaded)
45
+ name:[[HydraSDKCore shared] getNotificationName]
46
+ object:nil];
47
+ }
48
+ return self;
49
+ }
50
+
51
+ - (void)dealloc {
52
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
53
+ }
54
+
55
+ - (void)gamificationDataReloaded {
56
+ dispatch_async(dispatch_get_main_queue(), ^{
57
+ self->_needsBannerView = YES;
58
+ [self attachBannerViewIfPossible];
59
+ });
60
+ }
61
+
62
+ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps {
63
+ const auto &newProps = *std::static_pointer_cast<const GamificationBannerViewProps>(props);
64
+
65
+ const auto defaultProps = GamificationBannerViewProps();
66
+ const auto &prevProps = oldProps
67
+ ? *std::static_pointer_cast<const GamificationBannerViewProps>(oldProps)
68
+ : defaultProps;
69
+
70
+ BOOL bannerIdChanged = prevProps.bannerId != newProps.bannerId;
71
+
72
+ if (self.contentView == nil || bannerIdChanged) {
73
+ _bannerId = [NSString stringWithUTF8String:newProps.bannerId.c_str()];
74
+ _needsBannerView = YES;
75
+ [self attachBannerViewIfPossible];
76
+ }
77
+
78
+ [super updateProps:props oldProps:oldProps];
79
+ }
80
+
81
+ - (void)layoutSubviews {
82
+ [super layoutSubviews];
83
+ [self attachBannerViewIfPossible];
84
+ }
85
+
86
+ - (void)attachBannerViewIfPossible {
87
+ if (!_needsBannerView || _bannerId.length == 0) {
88
+ return;
89
+ }
90
+ if (CGRectIsEmpty(self.bounds)) {
91
+ return;
92
+ }
93
+
94
+ NSLog(@"[GamificationBanner] trying createGamificationBannerView(bannerId=%@)", _bannerId);
95
+ UIView *bannerView = [[HydraSDKCore shared] createGamificationBannerViewWithBannerId:_bannerId];
96
+ if (bannerView) {
97
+ NSLog(@"[GamificationBanner] banner view created OK");
98
+ self.contentView = bannerView;
99
+ _needsBannerView = NO;
100
+ _retryPending = NO;
101
+ } else {
102
+ NSLog(@"[GamificationBanner] SDK returned nil — scheduling long fallback");
103
+ [self scheduleFallbackRetry];
104
+ }
105
+ }
106
+
107
+ - (void)scheduleFallbackRetry {
108
+ if (_retryPending) return;
109
+ _retryPending = YES;
110
+ __weak __typeof__(self) weakSelf = self;
111
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
112
+ __typeof__(self) strongSelf = weakSelf;
113
+ if (!strongSelf) return;
114
+ strongSelf->_retryPending = NO;
115
+ [strongSelf attachBannerViewIfPossible];
116
+ });
117
+ }
118
+
119
+ @end
120
+
121
+ Class<RCTComponentViewProtocol> GamificationBannerViewCls(void) {
122
+ return GamificationBannerViewComponentView.class;
123
+ }
124
+
125
+ #endif
@@ -0,0 +1,14 @@
1
+ #ifdef RCT_NEW_ARCH_ENABLED
2
+
3
+ #import <React/RCTViewComponentView.h>
4
+ #import <UIKit/UIKit.h>
5
+
6
+ NS_ASSUME_NONNULL_BEGIN
7
+
8
+ @interface GamificationEmbedViewComponentView : RCTViewComponentView
9
+
10
+ @end
11
+
12
+ NS_ASSUME_NONNULL_END
13
+
14
+ #endif