react-native-monflowts 0.0.0-stage → 0.5.0

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 (479) hide show
  1. package/LICENSE +20 -0
  2. package/Monflowts.podspec +22 -0
  3. package/README.md +229 -2
  4. package/android/build.gradle +58 -0
  5. package/android/src/main/AndroidManifest.xml +8 -0
  6. package/android/src/main/java/com/monflowts/MonflowtsAssetsModule.kt +219 -0
  7. package/android/src/main/java/com/monflowts/MonflowtsCrashFeedModule.kt +175 -0
  8. package/android/src/main/java/com/monflowts/MonflowtsHapticModule.kt +170 -0
  9. package/android/src/main/java/com/monflowts/MonflowtsLottieView.kt +96 -0
  10. package/android/src/main/java/com/monflowts/MonflowtsLottieViewManager.kt +53 -0
  11. package/android/src/main/java/com/monflowts/MonflowtsPackage.kt +70 -0
  12. package/android/src/main/java/com/monflowts/MonflowtsSoundModule.kt +132 -0
  13. package/android/src/main/java/com/monflowts/MonflowtsSpeechModule.kt +81 -0
  14. package/android/src/main/java/com/monflowts/MonflowtsSvgView.kt +355 -0
  15. package/android/src/main/java/com/monflowts/MonflowtsSvgViewManager.kt +59 -0
  16. package/android/src/main/java/com/monflowts/MonflowtsWebView.kt +86 -0
  17. package/android/src/main/java/com/monflowts/MonflowtsWebViewManager.kt +33 -0
  18. package/android/src/main/java/com/monflowts/MonflowtsWheelView.kt +98 -0
  19. package/android/src/main/java/com/monflowts/MonflowtsWheelViewManager.kt +46 -0
  20. package/ios/Monflowts-Bridging-Header.h +5 -0
  21. package/ios/MonflowtsAssetsBridge.m +14 -0
  22. package/ios/MonflowtsAssetsModule.swift +217 -0
  23. package/ios/MonflowtsCrashFeedBridge.m +9 -0
  24. package/ios/MonflowtsCrashFeedModule.swift +88 -0
  25. package/ios/MonflowtsHTTP1EventSource.swift +296 -0
  26. package/ios/MonflowtsHapticBridge.m +8 -0
  27. package/ios/MonflowtsHapticModule.swift +55 -0
  28. package/ios/MonflowtsLottieBridge.m +12 -0
  29. package/ios/MonflowtsLottieUIView.swift +95 -0
  30. package/ios/MonflowtsLottieViewManager.swift +13 -0
  31. package/ios/MonflowtsSSEParser.swift +58 -0
  32. package/ios/MonflowtsSoundBridge.m +8 -0
  33. package/ios/MonflowtsSoundModule.swift +100 -0
  34. package/ios/MonflowtsSpeechBridge.m +9 -0
  35. package/ios/MonflowtsSpeechModule.swift +61 -0
  36. package/ios/MonflowtsSvgBridge.m +11 -0
  37. package/ios/MonflowtsSvgUIView.swift +431 -0
  38. package/ios/MonflowtsSvgViewManager.swift +13 -0
  39. package/ios/MonflowtsWebBridge.m +8 -0
  40. package/ios/MonflowtsWebUIView.swift +92 -0
  41. package/ios/MonflowtsWebViewManager.swift +14 -0
  42. package/ios/MonflowtsWheelBridge.m +7 -0
  43. package/ios/MonflowtsWheelUIView.swift +126 -0
  44. package/ios/MonflowtsWheelViewManager.swift +14 -0
  45. package/lib/module/HapticsManager.js +93 -0
  46. package/lib/module/HapticsManager.js.map +1 -0
  47. package/lib/module/HubContent.js +642 -0
  48. package/lib/module/HubContent.js.map +1 -0
  49. package/lib/module/Icons.js +64 -0
  50. package/lib/module/Icons.js.map +1 -0
  51. package/lib/module/MonflowtsHub.js +233 -0
  52. package/lib/module/MonflowtsHub.js.map +1 -0
  53. package/lib/module/NativeLottieView.js +6 -0
  54. package/lib/module/NativeLottieView.js.map +1 -0
  55. package/lib/module/NativeSvgView.js +6 -0
  56. package/lib/module/NativeSvgView.js.map +1 -0
  57. package/lib/module/NativeWebView.js +14 -0
  58. package/lib/module/NativeWebView.js.map +1 -0
  59. package/lib/module/NativeWheelView.js +6 -0
  60. package/lib/module/NativeWheelView.js.map +1 -0
  61. package/lib/module/SoundManager.js +120 -0
  62. package/lib/module/SoundManager.js.map +1 -0
  63. package/lib/module/SpeechManager.js +40 -0
  64. package/lib/module/SpeechManager.js.map +1 -0
  65. package/lib/module/api/client.js +109 -0
  66. package/lib/module/api/client.js.map +1 -0
  67. package/lib/module/api/gameTypes.js +2 -0
  68. package/lib/module/api/gameTypes.js.map +1 -0
  69. package/lib/module/api/http.js +252 -0
  70. package/lib/module/api/http.js.map +1 -0
  71. package/lib/module/api/mutations.js +359 -0
  72. package/lib/module/api/mutations.js.map +1 -0
  73. package/lib/module/api/playerTypes.js +2 -0
  74. package/lib/module/api/playerTypes.js.map +1 -0
  75. package/lib/module/api/queries.js +403 -0
  76. package/lib/module/api/queries.js.map +1 -0
  77. package/lib/module/api/sdkTypes.js +2 -0
  78. package/lib/module/api/sdkTypes.js.map +1 -0
  79. package/lib/module/assets/assetKeys.js +4 -0
  80. package/lib/module/assets/assetKeys.js.map +1 -0
  81. package/lib/module/assets/assetSync.js +61 -0
  82. package/lib/module/assets/assetSync.js.map +1 -0
  83. package/lib/module/assets/nativeAssets.js +25 -0
  84. package/lib/module/assets/nativeAssets.js.map +1 -0
  85. package/lib/module/assets/remote.js +47 -0
  86. package/lib/module/assets/remote.js.map +1 -0
  87. package/lib/module/components/AbandonPolicyNotice.js +200 -0
  88. package/lib/module/components/AbandonPolicyNotice.js.map +1 -0
  89. package/lib/module/components/AnimatedAmount.js +39 -0
  90. package/lib/module/components/AnimatedAmount.js.map +1 -0
  91. package/lib/module/components/CoinFlyOverlay.js +157 -0
  92. package/lib/module/components/CoinFlyOverlay.js.map +1 -0
  93. package/lib/module/components/GameCharacter.js +45 -0
  94. package/lib/module/components/GameCharacter.js.map +1 -0
  95. package/lib/module/components/GameRulesModal.js +279 -0
  96. package/lib/module/components/GameRulesModal.js.map +1 -0
  97. package/lib/module/components/HypeCallout.js +103 -0
  98. package/lib/module/components/HypeCallout.js.map +1 -0
  99. package/lib/module/components/InsufficientFundsOverlay.js +285 -0
  100. package/lib/module/components/InsufficientFundsOverlay.js.map +1 -0
  101. package/lib/module/components/JackpotNearMiss.js +89 -0
  102. package/lib/module/components/JackpotNearMiss.js.map +1 -0
  103. package/lib/module/components/JackpotTeaser.js +341 -0
  104. package/lib/module/components/JackpotTeaser.js.map +1 -0
  105. package/lib/module/components/MonflowtsButton.js +129 -0
  106. package/lib/module/components/MonflowtsButton.js.map +1 -0
  107. package/lib/module/components/MonflowtsChipGroup.js +40 -0
  108. package/lib/module/components/MonflowtsChipGroup.js.map +1 -0
  109. package/lib/module/components/MonflowtsPressable.js +42 -0
  110. package/lib/module/components/MonflowtsPressable.js.map +1 -0
  111. package/lib/module/components/QuitConfirmModal.js +180 -0
  112. package/lib/module/components/QuitConfirmModal.js.map +1 -0
  113. package/lib/module/components/SessionTimer.js +77 -0
  114. package/lib/module/components/SessionTimer.js.map +1 -0
  115. package/lib/module/components/SideDemoTab.js +110 -0
  116. package/lib/module/components/SideDemoTab.js.map +1 -0
  117. package/lib/module/components/StakeInput.js +138 -0
  118. package/lib/module/components/StakeInput.js.map +1 -0
  119. package/lib/module/constants.js +50 -0
  120. package/lib/module/constants.js.map +1 -0
  121. package/lib/module/content.js +21 -0
  122. package/lib/module/content.js.map +1 -0
  123. package/lib/module/effects/EffectBurst.js +56 -0
  124. package/lib/module/effects/EffectBurst.js.map +1 -0
  125. package/lib/module/effects/beaverStates.js +11 -0
  126. package/lib/module/effects/beaverStates.js.map +1 -0
  127. package/lib/module/effects/hypePhrases.js +67 -0
  128. package/lib/module/effects/hypePhrases.js.map +1 -0
  129. package/lib/module/effects/particleAnims.js +17 -0
  130. package/lib/module/effects/particleAnims.js.map +1 -0
  131. package/lib/module/hooks/useAvailableGames.js +29 -0
  132. package/lib/module/hooks/useAvailableGames.js.map +1 -0
  133. package/lib/module/hooks/useCrash.js +137 -0
  134. package/lib/module/hooks/useCrash.js.map +1 -0
  135. package/lib/module/hooks/useCrashFeed.js +49 -0
  136. package/lib/module/hooks/useCrashFeed.js.map +1 -0
  137. package/lib/module/hooks/useCurrency.js +13 -0
  138. package/lib/module/hooks/useCurrency.js.map +1 -0
  139. package/lib/module/hooks/useFairSeed.js +55 -0
  140. package/lib/module/hooks/useFairSeed.js.map +1 -0
  141. package/lib/module/hooks/useGameEvents.js +186 -0
  142. package/lib/module/hooks/useGameEvents.js.map +1 -0
  143. package/lib/module/hooks/useGameHistory.js +55 -0
  144. package/lib/module/hooks/useGameHistory.js.map +1 -0
  145. package/lib/module/hooks/useLeaderboard.js +83 -0
  146. package/lib/module/hooks/useLeaderboard.js.map +1 -0
  147. package/lib/module/hooks/useMines.js +166 -0
  148. package/lib/module/hooks/useMines.js.map +1 -0
  149. package/lib/module/hooks/useNotifications.js +66 -0
  150. package/lib/module/hooks/useNotifications.js.map +1 -0
  151. package/lib/module/hooks/usePlayGame.js +408 -0
  152. package/lib/module/hooks/usePlayGame.js.map +1 -0
  153. package/lib/module/hooks/usePlinko.js +75 -0
  154. package/lib/module/hooks/usePlinko.js.map +1 -0
  155. package/lib/module/hooks/useRaffleDrawState.js +57 -0
  156. package/lib/module/hooks/useRaffleDrawState.js.map +1 -0
  157. package/lib/module/hooks/useRefreshWallet.js +24 -0
  158. package/lib/module/hooks/useRefreshWallet.js.map +1 -0
  159. package/lib/module/hooks/useResponsive.js +16 -0
  160. package/lib/module/hooks/useResponsive.js.map +1 -0
  161. package/lib/module/hooks/useRevealWin.js +120 -0
  162. package/lib/module/hooks/useRevealWin.js.map +1 -0
  163. package/lib/module/hooks/useScreenShake.js +32 -0
  164. package/lib/module/hooks/useScreenShake.js.map +1 -0
  165. package/lib/module/hooks/useWallet.js +77 -0
  166. package/lib/module/hooks/useWallet.js.map +1 -0
  167. package/lib/module/i18n.js +104 -0
  168. package/lib/module/i18n.js.map +1 -0
  169. package/lib/module/index.js +22 -0
  170. package/lib/module/index.js.map +1 -0
  171. package/lib/module/lottieAnimations.js +15 -0
  172. package/lib/module/lottieAnimations.js.map +1 -0
  173. package/lib/module/package.json +1 -0
  174. package/lib/module/stores/assetStore.js +140 -0
  175. package/lib/module/stores/assetStore.js.map +1 -0
  176. package/lib/module/stores/authStore.js +47 -0
  177. package/lib/module/stores/authStore.js.map +1 -0
  178. package/lib/module/stores/gameStore.js +23 -0
  179. package/lib/module/stores/gameStore.js.map +1 -0
  180. package/lib/module/stores/sdkInitStore.js +155 -0
  181. package/lib/module/stores/sdkInitStore.js.map +1 -0
  182. package/lib/module/stores/settingsStore.js +40 -0
  183. package/lib/module/stores/settingsStore.js.map +1 -0
  184. package/lib/module/theme.js +160 -0
  185. package/lib/module/theme.js.map +1 -0
  186. package/lib/module/types.js +4 -0
  187. package/lib/module/types.js.map +1 -0
  188. package/lib/module/utils/apolloError.js +69 -0
  189. package/lib/module/utils/apolloError.js.map +1 -0
  190. package/lib/module/utils/crashMultiplier.js +8 -0
  191. package/lib/module/utils/crashMultiplier.js.map +1 -0
  192. package/lib/module/utils/crashMultiplier.test.js +34 -0
  193. package/lib/module/utils/crashMultiplier.test.js.map +1 -0
  194. package/lib/module/utils/deviceAnalytics.js +51 -0
  195. package/lib/module/utils/deviceAnalytics.js.map +1 -0
  196. package/lib/module/utils/idempotency.js +66 -0
  197. package/lib/module/utils/idempotency.js.map +1 -0
  198. package/lib/module/utils/layout.js +14 -0
  199. package/lib/module/utils/layout.js.map +1 -0
  200. package/lib/module/utils/safeInlineScript.js +12 -0
  201. package/lib/module/utils/safeInlineScript.js.map +1 -0
  202. package/lib/module/utils/sseClient.js +40 -0
  203. package/lib/module/utils/sseClient.js.map +1 -0
  204. package/lib/module/views/DepositSelect.js +275 -0
  205. package/lib/module/views/DepositSelect.js.map +1 -0
  206. package/lib/module/views/Dice.js +111 -0
  207. package/lib/module/views/Dice.js.map +1 -0
  208. package/lib/module/views/DiceBattle.js +815 -0
  209. package/lib/module/views/DiceBattle.js.map +1 -0
  210. package/lib/module/views/DiceLobby.js +577 -0
  211. package/lib/module/views/DiceLobby.js.map +1 -0
  212. package/lib/module/views/FortuneWheel.js +892 -0
  213. package/lib/module/views/FortuneWheel.js.map +1 -0
  214. package/lib/module/views/Freefall.js +808 -0
  215. package/lib/module/views/Freefall.js.map +1 -0
  216. package/lib/module/views/History.js +366 -0
  217. package/lib/module/views/History.js.map +1 -0
  218. package/lib/module/views/Home.js +554 -0
  219. package/lib/module/views/Home.js.map +1 -0
  220. package/lib/module/views/Jetstream.js +889 -0
  221. package/lib/module/views/Jetstream.js.map +1 -0
  222. package/lib/module/views/Leaderboard.js +1206 -0
  223. package/lib/module/views/Leaderboard.js.map +1 -0
  224. package/lib/module/views/MillionaireHunter.js +1697 -0
  225. package/lib/module/views/MillionaireHunter.js.map +1 -0
  226. package/lib/module/views/Minefield.js +826 -0
  227. package/lib/module/views/Minefield.js.map +1 -0
  228. package/lib/module/views/PaymentWebView.js +546 -0
  229. package/lib/module/views/PaymentWebView.js.map +1 -0
  230. package/lib/module/views/PlayerCard.js +184 -0
  231. package/lib/module/views/PlayerCard.js.map +1 -0
  232. package/lib/module/views/Profile.js +531 -0
  233. package/lib/module/views/Profile.js.map +1 -0
  234. package/lib/module/views/RaffleDraw.js +1242 -0
  235. package/lib/module/views/RaffleDraw.js.map +1 -0
  236. package/lib/module/views/RevealWin.js +1267 -0
  237. package/lib/module/views/RevealWin.js.map +1 -0
  238. package/lib/module/views/Splash.js +363 -0
  239. package/lib/module/views/Splash.js.map +1 -0
  240. package/lib/module/views/Success.js +363 -0
  241. package/lib/module/views/Success.js.map +1 -0
  242. package/lib/module/views/TicketShop.js +372 -0
  243. package/lib/module/views/TicketShop.js.map +1 -0
  244. package/lib/module/views/TriviaLobby.js +582 -0
  245. package/lib/module/views/TriviaLobby.js.map +1 -0
  246. package/lib/module/views/TriviaMaster.js +884 -0
  247. package/lib/module/views/TriviaMaster.js.map +1 -0
  248. package/lib/module/views/Wallet.js +622 -0
  249. package/lib/module/views/Wallet.js.map +1 -0
  250. package/lib/module/views/WithdrawFlow.js +445 -0
  251. package/lib/module/views/WithdrawFlow.js.map +1 -0
  252. package/lib/module/views/gridGeometry.js +26 -0
  253. package/lib/module/views/gridGeometry.js.map +1 -0
  254. package/lib/module/views/revealWinHelpers.js +29 -0
  255. package/lib/module/views/revealWinHelpers.js.map +1 -0
  256. package/lib/module/views/ticketBundlePresets.js +29 -0
  257. package/lib/module/views/ticketBundlePresets.js.map +1 -0
  258. package/lib/module/views/triviaHelpers.js +78 -0
  259. package/lib/module/views/triviaHelpers.js.map +1 -0
  260. package/lib/module/voiceClips.js +16 -0
  261. package/lib/module/voiceClips.js.map +1 -0
  262. package/lib/typescript/package.json +1 -0
  263. package/lib/typescript/src/HapticsManager.d.ts +28 -0
  264. package/lib/typescript/src/HapticsManager.d.ts.map +1 -0
  265. package/lib/typescript/src/HubContent.d.ts +7 -0
  266. package/lib/typescript/src/HubContent.d.ts.map +1 -0
  267. package/lib/typescript/src/Icons.d.ts +14 -0
  268. package/lib/typescript/src/Icons.d.ts.map +1 -0
  269. package/lib/typescript/src/MonflowtsHub.d.ts +5 -0
  270. package/lib/typescript/src/MonflowtsHub.d.ts.map +1 -0
  271. package/lib/typescript/src/NativeLottieView.d.ts +13 -0
  272. package/lib/typescript/src/NativeLottieView.d.ts.map +1 -0
  273. package/lib/typescript/src/NativeSvgView.d.ts +12 -0
  274. package/lib/typescript/src/NativeSvgView.d.ts.map +1 -0
  275. package/lib/typescript/src/NativeWebView.d.ts +22 -0
  276. package/lib/typescript/src/NativeWebView.d.ts.map +1 -0
  277. package/lib/typescript/src/NativeWheelView.d.ts +9 -0
  278. package/lib/typescript/src/NativeWheelView.d.ts.map +1 -0
  279. package/lib/typescript/src/SoundManager.d.ts +29 -0
  280. package/lib/typescript/src/SoundManager.d.ts.map +1 -0
  281. package/lib/typescript/src/SpeechManager.d.ts +10 -0
  282. package/lib/typescript/src/SpeechManager.d.ts.map +1 -0
  283. package/lib/typescript/src/api/client.d.ts +7 -0
  284. package/lib/typescript/src/api/client.d.ts.map +1 -0
  285. package/lib/typescript/src/api/gameTypes.d.ts +326 -0
  286. package/lib/typescript/src/api/gameTypes.d.ts.map +1 -0
  287. package/lib/typescript/src/api/http.d.ts +61 -0
  288. package/lib/typescript/src/api/http.d.ts.map +1 -0
  289. package/lib/typescript/src/api/mutations.d.ts +22 -0
  290. package/lib/typescript/src/api/mutations.d.ts.map +1 -0
  291. package/lib/typescript/src/api/playerTypes.d.ts +53 -0
  292. package/lib/typescript/src/api/playerTypes.d.ts.map +1 -0
  293. package/lib/typescript/src/api/queries.d.ts +21 -0
  294. package/lib/typescript/src/api/queries.d.ts.map +1 -0
  295. package/lib/typescript/src/api/sdkTypes.d.ts +87 -0
  296. package/lib/typescript/src/api/sdkTypes.d.ts.map +1 -0
  297. package/lib/typescript/src/assets/assetKeys.d.ts +3 -0
  298. package/lib/typescript/src/assets/assetKeys.d.ts.map +1 -0
  299. package/lib/typescript/src/assets/assetSync.d.ts +41 -0
  300. package/lib/typescript/src/assets/assetSync.d.ts.map +1 -0
  301. package/lib/typescript/src/assets/nativeAssets.d.ts +30 -0
  302. package/lib/typescript/src/assets/nativeAssets.d.ts.map +1 -0
  303. package/lib/typescript/src/assets/remote.d.ts +8 -0
  304. package/lib/typescript/src/assets/remote.d.ts.map +1 -0
  305. package/lib/typescript/src/components/AbandonPolicyNotice.d.ts +16 -0
  306. package/lib/typescript/src/components/AbandonPolicyNotice.d.ts.map +1 -0
  307. package/lib/typescript/src/components/AnimatedAmount.d.ts +12 -0
  308. package/lib/typescript/src/components/AnimatedAmount.d.ts.map +1 -0
  309. package/lib/typescript/src/components/CoinFlyOverlay.d.ts +17 -0
  310. package/lib/typescript/src/components/CoinFlyOverlay.d.ts.map +1 -0
  311. package/lib/typescript/src/components/GameCharacter.d.ts +14 -0
  312. package/lib/typescript/src/components/GameCharacter.d.ts.map +1 -0
  313. package/lib/typescript/src/components/GameRulesModal.d.ts +10 -0
  314. package/lib/typescript/src/components/GameRulesModal.d.ts.map +1 -0
  315. package/lib/typescript/src/components/HypeCallout.d.ts +11 -0
  316. package/lib/typescript/src/components/HypeCallout.d.ts.map +1 -0
  317. package/lib/typescript/src/components/InsufficientFundsOverlay.d.ts +12 -0
  318. package/lib/typescript/src/components/InsufficientFundsOverlay.d.ts.map +1 -0
  319. package/lib/typescript/src/components/JackpotNearMiss.d.ts +8 -0
  320. package/lib/typescript/src/components/JackpotNearMiss.d.ts.map +1 -0
  321. package/lib/typescript/src/components/JackpotTeaser.d.ts +13 -0
  322. package/lib/typescript/src/components/JackpotTeaser.d.ts.map +1 -0
  323. package/lib/typescript/src/components/MonflowtsButton.d.ts +21 -0
  324. package/lib/typescript/src/components/MonflowtsButton.d.ts.map +1 -0
  325. package/lib/typescript/src/components/MonflowtsChipGroup.d.ts +18 -0
  326. package/lib/typescript/src/components/MonflowtsChipGroup.d.ts.map +1 -0
  327. package/lib/typescript/src/components/MonflowtsPressable.d.ts +39 -0
  328. package/lib/typescript/src/components/MonflowtsPressable.d.ts.map +1 -0
  329. package/lib/typescript/src/components/QuitConfirmModal.d.ts +11 -0
  330. package/lib/typescript/src/components/QuitConfirmModal.d.ts.map +1 -0
  331. package/lib/typescript/src/components/SessionTimer.d.ts +14 -0
  332. package/lib/typescript/src/components/SessionTimer.d.ts.map +1 -0
  333. package/lib/typescript/src/components/SideDemoTab.d.ts +18 -0
  334. package/lib/typescript/src/components/SideDemoTab.d.ts.map +1 -0
  335. package/lib/typescript/src/components/StakeInput.d.ts +16 -0
  336. package/lib/typescript/src/components/StakeInput.d.ts.map +1 -0
  337. package/lib/typescript/src/constants.d.ts +21 -0
  338. package/lib/typescript/src/constants.d.ts.map +1 -0
  339. package/lib/typescript/src/content.d.ts +53 -0
  340. package/lib/typescript/src/content.d.ts.map +1 -0
  341. package/lib/typescript/src/effects/EffectBurst.d.ts +20 -0
  342. package/lib/typescript/src/effects/EffectBurst.d.ts.map +1 -0
  343. package/lib/typescript/src/effects/beaverStates.d.ts +4 -0
  344. package/lib/typescript/src/effects/beaverStates.d.ts.map +1 -0
  345. package/lib/typescript/src/effects/hypePhrases.d.ts +11 -0
  346. package/lib/typescript/src/effects/hypePhrases.d.ts.map +1 -0
  347. package/lib/typescript/src/effects/particleAnims.d.ts +9 -0
  348. package/lib/typescript/src/effects/particleAnims.d.ts.map +1 -0
  349. package/lib/typescript/src/hooks/useAvailableGames.d.ts +14 -0
  350. package/lib/typescript/src/hooks/useAvailableGames.d.ts.map +1 -0
  351. package/lib/typescript/src/hooks/useCrash.d.ts +13 -0
  352. package/lib/typescript/src/hooks/useCrash.d.ts.map +1 -0
  353. package/lib/typescript/src/hooks/useCrashFeed.d.ts +22 -0
  354. package/lib/typescript/src/hooks/useCrashFeed.d.ts.map +1 -0
  355. package/lib/typescript/src/hooks/useCurrency.d.ts +6 -0
  356. package/lib/typescript/src/hooks/useCurrency.d.ts.map +1 -0
  357. package/lib/typescript/src/hooks/useFairSeed.d.ts +8 -0
  358. package/lib/typescript/src/hooks/useFairSeed.d.ts.map +1 -0
  359. package/lib/typescript/src/hooks/useGameEvents.d.ts +50 -0
  360. package/lib/typescript/src/hooks/useGameEvents.d.ts.map +1 -0
  361. package/lib/typescript/src/hooks/useGameHistory.d.ts +14 -0
  362. package/lib/typescript/src/hooks/useGameHistory.d.ts.map +1 -0
  363. package/lib/typescript/src/hooks/useLeaderboard.d.ts +71 -0
  364. package/lib/typescript/src/hooks/useLeaderboard.d.ts.map +1 -0
  365. package/lib/typescript/src/hooks/useMines.d.ts +11 -0
  366. package/lib/typescript/src/hooks/useMines.d.ts.map +1 -0
  367. package/lib/typescript/src/hooks/useNotifications.d.ts +26 -0
  368. package/lib/typescript/src/hooks/useNotifications.d.ts.map +1 -0
  369. package/lib/typescript/src/hooks/usePlayGame.d.ts +62 -0
  370. package/lib/typescript/src/hooks/usePlayGame.d.ts.map +1 -0
  371. package/lib/typescript/src/hooks/usePlinko.d.ts +8 -0
  372. package/lib/typescript/src/hooks/usePlinko.d.ts.map +1 -0
  373. package/lib/typescript/src/hooks/useRaffleDrawState.d.ts +50 -0
  374. package/lib/typescript/src/hooks/useRaffleDrawState.d.ts.map +1 -0
  375. package/lib/typescript/src/hooks/useRefreshWallet.d.ts +8 -0
  376. package/lib/typescript/src/hooks/useRefreshWallet.d.ts.map +1 -0
  377. package/lib/typescript/src/hooks/useResponsive.d.ts +8 -0
  378. package/lib/typescript/src/hooks/useResponsive.d.ts.map +1 -0
  379. package/lib/typescript/src/hooks/useRevealWin.d.ts +10 -0
  380. package/lib/typescript/src/hooks/useRevealWin.d.ts.map +1 -0
  381. package/lib/typescript/src/hooks/useScreenShake.d.ts +14 -0
  382. package/lib/typescript/src/hooks/useScreenShake.d.ts.map +1 -0
  383. package/lib/typescript/src/hooks/useWallet.d.ts +23 -0
  384. package/lib/typescript/src/hooks/useWallet.d.ts.map +1 -0
  385. package/lib/typescript/src/i18n.d.ts +29 -0
  386. package/lib/typescript/src/i18n.d.ts.map +1 -0
  387. package/lib/typescript/src/index.d.ts +12 -0
  388. package/lib/typescript/src/index.d.ts.map +1 -0
  389. package/lib/typescript/src/lottieAnimations.d.ts +2 -0
  390. package/lib/typescript/src/lottieAnimations.d.ts.map +1 -0
  391. package/lib/typescript/src/stores/assetStore.d.ts +17 -0
  392. package/lib/typescript/src/stores/assetStore.d.ts.map +1 -0
  393. package/lib/typescript/src/stores/authStore.d.ts +25 -0
  394. package/lib/typescript/src/stores/authStore.d.ts.map +1 -0
  395. package/lib/typescript/src/stores/gameStore.d.ts +14 -0
  396. package/lib/typescript/src/stores/gameStore.d.ts.map +1 -0
  397. package/lib/typescript/src/stores/sdkInitStore.d.ts +38 -0
  398. package/lib/typescript/src/stores/sdkInitStore.d.ts.map +1 -0
  399. package/lib/typescript/src/stores/settingsStore.d.ts +23 -0
  400. package/lib/typescript/src/stores/settingsStore.d.ts.map +1 -0
  401. package/lib/typescript/src/theme.d.ts +149 -0
  402. package/lib/typescript/src/theme.d.ts.map +1 -0
  403. package/lib/typescript/src/types.d.ts +49 -0
  404. package/lib/typescript/src/types.d.ts.map +1 -0
  405. package/lib/typescript/src/utils/apolloError.d.ts +12 -0
  406. package/lib/typescript/src/utils/apolloError.d.ts.map +1 -0
  407. package/lib/typescript/src/utils/crashMultiplier.d.ts +2 -0
  408. package/lib/typescript/src/utils/crashMultiplier.d.ts.map +1 -0
  409. package/lib/typescript/src/utils/crashMultiplier.test.d.ts +2 -0
  410. package/lib/typescript/src/utils/crashMultiplier.test.d.ts.map +1 -0
  411. package/lib/typescript/src/utils/deviceAnalytics.d.ts +3 -0
  412. package/lib/typescript/src/utils/deviceAnalytics.d.ts.map +1 -0
  413. package/lib/typescript/src/utils/idempotency.d.ts +14 -0
  414. package/lib/typescript/src/utils/idempotency.d.ts.map +1 -0
  415. package/lib/typescript/src/utils/layout.d.ts +10 -0
  416. package/lib/typescript/src/utils/layout.d.ts.map +1 -0
  417. package/lib/typescript/src/utils/safeInlineScript.d.ts +5 -0
  418. package/lib/typescript/src/utils/safeInlineScript.d.ts.map +1 -0
  419. package/lib/typescript/src/utils/sseClient.d.ts +5 -0
  420. package/lib/typescript/src/utils/sseClient.d.ts.map +1 -0
  421. package/lib/typescript/src/views/DepositSelect.d.ts +9 -0
  422. package/lib/typescript/src/views/DepositSelect.d.ts.map +1 -0
  423. package/lib/typescript/src/views/Dice.d.ts +10 -0
  424. package/lib/typescript/src/views/Dice.d.ts.map +1 -0
  425. package/lib/typescript/src/views/DiceBattle.d.ts +15 -0
  426. package/lib/typescript/src/views/DiceBattle.d.ts.map +1 -0
  427. package/lib/typescript/src/views/DiceLobby.d.ts +12 -0
  428. package/lib/typescript/src/views/DiceLobby.d.ts.map +1 -0
  429. package/lib/typescript/src/views/FortuneWheel.d.ts +13 -0
  430. package/lib/typescript/src/views/FortuneWheel.d.ts.map +1 -0
  431. package/lib/typescript/src/views/Freefall.d.ts +13 -0
  432. package/lib/typescript/src/views/Freefall.d.ts.map +1 -0
  433. package/lib/typescript/src/views/History.d.ts +7 -0
  434. package/lib/typescript/src/views/History.d.ts.map +1 -0
  435. package/lib/typescript/src/views/Home.d.ts +13 -0
  436. package/lib/typescript/src/views/Home.d.ts.map +1 -0
  437. package/lib/typescript/src/views/Jetstream.d.ts +14 -0
  438. package/lib/typescript/src/views/Jetstream.d.ts.map +1 -0
  439. package/lib/typescript/src/views/Leaderboard.d.ts +8 -0
  440. package/lib/typescript/src/views/Leaderboard.d.ts.map +1 -0
  441. package/lib/typescript/src/views/MillionaireHunter.d.ts +13 -0
  442. package/lib/typescript/src/views/MillionaireHunter.d.ts.map +1 -0
  443. package/lib/typescript/src/views/Minefield.d.ts +13 -0
  444. package/lib/typescript/src/views/Minefield.d.ts.map +1 -0
  445. package/lib/typescript/src/views/PaymentWebView.d.ts +29 -0
  446. package/lib/typescript/src/views/PaymentWebView.d.ts.map +1 -0
  447. package/lib/typescript/src/views/PlayerCard.d.ts +15 -0
  448. package/lib/typescript/src/views/PlayerCard.d.ts.map +1 -0
  449. package/lib/typescript/src/views/Profile.d.ts +9 -0
  450. package/lib/typescript/src/views/Profile.d.ts.map +1 -0
  451. package/lib/typescript/src/views/RaffleDraw.d.ts +12 -0
  452. package/lib/typescript/src/views/RaffleDraw.d.ts.map +1 -0
  453. package/lib/typescript/src/views/RevealWin.d.ts +13 -0
  454. package/lib/typescript/src/views/RevealWin.d.ts.map +1 -0
  455. package/lib/typescript/src/views/Splash.d.ts +10 -0
  456. package/lib/typescript/src/views/Splash.d.ts.map +1 -0
  457. package/lib/typescript/src/views/Success.d.ts +12 -0
  458. package/lib/typescript/src/views/Success.d.ts.map +1 -0
  459. package/lib/typescript/src/views/TicketShop.d.ts +15 -0
  460. package/lib/typescript/src/views/TicketShop.d.ts.map +1 -0
  461. package/lib/typescript/src/views/TriviaLobby.d.ts +12 -0
  462. package/lib/typescript/src/views/TriviaLobby.d.ts.map +1 -0
  463. package/lib/typescript/src/views/TriviaMaster.d.ts +16 -0
  464. package/lib/typescript/src/views/TriviaMaster.d.ts.map +1 -0
  465. package/lib/typescript/src/views/Wallet.d.ts +10 -0
  466. package/lib/typescript/src/views/Wallet.d.ts.map +1 -0
  467. package/lib/typescript/src/views/WithdrawFlow.d.ts +9 -0
  468. package/lib/typescript/src/views/WithdrawFlow.d.ts.map +1 -0
  469. package/lib/typescript/src/views/gridGeometry.d.ts +19 -0
  470. package/lib/typescript/src/views/gridGeometry.d.ts.map +1 -0
  471. package/lib/typescript/src/views/revealWinHelpers.d.ts +15 -0
  472. package/lib/typescript/src/views/revealWinHelpers.d.ts.map +1 -0
  473. package/lib/typescript/src/views/ticketBundlePresets.d.ts +18 -0
  474. package/lib/typescript/src/views/ticketBundlePresets.d.ts.map +1 -0
  475. package/lib/typescript/src/views/triviaHelpers.d.ts +31 -0
  476. package/lib/typescript/src/views/triviaHelpers.d.ts.map +1 -0
  477. package/lib/typescript/src/voiceClips.d.ts +4 -0
  478. package/lib/typescript/src/voiceClips.d.ts.map +1 -0
  479. package/package.json +160 -4
@@ -0,0 +1,296 @@
1
+ import Foundation
2
+ import Network
3
+ import Security
4
+
5
+ @available(iOS 13.0, *)
6
+ final class MonflowtsHTTP1EventSource {
7
+
8
+ let url: URL
9
+ private(set) var headers: [String: String]
10
+
11
+ var onOpen: (() -> Void)?
12
+ var onEvent: ((_ event: String?, _ id: String?, _ data: String?) -> Void)?
13
+ var onComplete: ((_ statusCode: Int?, _ error: Error?) -> Void)?
14
+
15
+ private let queue: DispatchQueue
16
+ private var connection: NWConnection?
17
+ private var completed = false
18
+ private var disconnected = false
19
+
20
+ init(url: URL, headers: [String: String], queue: DispatchQueue) {
21
+ self.url = url
22
+ self.headers = headers
23
+ self.queue = queue
24
+ }
25
+
26
+ private enum Stage {
27
+ case waitingHeaders
28
+ case streamingChunked
29
+ case streamingIdentity(remaining: Int?)
30
+ case closed
31
+ }
32
+ private var stage: Stage = .waitingHeaders
33
+ private var status: Int?
34
+ private var headerBuffer = Data()
35
+ private var chunkedBuffer = Data()
36
+ private var chunkedRemaining: Int = -1
37
+ private let parser = MonflowtsSSEParser()
38
+
39
+ func connect() {
40
+ guard let host = url.host, !host.isEmpty else {
41
+ finish(error: URLError(.badURL))
42
+ return
43
+ }
44
+ let port: NWEndpoint.Port
45
+ if let p = url.port {
46
+ port = NWEndpoint.Port(integerLiteral: UInt16(p))
47
+ } else if url.scheme == "https" {
48
+ port = .https
49
+ } else if url.scheme == "http" {
50
+ port = .http
51
+ } else {
52
+ finish(error: URLError(.unsupportedURL))
53
+ return
54
+ }
55
+
56
+ let endpoint = NWEndpoint.hostPort(host: NWEndpoint.Host(host), port: port)
57
+ let parameters: NWParameters
58
+ let tcpOpts = NWProtocolTCP.Options()
59
+ tcpOpts.noDelay = true
60
+ tcpOpts.connectionTimeout = 30
61
+ if url.scheme == "https" {
62
+ let tls = NWProtocolTLS.Options()
63
+ sec_protocol_options_add_tls_application_protocol(tls.securityProtocolOptions, "http/1.1")
64
+ parameters = NWParameters(tls: tls, tcp: tcpOpts)
65
+ } else {
66
+ parameters = NWParameters(tls: nil, tcp: tcpOpts)
67
+ }
68
+ parameters.allowFastOpen = true
69
+
70
+ let connection = NWConnection(to: endpoint, using: parameters)
71
+ self.connection = connection
72
+ connection.stateUpdateHandler = { [weak self] state in
73
+ self?.handleConnectionState(state)
74
+ }
75
+ connection.start(queue: queue)
76
+ }
77
+
78
+ func disconnect() {
79
+ if disconnected { return }
80
+ disconnected = true
81
+ stage = .closed
82
+ connection?.cancel()
83
+ connection = nil
84
+ }
85
+
86
+ private func handleConnectionState(_ state: NWConnection.State) {
87
+ switch state {
88
+ case .ready:
89
+ sendRequest()
90
+ receiveLoop()
91
+ case .failed(let error):
92
+ finish(error: error)
93
+ case .cancelled:
94
+ finish(error: nil)
95
+ default:
96
+ break
97
+ }
98
+ }
99
+
100
+ private func sendRequest() {
101
+ guard let host = url.host else { return }
102
+ var path = url.path.isEmpty ? "/" : url.path
103
+ if let q = url.query { path += "?" + q }
104
+
105
+ var lines: [String] = []
106
+ lines.append("GET \(path) HTTP/1.1")
107
+ lines.append("Host: \(host)")
108
+ lines.append("Connection: close")
109
+
110
+ var hasAccept = false
111
+ var hasCacheControl = false
112
+ for (k, v) in headers {
113
+ let lower = k.lowercased()
114
+ if lower == "accept" { hasAccept = true }
115
+ if lower == "cache-control" { hasCacheControl = true }
116
+ if lower == "host" || lower == "connection" { continue }
117
+ lines.append("\(k): \(v)")
118
+ }
119
+ if !hasAccept { lines.append("Accept: text/event-stream") }
120
+ if !hasCacheControl { lines.append("Cache-Control: no-cache") }
121
+ lines.append("Accept-Encoding: identity")
122
+
123
+ lines.append("")
124
+ lines.append("")
125
+ guard let data = lines.joined(separator: "\r\n").data(using: .utf8) else { return }
126
+ connection?.send(content: data, completion: .contentProcessed { [weak self] error in
127
+ if let error { self?.finish(error: error) }
128
+ })
129
+ }
130
+
131
+ private func receiveLoop() {
132
+ connection?.receive(minimumIncompleteLength: 1, maximumLength: 65_536) { [weak self] data, _, isComplete, error in
133
+ guard let self else { return }
134
+ if let data, !data.isEmpty {
135
+ self.handleIncoming(data)
136
+ }
137
+ if let error {
138
+ self.finish(error: error)
139
+ return
140
+ }
141
+ if isComplete {
142
+ self.finish(error: nil)
143
+ return
144
+ }
145
+ if !self.isClosed {
146
+ self.receiveLoop()
147
+ }
148
+ }
149
+ }
150
+
151
+ private var isClosed: Bool {
152
+ if case .closed = stage { return true }
153
+ return completed
154
+ }
155
+
156
+ private func handleIncoming(_ data: Data) {
157
+ switch stage {
158
+ case .waitingHeaders:
159
+ headerBuffer.append(data)
160
+ if headerBuffer.count > 64 * 1024 {
161
+ finish(error: URLError(.cannotParseResponse))
162
+ return
163
+ }
164
+ tryParseHeaders()
165
+ case .streamingChunked:
166
+ handleChunkedBody(data)
167
+ case .streamingIdentity(let remaining):
168
+ for event in parser.append(data) {
169
+ onEvent?(event.event, event.id, event.data)
170
+ }
171
+ if let remaining {
172
+ let after = remaining - data.count
173
+ if after <= 0 {
174
+ stage = .closed
175
+ finish(error: nil)
176
+ }
177
+ }
178
+ case .closed:
179
+ break
180
+ }
181
+ }
182
+
183
+ private func tryParseHeaders() {
184
+ let separator = Data([0x0D, 0x0A, 0x0D, 0x0A])
185
+ guard let range = headerBuffer.range(of: separator) else { return }
186
+ let headerPart = headerBuffer.subdata(in: 0..<range.lowerBound)
187
+ let leftover = headerBuffer.subdata(in: range.upperBound..<headerBuffer.count)
188
+ headerBuffer = Data()
189
+
190
+ guard let raw = String(data: headerPart, encoding: .utf8) else {
191
+ finish(error: URLError(.cannotParseResponse))
192
+ return
193
+ }
194
+ let lines = raw.components(separatedBy: "\r\n")
195
+ guard let statusLine = lines.first else {
196
+ finish(error: URLError(.cannotParseResponse))
197
+ return
198
+ }
199
+ let parts = statusLine.split(separator: " ", maxSplits: 2, omittingEmptySubsequences: false)
200
+ guard parts.count >= 2, let code = Int(parts[1]) else {
201
+ finish(error: URLError(.cannotParseResponse))
202
+ return
203
+ }
204
+ status = code
205
+ guard (200...299).contains(code) else {
206
+ finish(error: nil)
207
+ return
208
+ }
209
+
210
+ var transferEncoding: String?
211
+ var contentLength: Int?
212
+ for line in lines.dropFirst() where !line.isEmpty {
213
+ guard let colon = line.firstIndex(of: ":") else { continue }
214
+ let name = String(line[..<colon]).lowercased().trimmingCharacters(in: .whitespaces)
215
+ let value = String(line[line.index(after: colon)...]).trimmingCharacters(in: .whitespaces)
216
+ switch name {
217
+ case "transfer-encoding": transferEncoding = value.lowercased()
218
+ case "content-length": contentLength = Int(value)
219
+ default: break
220
+ }
221
+ }
222
+
223
+ onOpen?()
224
+
225
+ if transferEncoding?.contains("chunked") == true {
226
+ stage = .streamingChunked
227
+ } else if let length = contentLength {
228
+ stage = .streamingIdentity(remaining: length)
229
+ } else {
230
+ stage = .streamingIdentity(remaining: nil)
231
+ }
232
+
233
+ if !leftover.isEmpty {
234
+ handleIncoming(leftover)
235
+ }
236
+ }
237
+
238
+ private func handleChunkedBody(_ data: Data) {
239
+ chunkedBuffer.append(data)
240
+ while true {
241
+ if chunkedRemaining < 0 {
242
+ let crlf = Data([0x0D, 0x0A])
243
+ guard let range = chunkedBuffer.range(of: crlf) else { return }
244
+ let sizeData = chunkedBuffer.subdata(in: 0..<range.lowerBound)
245
+ chunkedBuffer = chunkedBuffer.subdata(in: range.upperBound..<chunkedBuffer.count)
246
+ guard let sizeLine = String(data: sizeData, encoding: .utf8) else {
247
+ finish(error: URLError(.cannotParseResponse))
248
+ return
249
+ }
250
+ let hexPart = sizeLine.split(separator: ";").first.map(String.init) ?? sizeLine
251
+ let trimmed = hexPart.trimmingCharacters(in: .whitespaces)
252
+ guard let size = Int(trimmed, radix: 16) else {
253
+ finish(error: URLError(.cannotParseResponse))
254
+ return
255
+ }
256
+ chunkedRemaining = size
257
+ if size == 0 {
258
+ stage = .closed
259
+ finish(error: nil)
260
+ return
261
+ }
262
+ }
263
+
264
+ if chunkedBuffer.count >= chunkedRemaining + 2 {
265
+ let chunk = chunkedBuffer.subdata(in: 0..<chunkedRemaining)
266
+ let dropTo = chunkedRemaining + 2
267
+ chunkedBuffer = chunkedBuffer.subdata(in: dropTo..<chunkedBuffer.count)
268
+ for event in parser.append(chunk) {
269
+ onEvent?(event.event, event.id, event.data)
270
+ }
271
+ chunkedRemaining = -1
272
+ } else {
273
+ let take = min(chunkedRemaining, chunkedBuffer.count)
274
+ if take > 0 {
275
+ let chunk = chunkedBuffer.subdata(in: 0..<take)
276
+ chunkedBuffer = chunkedBuffer.subdata(in: take..<chunkedBuffer.count)
277
+ chunkedRemaining -= take
278
+ for event in parser.append(chunk) {
279
+ onEvent?(event.event, event.id, event.data)
280
+ }
281
+ }
282
+ return
283
+ }
284
+ }
285
+ }
286
+
287
+ private func finish(error: Error?) {
288
+ if completed { return }
289
+ completed = true
290
+ let s = status
291
+ stage = .closed
292
+ connection?.cancel()
293
+ connection = nil
294
+ onComplete?(s, error)
295
+ }
296
+ }
@@ -0,0 +1,8 @@
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ // Expose Swift haptic module to the React Native bridge
4
+ @interface RCT_EXTERN_MODULE(MonflowtsHaptic, NSObject)
5
+
6
+ RCT_EXTERN_METHOD(trigger:(NSString *)intensity)
7
+
8
+ @end
@@ -0,0 +1,55 @@
1
+ import UIKit
2
+
3
+ /**
4
+ * Native haptic module for iOS. Uses UIKit's haptic feedback generators
5
+ * (UIImpactFeedbackGenerator / UISelectionFeedbackGenerator /
6
+ * UINotificationFeedbackGenerator) for proper Apple-tuned haptic taps
7
+ * instead of a legacy AudioServicesPlaySystemSound vibration.
8
+ *
9
+ * Exposed to JS as NativeModules.MonflowtsHaptic.trigger(intensity).
10
+ */
11
+ @objc(MonflowtsHaptic)
12
+ class MonflowtsHapticModule: NSObject {
13
+
14
+ @objc static func requiresMainQueueSetup() -> Bool { return true }
15
+
16
+ // Retain generators so prepare() doesn't get garbage-collected before use.
17
+ // `prepared` generators produce noticeably snappier feedback.
18
+ private let lightImpact = UIImpactFeedbackGenerator(style: .light)
19
+ private let mediumImpact = UIImpactFeedbackGenerator(style: .medium)
20
+ private let heavyImpact = UIImpactFeedbackGenerator(style: .heavy)
21
+ private let selectionGen = UISelectionFeedbackGenerator()
22
+ private let notificationGen = UINotificationFeedbackGenerator()
23
+
24
+ @objc func trigger(_ intensity: NSString) {
25
+ DispatchQueue.main.async { [weak self] in
26
+ guard let self = self else { return }
27
+ switch intensity as String {
28
+ case "light":
29
+ self.lightImpact.prepare()
30
+ self.lightImpact.impactOccurred()
31
+ case "medium":
32
+ self.mediumImpact.prepare()
33
+ self.mediumImpact.impactOccurred()
34
+ case "heavy":
35
+ self.heavyImpact.prepare()
36
+ self.heavyImpact.impactOccurred()
37
+ case "selection":
38
+ self.selectionGen.prepare()
39
+ self.selectionGen.selectionChanged()
40
+ case "success":
41
+ self.notificationGen.prepare()
42
+ self.notificationGen.notificationOccurred(.success)
43
+ case "warning":
44
+ self.notificationGen.prepare()
45
+ self.notificationGen.notificationOccurred(.warning)
46
+ case "error":
47
+ self.notificationGen.prepare()
48
+ self.notificationGen.notificationOccurred(.error)
49
+ default:
50
+ self.lightImpact.prepare()
51
+ self.lightImpact.impactOccurred()
52
+ }
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,12 @@
1
+ #import <React/RCTViewManager.h>
2
+
3
+ @interface RCT_EXTERN_MODULE(MonflowtsLottieViewManager, RCTViewManager)
4
+
5
+ RCT_EXPORT_VIEW_PROPERTY(sourceJson, NSString)
6
+ RCT_EXPORT_VIEW_PROPERTY(loop, BOOL)
7
+ RCT_EXPORT_VIEW_PROPERTY(speed, CGFloat)
8
+ RCT_EXPORT_VIEW_PROPERTY(autoPlay, BOOL)
9
+ RCT_EXPORT_VIEW_PROPERTY(playing, BOOL)
10
+ RCT_EXPORT_VIEW_PROPERTY(onMonflowtsAnimationFinish, RCTDirectEventBlock)
11
+
12
+ @end
@@ -0,0 +1,95 @@
1
+ import UIKit
2
+ import Lottie
3
+ import React
4
+
5
+ class MonflowtsLottieUIView: UIView {
6
+
7
+ @objc var onMonflowtsAnimationFinish: RCTDirectEventBlock?
8
+
9
+ private var animationView: LottieAnimationView?
10
+ private var currentSource: String?
11
+ private var loop = false
12
+ private var speed: CGFloat = 1
13
+ private var autoPlay = false
14
+ private var playing = false
15
+
16
+ override init(frame: CGRect) {
17
+ super.init(frame: frame)
18
+ backgroundColor = .clear
19
+ isUserInteractionEnabled = false
20
+ }
21
+
22
+ required init?(coder: NSCoder) {
23
+ super.init(coder: coder)
24
+ backgroundColor = .clear
25
+ }
26
+
27
+ // MARK: - Props set from RN
28
+
29
+ @objc func setSourceJson(_ json: NSString?) {
30
+ guard let json = json as String?, !json.isEmpty else { return }
31
+ if json == currentSource { return }
32
+ currentSource = json
33
+
34
+ animationView?.removeFromSuperview()
35
+ animationView = nil
36
+
37
+ guard let data = json.data(using: .utf8) else { return }
38
+ do {
39
+ let animation = try LottieAnimation.from(data: data)
40
+ let view = LottieAnimationView(animation: animation)
41
+ view.contentMode = .scaleAspectFit
42
+ view.backgroundBehavior = .pauseAndRestore
43
+ view.loopMode = loop ? .loop : .playOnce
44
+ view.animationSpeed = speed
45
+ view.translatesAutoresizingMaskIntoConstraints = false
46
+ addSubview(view)
47
+ NSLayoutConstraint.activate([
48
+ view.topAnchor.constraint(equalTo: topAnchor),
49
+ view.bottomAnchor.constraint(equalTo: bottomAnchor),
50
+ view.leadingAnchor.constraint(equalTo: leadingAnchor),
51
+ view.trailingAnchor.constraint(equalTo: trailingAnchor),
52
+ ])
53
+ animationView = view
54
+ if autoPlay || playing {
55
+ play()
56
+ }
57
+ } catch {
58
+ // Silently fail if JSON is invalid
59
+ }
60
+ }
61
+
62
+ @objc func setLoop(_ loop: Bool) {
63
+ self.loop = loop
64
+ animationView?.loopMode = loop ? .loop : .playOnce
65
+ }
66
+
67
+ @objc func setSpeed(_ speed: CGFloat) {
68
+ self.speed = speed
69
+ animationView?.animationSpeed = speed
70
+ }
71
+
72
+ @objc func setAutoPlay(_ autoPlay: Bool) {
73
+ self.autoPlay = autoPlay
74
+ if autoPlay {
75
+ play()
76
+ }
77
+ }
78
+
79
+ @objc func setPlaying(_ playing: Bool) {
80
+ self.playing = playing
81
+ if playing {
82
+ play()
83
+ } else {
84
+ animationView?.stop()
85
+ }
86
+ }
87
+
88
+ private func play() {
89
+ animationView?.play { [weak self] finished in
90
+ if finished {
91
+ self?.onMonflowtsAnimationFinish?([:])
92
+ }
93
+ }
94
+ }
95
+ }
@@ -0,0 +1,13 @@
1
+ import React
2
+
3
+ @objc(MonflowtsLottieViewManager)
4
+ class MonflowtsLottieViewManager: RCTViewManager {
5
+
6
+ override func view() -> UIView! {
7
+ return MonflowtsLottieUIView()
8
+ }
9
+
10
+ override static func requiresMainQueueSetup() -> Bool {
11
+ return false
12
+ }
13
+ }
@@ -0,0 +1,58 @@
1
+ import Foundation
2
+
3
+ struct MonflowtsSSERecord {
4
+ let event: String?
5
+ let id: String?
6
+ let data: String?
7
+ }
8
+
9
+ final class MonflowtsSSEParser {
10
+ private var buffer = Data()
11
+
12
+ func append(_ incoming: Data) -> [MonflowtsSSERecord] {
13
+ buffer.append(incoming)
14
+ var records: [MonflowtsSSERecord] = []
15
+ let separator = Data([0x0A, 0x0A])
16
+ while let range = buffer.range(of: separator) {
17
+ let recordData = buffer.subdata(in: 0..<range.lowerBound)
18
+ buffer.removeSubrange(0..<range.upperBound)
19
+ if let record = parseRecord(recordData) {
20
+ records.append(record)
21
+ }
22
+ }
23
+ return records
24
+ }
25
+
26
+ private func parseRecord(_ data: Data) -> MonflowtsSSERecord? {
27
+ guard let text = String(data: data, encoding: .utf8) else { return nil }
28
+ var event: String?
29
+ var id: String?
30
+ var dataLines: [String] = []
31
+
32
+ for rawLine in text.split(separator: "\n", omittingEmptySubsequences: false) {
33
+ let line = rawLine.hasSuffix("\r") ? String(rawLine.dropLast()) : String(rawLine)
34
+ if line.isEmpty || line.hasPrefix(":") { continue }
35
+
36
+ let field: String
37
+ var value: String
38
+ if let colon = line.firstIndex(of: ":") {
39
+ field = String(line[..<colon])
40
+ value = String(line[line.index(after: colon)...])
41
+ if value.hasPrefix(" ") { value.removeFirst() }
42
+ } else {
43
+ field = line
44
+ value = ""
45
+ }
46
+
47
+ switch field {
48
+ case "event": event = value
49
+ case "id": id = value
50
+ case "data": dataLines.append(value)
51
+ default: break
52
+ }
53
+ }
54
+
55
+ if event == nil && id == nil && dataLines.isEmpty { return nil }
56
+ return MonflowtsSSERecord(event: event, id: id, data: dataLines.isEmpty ? nil : dataLines.joined(separator: "\n"))
57
+ }
58
+ }
@@ -0,0 +1,8 @@
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ // Expose Swift module to React Native bridge
4
+ @interface RCT_EXTERN_MODULE(MonflowtsSound, NSObject)
5
+
6
+ RCT_EXTERN_METHOD(play:(NSDictionary *)params)
7
+
8
+ @end
@@ -0,0 +1,100 @@
1
+ import AVFoundation
2
+
3
+ @objc(MonflowtsSound)
4
+ class MonflowtsSoundModule: NSObject {
5
+
6
+ private var engine: AVAudioEngine?
7
+ private let queue = DispatchQueue(label: "com.monflowts.sound", qos: .userInteractive)
8
+
9
+ override init() {
10
+ super.init()
11
+ engine = AVAudioEngine()
12
+ configureAudioSession()
13
+ }
14
+
15
+ private func configureAudioSession() {
16
+ // Use .ambient so our short UI/game tones mix with music/podcasts playing
17
+ // in other apps instead of interrupting or ducking them.
18
+ let session = AVAudioSession.sharedInstance()
19
+ do {
20
+ try session.setCategory(.ambient, mode: .default, options: [.mixWithOthers])
21
+ try session.setActive(true, options: [])
22
+ } catch {
23
+ // If the session can't be configured, fall through — sound will still play
24
+ // but may interrupt other audio on some devices.
25
+ }
26
+ }
27
+
28
+ @objc static func requiresMainQueueSetup() -> Bool { return false }
29
+
30
+ @objc func play(_ params: NSDictionary) {
31
+ let waveform = params["waveform"] as? String ?? "sine"
32
+ let f0 = params["f0"] as? Double ?? 440.0
33
+ let f1 = params["f1"] as? Double ?? 440.0
34
+ let durMs = params["durMs"] as? Int ?? 100
35
+ let gain = params["gain"] as? Float ?? 0.1
36
+
37
+ queue.async { [weak self] in
38
+ self?.generateAndPlay(waveform: waveform, f0: Float(f0), f1: Float(f1), durMs: durMs, gain: gain)
39
+ }
40
+ }
41
+
42
+ private func generateAndPlay(waveform: String, f0: Float, f1: Float, durMs: Int, gain: Float) {
43
+ guard let engine = engine else { return }
44
+
45
+ let sampleRate: Double = 44100
46
+ let numSamples = Int(sampleRate * Double(durMs) / 1000.0)
47
+ var phase: Float = 0.0
48
+
49
+ let format = AVAudioFormat(standardFormatWithSampleRate: sampleRate, channels: 1)!
50
+ let buffer = AVAudioPCMBuffer(pcmFormat: format, frameCapacity: AVAudioFrameCount(numSamples))!
51
+ buffer.frameLength = AVAudioFrameCount(numSamples)
52
+
53
+ let floatData = buffer.floatChannelData![0]
54
+
55
+ for i in 0..<numSamples {
56
+ let t = Float(i) / Float(numSamples)
57
+ let freq = f0 + (f1 - f0) * t
58
+ let envelope = gain * (1.0 - t * t)
59
+
60
+ let sample: Float
61
+ switch waveform {
62
+ case "sine":
63
+ sample = sin(phase)
64
+ case "triangle":
65
+ let triPhase: Float = phase / (2.0 * Float.pi)
66
+ let triVal: Float = triPhase - floor(triPhase + 0.5)
67
+ sample = 2.0 * abs(2.0 * triVal) - 1.0
68
+ case "square":
69
+ sample = sin(phase) >= 0 ? 1.0 : -1.0
70
+ case "sawtooth":
71
+ let sawPhase: Float = phase / (2.0 * Float.pi)
72
+ let sawVal: Float = sawPhase - floor(sawPhase + 0.5)
73
+ sample = 2.0 * sawVal
74
+ default:
75
+ sample = sin(phase)
76
+ }
77
+
78
+ floatData[i] = sample * envelope
79
+ phase += 2 * .pi * freq / Float(sampleRate)
80
+ }
81
+
82
+ let playerNode = AVAudioPlayerNode()
83
+ engine.attach(playerNode)
84
+ engine.connect(playerNode, to: engine.mainMixerNode, format: format)
85
+
86
+ do {
87
+ if !engine.isRunning {
88
+ try engine.start()
89
+ }
90
+ playerNode.scheduleBuffer(buffer, completionHandler: { [weak engine] in
91
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
92
+ engine?.detach(playerNode)
93
+ }
94
+ })
95
+ playerNode.play()
96
+ } catch {
97
+ // Silently ignore audio errors
98
+ }
99
+ }
100
+ }
@@ -0,0 +1,9 @@
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ @interface RCT_EXTERN_MODULE(MonflowtsSpeech, NSObject)
4
+
5
+ RCT_EXTERN_METHOD(speak:(NSDictionary *)params)
6
+ RCT_EXTERN_METHOD(playClip:(NSString *)urlString)
7
+ RCT_EXTERN_METHOD(stop)
8
+
9
+ @end