@onairos/react-native 3.7.1 → 3.7.3

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 (241) hide show
  1. package/lib/commonjs/api/index.js +219 -9
  2. package/lib/commonjs/assets/icons/spotify.png +0 -0
  3. package/lib/commonjs/assets/images/spotify.png +0 -0
  4. package/lib/commonjs/components/BodyText.js +27 -9
  5. package/lib/commonjs/components/BrandMark.js +111 -10
  6. package/lib/commonjs/components/CodeInput.js +116 -9
  7. package/lib/commonjs/components/EmailInput.js +30 -8
  8. package/lib/commonjs/components/GoogleButton.js +56 -9
  9. package/lib/commonjs/components/HeadingGroup.js +43 -9
  10. package/lib/commonjs/components/LLMDataInputModal.js +664 -14
  11. package/lib/commonjs/components/ModalHeader.js +99 -9
  12. package/lib/commonjs/components/ModalSheet.js +47 -9
  13. package/lib/commonjs/components/Onairos.js +380 -14
  14. package/lib/commonjs/components/OnairosButton.js +313 -13
  15. package/lib/commonjs/components/OnairosSignInButton.js +130 -12
  16. package/lib/commonjs/components/Overlay.js +465 -13
  17. package/lib/commonjs/components/PersonaImage.js +137 -10
  18. package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
  19. package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
  20. package/lib/commonjs/components/PinCreationScreen.js +403 -12
  21. package/lib/commonjs/components/PinInput.js +464 -9
  22. package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
  23. package/lib/commonjs/components/PlatformList.js +137 -10
  24. package/lib/commonjs/components/PlatformToggle.js +180 -9
  25. package/lib/commonjs/components/PrimaryButton.js +180 -10
  26. package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
  27. package/lib/commonjs/components/SignInStep.js +345 -12
  28. package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
  29. package/lib/commonjs/components/VerificationStep.js +176 -11
  30. package/lib/commonjs/components/WelcomeScreen.js +461 -22
  31. package/lib/commonjs/components/icons/Basicproficon.js +37 -8
  32. package/lib/commonjs/components/icons/Basicprofile.js +21 -8
  33. package/lib/commonjs/components/icons/Checkbox.js +21 -8
  34. package/lib/commonjs/components/icons/Checkmark.js +27 -8
  35. package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
  36. package/lib/commonjs/components/icons/Contenticon.js +39 -8
  37. package/lib/commonjs/components/icons/EnochE.js +41 -8
  38. package/lib/commonjs/components/icons/Personalityicon.js +30 -8
  39. package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
  40. package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
  41. package/lib/commonjs/components/icons/Userpreferences.js +21 -8
  42. package/lib/commonjs/components/icons/index.js +84 -17
  43. package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
  44. package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
  45. package/lib/commonjs/components/onboarding/PinInput.js +283 -10
  46. package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
  47. package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
  48. package/lib/commonjs/config/api.js +56 -7
  49. package/lib/commonjs/constants/index.js +120 -7
  50. package/lib/commonjs/context/AuthContext.js +345 -10
  51. package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
  52. package/lib/commonjs/hooks/useConnections.js +102 -8
  53. package/lib/commonjs/hooks/useCredentials.js +178 -10
  54. package/lib/commonjs/hooks/useUserConnections.js +148 -10
  55. package/lib/commonjs/index.js +439 -34
  56. package/lib/commonjs/services/apiClient.js +298 -8
  57. package/lib/commonjs/services/biometricPinService.js +180 -8
  58. package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
  59. package/lib/commonjs/services/chatGPTConversationService.js +275 -9
  60. package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
  61. package/lib/commonjs/services/claudeConversationService.js +158 -9
  62. package/lib/commonjs/services/connectedAccountsService.js +310 -10
  63. package/lib/commonjs/services/googleAuthService.js +252 -11
  64. package/lib/commonjs/services/hingeDataExtractor.js +105 -8
  65. package/lib/commonjs/services/hingeDataService.js +150 -9
  66. package/lib/commonjs/services/imageCompressionService.js +260 -7
  67. package/lib/commonjs/services/instagramDataExtractor.js +126 -8
  68. package/lib/commonjs/services/instagramDataService.js +163 -9
  69. package/lib/commonjs/services/jwtStorageService.js +276 -7
  70. package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
  71. package/lib/commonjs/services/linkedinProfileService.js +222 -9
  72. package/lib/commonjs/services/linkedinScrapingService.js +230 -8
  73. package/lib/commonjs/services/llmDataStorage.js +294 -8
  74. package/lib/commonjs/services/mobileTrainingService.js +186 -8
  75. package/lib/commonjs/services/netflixDataExtractor.js +120 -8
  76. package/lib/commonjs/services/netflixDataService.js +198 -9
  77. package/lib/commonjs/services/pinEncryptionService.js +84 -8
  78. package/lib/commonjs/services/pinStorageUtils.js +105 -7
  79. package/lib/commonjs/services/platformAuthService.js +1484 -12
  80. package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
  81. package/lib/commonjs/services/sephoraDataService.js +200 -9
  82. package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
  83. package/lib/commonjs/services/spotifyDataService.js +241 -9
  84. package/lib/commonjs/services/storageService.js +404 -8
  85. package/lib/commonjs/services/telegramDataExtractor.js +115 -8
  86. package/lib/commonjs/services/telegramDataService.js +499 -9
  87. package/lib/commonjs/services/trainingApiHelpers.js +73 -7
  88. package/lib/commonjs/services/userConnectionsService.js +340 -10
  89. package/lib/commonjs/services/youtubeMigrationService.js +416 -10
  90. package/lib/commonjs/theme/index.js +250 -7
  91. package/lib/commonjs/types/ambient.d.js +2 -1
  92. package/lib/commonjs/types/declarations.d.js +2 -1
  93. package/lib/commonjs/types/index.js +6 -1
  94. package/lib/commonjs/types/node-fix.d.js +2 -1
  95. package/lib/commonjs/types/node-override.d.js +2 -1
  96. package/lib/commonjs/types/opacity.d.js +2 -1
  97. package/lib/commonjs/types.js +14 -1
  98. package/lib/commonjs/utils/Portal.js +98 -8
  99. package/lib/commonjs/utils/api.js +130 -9
  100. package/lib/commonjs/utils/assetRegistry.js +210 -35
  101. package/lib/commonjs/utils/auth.js +112 -9
  102. package/lib/commonjs/utils/connectorTests.js +613 -29
  103. package/lib/commonjs/utils/crypto.js +62 -8
  104. package/lib/commonjs/utils/debugHelper.js +64 -1
  105. package/lib/commonjs/utils/encryption.js +76 -7
  106. package/lib/commonjs/utils/eventUtils.js +288 -1
  107. package/lib/commonjs/utils/haptics.js +66 -9
  108. package/lib/commonjs/utils/imagePreloader.js +6 -1
  109. package/lib/commonjs/utils/networkDiagnostics.js +226 -8
  110. package/lib/commonjs/utils/onairosApi.js +350 -9
  111. package/lib/commonjs/utils/programmaticFlow.js +117 -9
  112. package/lib/commonjs/utils/retryHelper.js +220 -1
  113. package/lib/commonjs/utils/secureStorage.js +349 -10
  114. package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
  115. package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
  116. package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
  117. package/lib/commonjs/utils/webviewScripts/index.js +698 -15
  118. package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
  119. package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
  120. package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
  121. package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
  122. package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
  123. package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
  124. package/lib/module/api/index.js +211 -1
  125. package/lib/module/assets/icons/spotify.png +0 -0
  126. package/lib/module/assets/images/spotify.png +0 -0
  127. package/lib/module/components/BodyText.js +20 -1
  128. package/lib/module/components/BrandMark.js +104 -1
  129. package/lib/module/components/CodeInput.js +109 -1
  130. package/lib/module/components/EmailInput.js +23 -1
  131. package/lib/module/components/GoogleButton.js +49 -1
  132. package/lib/module/components/HeadingGroup.js +36 -1
  133. package/lib/module/components/LLMDataInputModal.js +656 -7
  134. package/lib/module/components/ModalHeader.js +92 -1
  135. package/lib/module/components/ModalSheet.js +39 -1
  136. package/lib/module/components/Onairos.js +373 -1
  137. package/lib/module/components/OnairosButton.js +305 -1
  138. package/lib/module/components/OnairosSignInButton.js +121 -1
  139. package/lib/module/components/Overlay.js +456 -1
  140. package/lib/module/components/PersonaImage.js +129 -1
  141. package/lib/module/components/PersonaLoadingScreen.js +310 -1
  142. package/lib/module/components/PersonalizationConsentScreen.js +460 -1
  143. package/lib/module/components/PinCreationScreen.js +396 -1
  144. package/lib/module/components/PinInput.js +456 -1
  145. package/lib/module/components/PlatformConnectorsStep.js +1302 -6
  146. package/lib/module/components/PlatformList.js +129 -1
  147. package/lib/module/components/PlatformToggle.js +173 -1
  148. package/lib/module/components/PrimaryButton.js +172 -1
  149. package/lib/module/components/SignInMatchAnimation.js +189 -1
  150. package/lib/module/components/SignInStep.js +338 -1
  151. package/lib/module/components/UniversalOnboarding.js +2770 -1
  152. package/lib/module/components/VerificationStep.js +168 -1
  153. package/lib/module/components/WelcomeScreen.js +453 -1
  154. package/lib/module/components/icons/Basicproficon.js +30 -1
  155. package/lib/module/components/icons/Basicprofile.js +14 -1
  156. package/lib/module/components/icons/Checkbox.js +14 -1
  157. package/lib/module/components/icons/Checkmark.js +20 -1
  158. package/lib/module/components/icons/Contentanalysis.js +14 -1
  159. package/lib/module/components/icons/Contenticon.js +32 -1
  160. package/lib/module/components/icons/EnochE.js +34 -1
  161. package/lib/module/components/icons/Personalityicon.js +23 -1
  162. package/lib/module/components/icons/Personalityprofile.js +14 -1
  163. package/lib/module/components/icons/Personalitytraits.js +14 -1
  164. package/lib/module/components/icons/Userpreferences.js +14 -1
  165. package/lib/module/components/icons/index.js +13 -1
  166. package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
  167. package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
  168. package/lib/module/components/onboarding/PinInput.js +274 -1
  169. package/lib/module/components/onboarding/PlatformConnector.js +240 -1
  170. package/lib/module/config/PLATFORM_APIS.md +849 -0
  171. package/lib/module/config/api.js +47 -1
  172. package/lib/module/constants/index.js +114 -1
  173. package/lib/module/context/AuthContext.js +335 -1
  174. package/lib/module/hooks/useConnectedAccounts.js +106 -1
  175. package/lib/module/hooks/useConnections.js +95 -1
  176. package/lib/module/hooks/useCredentials.js +171 -6
  177. package/lib/module/hooks/useUserConnections.js +140 -1
  178. package/lib/module/index.js +172 -1
  179. package/lib/module/services/apiClient.js +295 -1
  180. package/lib/module/services/biometricPinService.js +169 -1
  181. package/lib/module/services/chatGPTConversationExtractor.js +149 -1
  182. package/lib/module/services/chatGPTConversationService.js +268 -1
  183. package/lib/module/services/claudeConversationExtractor.js +97 -1
  184. package/lib/module/services/claudeConversationService.js +151 -1
  185. package/lib/module/services/connectedAccountsService.js +293 -1
  186. package/lib/module/services/googleAuthService.js +241 -1
  187. package/lib/module/services/hingeDataExtractor.js +99 -1
  188. package/lib/module/services/hingeDataService.js +143 -1
  189. package/lib/module/services/imageCompressionService.js +250 -1
  190. package/lib/module/services/instagramDataExtractor.js +120 -1
  191. package/lib/module/services/instagramDataService.js +156 -1
  192. package/lib/module/services/jwtStorageService.js +257 -1
  193. package/lib/module/services/linkedinDOMExtractor.js +234 -1
  194. package/lib/module/services/linkedinProfileService.js +210 -1
  195. package/lib/module/services/linkedinScrapingService.js +219 -1
  196. package/lib/module/services/llmDataStorage.js +277 -1
  197. package/lib/module/services/mobileTrainingService.js +173 -1
  198. package/lib/module/services/netflixDataExtractor.js +114 -1
  199. package/lib/module/services/netflixDataService.js +191 -1
  200. package/lib/module/services/pinEncryptionService.js +74 -6
  201. package/lib/module/services/pinStorageUtils.js +93 -1
  202. package/lib/module/services/platformAuthService.js +1461 -1
  203. package/lib/module/services/sephoraDataExtractor.js +134 -1
  204. package/lib/module/services/sephoraDataService.js +193 -1
  205. package/lib/module/services/spotifyDataExtractor.js +142 -1
  206. package/lib/module/services/spotifyDataService.js +234 -1
  207. package/lib/module/services/storageService.js +383 -1
  208. package/lib/module/services/telegramDataExtractor.js +109 -1
  209. package/lib/module/services/telegramDataService.js +493 -1
  210. package/lib/module/services/trainingApiHelpers.js +67 -1
  211. package/lib/module/services/userConnectionsService.js +329 -1
  212. package/lib/module/services/youtubeMigrationService.js +405 -1
  213. package/lib/module/theme/index.js +245 -1
  214. package/lib/module/types.js +10 -1
  215. package/lib/module/utils/Portal.js +90 -1
  216. package/lib/module/utils/api.js +118 -1
  217. package/lib/module/utils/assetRegistry.js +200 -34
  218. package/lib/module/utils/auth.js +100 -1
  219. package/lib/module/utils/connectorTests.js +600 -27
  220. package/lib/module/utils/crypto.js +54 -1
  221. package/lib/module/utils/debugHelper.js +54 -1
  222. package/lib/module/utils/encryption.js +67 -1
  223. package/lib/module/utils/eventUtils.js +270 -1
  224. package/lib/module/utils/haptics.js +59 -8
  225. package/lib/module/utils/imagePreloader.js +3 -1
  226. package/lib/module/utils/networkDiagnostics.js +217 -1
  227. package/lib/module/utils/onairosApi.js +333 -1
  228. package/lib/module/utils/programmaticFlow.js +111 -1
  229. package/lib/module/utils/retryHelper.js +211 -1
  230. package/lib/module/utils/secureStorage.js +330 -6
  231. package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
  232. package/lib/module/utils/webviewScripts/claude.js +370 -1
  233. package/lib/module/utils/webviewScripts/hinge.js +405 -1
  234. package/lib/module/utils/webviewScripts/index.js +434 -1
  235. package/lib/module/utils/webviewScripts/instagram.js +448 -1
  236. package/lib/module/utils/webviewScripts/linkedin.js +874 -1
  237. package/lib/module/utils/webviewScripts/netflix.js +376 -1
  238. package/lib/module/utils/webviewScripts/sephora.js +510 -1
  239. package/lib/module/utils/webviewScripts/spotify.js +413 -1
  240. package/lib/module/utils/webviewScripts/telegram.js +672 -1
  241. package/package.json +2 -2
@@ -1,7 +1,260 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("@bam.tech/react-native-image-resizer")
5
- ];
6
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
7
- Object[_0x19d0(0x0)](exports,_0x19d0(0x1),{'value':!![]}),exports[_0x19d0(0x2)]=exports['compressProfilePicture']=exports[_0x19d0(0x3)]=exports[_0x19d0(0x4)]=void 0x0;function _0x2f9c(){const _0x4e42e6=['defineProperty','__esModule','convertImageToOptimizedBase64','compressImageToTarget','compressForUpload','fJiUT','EXqJi','POsZu','blob','hZzCa','FydHk','MVMjU','atCYi','result','split','qbmjW','PxGHW','epJlL','eHhlB','round','oWPXm','max','sfISC','RQaGs','onloadend','WszPA','hUSqV','onerror','hNQDv','UDJUA','cADxQ','error','qUyoR','Unknown\x20compression\x20error','Error\x20getting\x20file\x20size:','JPEG','xVsdG','nmSHs','contain','🎯\x20[COMPRESSION]\x20Success:','KeCTj','qypOL','FosaM','📤\x20[COMPRESSION]\x20Final\x20result\x20(best\x20effort):','❌\x20[COMPRESSION]\x20Final\x20compression\x20attempt\x20failed:','log','🖼️\x20[COMPRESSION]\x20Starting\x20compression\x20for:','CjECr','koekD','🔄\x20[COMPRESSION]\x20Attempt\x20',':\x20quality=',',\x20size=','wsBPX','NULBe','LeQcY','default','createResizedImage','KFGob','xscqx','uri','MrAKV','\x20result:\x20','\x20KB','TDAAW','LEsmH','flKLv','JCeXM','AiFlW','aiell','gQRyU','jsmjA','ToKyY','RXIUl','Lyaqp','CDrGg','axJkg','VbTJu','\x20failed:','ZMATL','Cwgbh','tCiqm','hZwpZ','⚠️\x20[COMPRESSION]\x20Max\x20attempts\x20reached,\x20using\x20best\x20effort','WfRuW','IUrUG','oGppV','XhOvL','eKyAt','Failed\x20to\x20compress\x20image\x20to\x20','KB\x20after\x20','\x20attempts','ltjjF','compressProfilePicture','HhzKu','iNpOF','MAcpp','cbwCX','success','base64'];_0x2f9c=function(){return _0x4e42e6;};return _0x2f9c();}var _reactNativeImageResizer=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x0));function _interopRequireDefault(_0x20dfb7){return _0x20dfb7&&_0x20dfb7['__esModule']?_0x20dfb7:{'default':_0x20dfb7};}const getFileSizeFromUri=async _0xd6760b=>{const _0x2b57c3={'POsZu':function(_0x596d35,_0x480129){return _0x596d35(_0x480129);},'hZzCa':function(_0x2d7888,_0x516cbc){return _0x2d7888!==_0x516cbc;},'FydHk':_0x19d0(0x5),'MVMjU':_0x19d0(0x6),'atCYi':'Error\x20getting\x20file\x20size:'};try{const _0x47aee0=await _0x2b57c3[_0x19d0(0x7)](fetch,_0xd6760b),_0x5169e7=await _0x47aee0[_0x19d0(0x8)]();return _0x5169e7['size'];}catch(_0x492c2b){if(_0x2b57c3[_0x19d0(0x9)](_0x2b57c3[_0x19d0(0xa)],_0x2b57c3[_0x19d0(0xb)]))return console['error'](_0x2b57c3[_0x19d0(0xc)],_0x492c2b),0x0;else{const _0x51b3d2=_0x12cf4e[_0x19d0(0xd)],_0xff9e9e=_0x51b3d2[_0x19d0(0xe)](',')[0x1];_0x24fc11(_0xff9e9e);}}},imageToBase64=async _0x3a9b50=>{const _0x44b93d={'eHhlB':function(_0x13a2f1,_0xbb173f){return _0x13a2f1/_0xbb173f;},'utgpF':function(_0x212fb6,_0x3c5d76){return _0x212fb6>_0x3c5d76;},'oWPXm':function(_0x405e9c,_0xe85287){return _0x405e9c*_0xe85287;},'yzUqx':function(_0x3eca29,_0x38cff0){return _0x3eca29>_0x38cff0;},'RQaGs':function(_0x54ae3e,_0x4558e5){return _0x54ae3e(_0x4558e5);},'qUyoR':function(_0x4e28d0,_0x2956fa){return _0x4e28d0(_0x2956fa);},'PxGHW':function(_0x1fb8e7,_0xf2870f){return _0x1fb8e7!==_0xf2870f;},'wCKpF':'epJlL','sfISC':function(_0xd024d0,_0xd65272){return _0xd024d0(_0xd65272);},'hNQDv':function(_0x498b24,_0x22d321){return _0x498b24!==_0x22d321;},'UDJUA':_0x19d0(0xf),'iGTEi':'Error\x20converting\x20image\x20to\x20base64:'};try{if(_0x44b93d[_0x19d0(0x10)](_0x44b93d['wCKpF'],_0x19d0(0x11))){const _0x54400e=_0x44b93d[_0x19d0(0x12)](_0x165279,_0x43b507);if(_0x44b93d['utgpF'](_0x54400e,0x2))_0x513601*=0.6,_0x5ad29a=_0x139c76[_0x19d0(0x13)](_0x44b93d[_0x19d0(0x14)](_0xa6da58,0.8)),_0x416f1d=_0x2ab29f[_0x19d0(0x13)](_0x193b75*0.8);else _0x44b93d['yzUqx'](_0x54400e,1.5)?(_0x24211d*=0.75,_0x300c13=_0x43153c[_0x19d0(0x13)](_0x664ef9*0.9),_0x3fa7c7=_0x4703fa[_0x19d0(0x13)](_0x44b93d['oWPXm'](_0x3ad6f8,0.9))):_0x479265*=0.85;_0x33bc3d=_0x1e5176[_0x19d0(0x15)](0.1,_0x41652e),_0x2e82bc=_0xe90134['max'](0x190,_0x12c4cf),_0x12aa89=_0x2e2c3e[_0x19d0(0x15)](0x190,_0x58342d);}else{const _0xdcff23=await _0x44b93d[_0x19d0(0x16)](fetch,_0x3a9b50),_0xbce2e1=await _0xdcff23['blob']();return new Promise((_0x561649,_0x3bba0d)=>{const _0x4eaefe={'WszPA':function(_0x3bec0a,_0x1fb117){return _0x3bec0a(_0x1fb117);},'hUSqV':function(_0x5314a2,_0xb18089){return _0x44b93d[_0x19d0(0x17)](_0x5314a2,_0xb18089);}},_0x2de3a=new FileReader();_0x2de3a[_0x19d0(0x18)]=()=>{try{const _0x390391=_0x2de3a[_0x19d0(0xd)],_0x3ddb03=_0x390391[_0x19d0(0xe)](',')[0x1];_0x4eaefe[_0x19d0(0x19)](_0x561649,_0x3ddb03);}catch(_0x58d2b1){_0x4eaefe[_0x19d0(0x1a)](_0x3bba0d,_0x58d2b1);}},_0x2de3a[_0x19d0(0x1b)]=_0x3bba0d,_0x2de3a['readAsDataURL'](_0xbce2e1);});}}catch(_0x27c66c){if(_0x44b93d[_0x19d0(0x1c)](_0x44b93d[_0x19d0(0x1d)],_0x19d0(0x1e)))return console[_0x19d0(0x1f)](_0x44b93d['iGTEi'],_0x27c66c),null;else{const _0x375d15=new _0x490f8c();_0x375d15[_0x19d0(0x18)]=()=>{try{const _0x518cc5=_0x375d15[_0x19d0(0xd)],_0x48928f=_0x518cc5[_0x19d0(0xe)](',')[0x1];_0x44b93d[_0x19d0(0x20)](_0x291972,_0x48928f);}catch(_0x5eaa07){_0x44b93d[_0x19d0(0x20)](_0xf09e11,_0x5eaa07);}},_0x375d15[_0x19d0(0x1b)]=_0x7374e7,_0x375d15['readAsDataURL'](_0xb500da);}}},compressImageToTarget=async(_0x46cc4f,_0x1fb386={})=>{const _0x1428e3={'NULBe':function(_0x55bed9,_0x1ae2d4){return _0x55bed9 instanceof _0x1ae2d4;},'LeQcY':_0x19d0(0x21),'kpkCx':_0x19d0(0x22),'RXIUl':function(_0x2bbb71,_0x4cdbe2){return _0x2bbb71*_0x4cdbe2;},'DiPSw':_0x19d0(0x23),'WtxsY':'📊\x20[COMPRESSION]\x20Original\x20size:','CjECr':function(_0x496393,_0x49888f){return _0x496393<=_0x49888f;},'LEsmH':function(_0x27d456,_0x25e04){return _0x27d456(_0x25e04);},'koekD':function(_0x30567b,_0x2d03f2){return _0x30567b<_0x2d03f2;},'flKLv':function(_0x4d3685,_0x24109a){return _0x4d3685===_0x24109a;},'zXjqv':_0x19d0(0x24),'wsBPX':_0x19d0(0x25),'WNhzN':function(_0x25b8e7,_0x52d8ef){return _0x25b8e7*_0x52d8ef;},'KFGob':_0x19d0(0x26),'xscqx':function(_0x5051c1,_0x5447cd){return _0x5051c1(_0x5447cd);},'MrAKV':function(_0xf27036,_0x5d9128){return _0xf27036/_0x5d9128;},'TDAAW':'✅\x20[COMPRESSION]\x20Target\x20size\x20achieved!','oCvdq':'fywqe','JCeXM':_0x19d0(0x27),'AiFlW':function(_0x3365f9,_0xea0a84){return _0x3365f9+_0xea0a84;},'aiell':function(_0x2958a3,_0x182b33){return _0x2958a3!==_0x182b33;},'gQRyU':_0x19d0(0x28),'ToKyY':function(_0x3a4a12,_0x60e1ff){return _0x3a4a12>_0x60e1ff;},'Lyaqp':function(_0x3c4b63,_0xa8bd79){return _0x3c4b63>_0xa8bd79;},'CDrGg':function(_0x35086e,_0x5c9b27){return _0x35086e!==_0x5c9b27;},'VbTJu':_0x19d0(0x29),'gakdv':function(_0x2b90aa,_0x495058){return _0x2b90aa*_0x495058;},'ZMATL':function(_0x413145,_0x59943c){return _0x413145*_0x59943c;},'Cwgbh':function(_0x52e546,_0x366b59){return _0x52e546<_0x366b59;},'hZwpZ':'dZkeY','WfRuW':'bIWnV','IUrUG':_0x19d0(0x2a),'oGppV':_0x19d0(0x2b),'XhOvL':function(_0x449728,_0x4dedc4){return _0x449728/_0x4dedc4;},'eKyAt':_0x19d0(0x2c),'ltjjF':'❌\x20[COMPRESSION]\x20Compression\x20service\x20error:','HfBzD':function(_0x25bbc3,_0x453022){return _0x25bbc3 instanceof _0x453022;}},{maxSizeKB:maxSizeKB=0x12c,maxWidth:maxWidth=0x4b0,maxHeight:maxHeight=0x4b0,quality:quality=0.8,format:format=_0x1428e3['DiPSw']}=_0x1fb386;try{console[_0x19d0(0x2d)](_0x19d0(0x2e),_0x46cc4f);const _0xcf4822=await getFileSizeFromUri(_0x46cc4f),_0xbfe508=Math[_0x19d0(0x13)](_0xcf4822/0x400);console[_0x19d0(0x2d)](_0x1428e3['WtxsY'],_0xbfe508,'KB');if(_0x1428e3[_0x19d0(0x2f)](_0xbfe508,maxSizeKB)){console[_0x19d0(0x2d)]('✅\x20[COMPRESSION]\x20Image\x20already\x20under\x20target\x20size');const _0x1ab336=await _0x1428e3['LEsmH'](imageToBase64,_0x46cc4f);if(_0x1ab336)return{'success':!![],'base64':_0x1ab336,'sizeKB':_0xbfe508,'originalSizeKB':_0xbfe508,'compressionRatio':0x1};}let _0x2143ce=quality,_0x49a7a9=maxWidth,_0xff26d6=maxHeight,_0x5eab5c=0x0;const _0x129492=0x8;while(_0x1428e3[_0x19d0(0x30)](_0x5eab5c,_0x129492)){_0x5eab5c++,console['log'](_0x19d0(0x31)+_0x5eab5c+_0x19d0(0x32)+_0x2143ce+_0x19d0(0x33)+_0x49a7a9+'x'+_0xff26d6);try{if(_0x1428e3['flKLv'](_0x1428e3['zXjqv'],_0x1428e3[_0x19d0(0x34)]))return _0x4e8919[_0x19d0(0x1f)]('❌\x20[COMPRESSION]\x20Compression\x20service\x20error:',_0x18fe28),{'success':![],'error':_0x1428e3[_0x19d0(0x35)](_0x1f520f,_0x53ea27)?_0xe05c9e['message']:_0x1428e3[_0x19d0(0x36)],'originalSizeKB':0x0};else{const _0x30c20e=await _reactNativeImageResizer[_0x19d0(0x37)][_0x19d0(0x38)](_0x46cc4f,_0x49a7a9,_0xff26d6,format,Math['round'](_0x1428e3['WNhzN'](_0x2143ce,0x64)),0x0,undefined,![],{'mode':_0x1428e3[_0x19d0(0x39)],'onlyScaleDown':!![]}),_0x3414da=await _0x1428e3[_0x19d0(0x3a)](getFileSizeFromUri,_0x30c20e[_0x19d0(0x3b)]),_0x4a2b6d=Math[_0x19d0(0x13)](_0x1428e3[_0x19d0(0x3c)](_0x3414da,0x400));console[_0x19d0(0x2d)]('📊\x20[COMPRESSION]\x20Attempt\x20'+_0x5eab5c+_0x19d0(0x3d)+_0x4a2b6d+_0x19d0(0x3e));if(_0x1428e3[_0x19d0(0x2f)](_0x4a2b6d,maxSizeKB)){console[_0x19d0(0x2d)](_0x1428e3[_0x19d0(0x3f)]);const _0x2d6db7=await _0x1428e3[_0x19d0(0x40)](imageToBase64,_0x30c20e[_0x19d0(0x3b)]);if(_0x2d6db7){if(_0x1428e3[_0x19d0(0x41)](_0x1428e3['oCvdq'],_0x1428e3['oCvdq'])){const _0x1bd40b=_0xbfe508/_0x4a2b6d;return console[_0x19d0(0x2d)](_0x1428e3[_0x19d0(0x42)],{'originalSizeKB':_0xbfe508,'finalSizeKB':_0x4a2b6d,'compressionRatio':_0x1428e3[_0x19d0(0x43)](_0x1bd40b['toFixed'](0x2),'x'),'attempts':_0x5eab5c}),{'success':!![],'base64':_0x2d6db7,'sizeKB':_0x4a2b6d,'originalSizeKB':_0xbfe508,'compressionRatio':_0x1bd40b};}else return _0xcadb9c(_0x554f69,{'maxSizeKB':0x12c,'maxWidth':0x4b0,'maxHeight':0x4b0,'quality':0.8,'format':_0x19d0(0x23)});}}if(_0x4a2b6d>maxSizeKB){if(_0x1428e3[_0x19d0(0x44)](_0x1428e3[_0x19d0(0x45)],_0x19d0(0x46))){const _0x20a39e=_0x1428e3[_0x19d0(0x3c)](_0x4a2b6d,maxSizeKB);if(_0x1428e3[_0x19d0(0x47)](_0x20a39e,0x2))_0x2143ce*=0.6,_0x49a7a9=Math[_0x19d0(0x13)](_0x49a7a9*0.8),_0xff26d6=Math[_0x19d0(0x13)](_0x1428e3[_0x19d0(0x48)](_0xff26d6,0.8));else{if(_0x1428e3[_0x19d0(0x49)](_0x20a39e,1.5)){if(_0x1428e3[_0x19d0(0x4a)](_0x19d0(0x4b),_0x1428e3[_0x19d0(0x4c)]))_0x2143ce*=0.75,_0x49a7a9=Math[_0x19d0(0x13)](_0x1428e3[_0x19d0(0x48)](_0x49a7a9,0.9)),_0xff26d6=Math[_0x19d0(0x13)](_0x1428e3['WNhzN'](_0xff26d6,0.9));else return _0x228ab4[_0x19d0(0x1f)](_0x1428e3['kpkCx'],_0x50c193),0x0;}else _0x2143ce*=0.85;}_0x2143ce=Math[_0x19d0(0x15)](0.1,_0x2143ce),_0x49a7a9=Math[_0x19d0(0x15)](0x190,_0x49a7a9),_0xff26d6=Math['max'](0x190,_0xff26d6);}else return _0x5e81e3&&_0x205c5d[_0x19d0(0x1)]?_0x80acbe:{'default':_0x566e71};}}}catch(_0x71af8d){console[_0x19d0(0x1f)]('❌\x20[COMPRESSION]\x20Resize\x20attempt\x20'+_0x5eab5c+_0x19d0(0x4d),_0x71af8d),_0x2143ce*=0.7,_0x49a7a9=Math[_0x19d0(0x13)](_0x1428e3['gakdv'](_0x49a7a9,0.8)),_0xff26d6=Math[_0x19d0(0x13)](_0x1428e3[_0x19d0(0x4e)](_0xff26d6,0.8));if(_0x1428e3[_0x19d0(0x4f)](_0x2143ce,0.1)||_0x1428e3[_0x19d0(0x4f)](_0x49a7a9,0xc8)||_0xff26d6<0xc8){if(_0x1428e3[_0x19d0(0x4a)](_0x19d0(0x50),_0x1428e3[_0x19d0(0x51)]))break;else _0x463570*=0.85;}}}console[_0x19d0(0x2d)](_0x19d0(0x52));try{const _0x4b9a6c=await _reactNativeImageResizer[_0x19d0(0x37)][_0x19d0(0x38)](_0x46cc4f,Math[_0x19d0(0x15)](0x190,_0x49a7a9),Math[_0x19d0(0x15)](0x190,_0xff26d6),format,0x1e,0x0,undefined,![],{'mode':_0x19d0(0x26),'onlyScaleDown':!![]}),_0xfaa8b9=await _0x1428e3['LEsmH'](getFileSizeFromUri,_0x4b9a6c[_0x19d0(0x3b)]),_0x111702=Math['round'](_0x1428e3[_0x19d0(0x3c)](_0xfaa8b9,0x400)),_0x26f054=await _0x1428e3[_0x19d0(0x40)](imageToBase64,_0x4b9a6c[_0x19d0(0x3b)]);if(_0x26f054){if(_0x1428e3[_0x19d0(0x41)](_0x1428e3[_0x19d0(0x53)],_0x1428e3[_0x19d0(0x54)]))_0xa13ef4*=0.6,_0x386849=_0xe6b0a['round'](_0x1428e3[_0x19d0(0x48)](_0x436100,0.8)),_0x416fbb=_0x48c39c['round'](_0x1428e3[_0x19d0(0x48)](_0x43fb97,0.8));else return console[_0x19d0(0x2d)](_0x1428e3[_0x19d0(0x55)],_0x111702,'KB'),{'success':!![],'base64':_0x26f054,'sizeKB':_0x111702,'originalSizeKB':_0xbfe508,'compressionRatio':_0x1428e3[_0x19d0(0x56)](_0xbfe508,_0x111702)};}}catch(_0x1a8c7c){console[_0x19d0(0x1f)](_0x1428e3[_0x19d0(0x57)],_0x1a8c7c);}return{'success':![],'error':_0x19d0(0x58)+maxSizeKB+_0x19d0(0x59)+_0x129492+_0x19d0(0x5a),'originalSizeKB':_0xbfe508};}catch(_0x242e45){return console[_0x19d0(0x1f)](_0x1428e3[_0x19d0(0x5b)],_0x242e45),{'success':![],'error':_0x1428e3['HfBzD'](_0x242e45,Error)?_0x242e45['message']:_0x1428e3[_0x19d0(0x36)],'originalSizeKB':0x0};}};exports[_0x19d0(0x3)]=compressImageToTarget;const compressProfilePicture=async _0x51b530=>{const _0x4e0711={'KxaZf':function(_0xa4a910,_0x458c8d,_0x11a87c){return _0xa4a910(_0x458c8d,_0x11a87c);}};return _0x4e0711['KxaZf'](compressImageToTarget,_0x51b530,{'maxSizeKB':0x12c,'maxWidth':0x4b0,'maxHeight':0x4b0,'quality':0.8,'format':_0x19d0(0x23)});};exports[_0x19d0(0x5c)]=compressProfilePicture;const compressForUpload=async(_0x282887,_0x159256=0x12c)=>{const _0x395bc7={'HhzKu':function(_0x5b4989,_0x399bf6,_0x86f585){return _0x5b4989(_0x399bf6,_0x86f585);},'iNpOF':_0x19d0(0x23)};return _0x395bc7[_0x19d0(0x5d)](compressImageToTarget,_0x282887,{'maxSizeKB':_0x159256,'maxWidth':0x4b0,'maxHeight':0x4b0,'quality':0.8,'format':_0x395bc7[_0x19d0(0x5e)]});};function _0x19d0(_0x2f9c1f,_0x19d0aa){_0x2f9c1f=_0x2f9c1f-0x0;const _0x144973=_0x2f9c();let _0x1294d1=_0x144973[_0x2f9c1f];return _0x1294d1;}exports['compressForUpload']=compressForUpload;const convertImageToOptimizedBase64=async(_0x4f5490,_0x25a17b=0.8)=>{const _0x4410d6={'MAcpp':function(_0x48e357,_0x41d6ee,_0xffbf71){return _0x48e357(_0x41d6ee,_0xffbf71);},'cbwCX':_0x19d0(0x23)},_0x25db74=await _0x4410d6[_0x19d0(0x5f)](compressImageToTarget,_0x4f5490,{'maxSizeKB':0x12c,'quality':_0x25a17b,'format':_0x4410d6[_0x19d0(0x60)]});return _0x25db74[_0x19d0(0x61)]?_0x25db74[_0x19d0(0x62)]||null:null;};exports[_0x19d0(0x2)]=convertImageToOptimizedBase64;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.convertImageToOptimizedBase64 = exports.compressProfilePicture = exports.compressImageToTarget = exports.compressForUpload = void 0;
7
+ var _reactNativeImageResizer = _interopRequireDefault(require("@bam.tech/react-native-image-resizer"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ /**
10
+ * Comprehensive image compression service for React Native
11
+ * Supports iterative compression to meet specific size targets
12
+ */
13
+
14
+ /**
15
+ * Get file size from URI (React Native compatible)
16
+ */
17
+ const getFileSizeFromUri = async uri => {
18
+ try {
19
+ const response = await fetch(uri);
20
+ const blob = await response.blob();
21
+ return blob.size;
22
+ } catch (error) {
23
+ console.error('Error getting file size:', error);
24
+ return 0;
25
+ }
26
+ };
27
+
28
+ /**
29
+ * Convert image to base64 string
30
+ */
31
+ const imageToBase64 = async uri => {
32
+ try {
33
+ const response = await fetch(uri);
34
+ const blob = await response.blob();
35
+ return new Promise((resolve, reject) => {
36
+ const reader = new FileReader();
37
+ reader.onloadend = () => {
38
+ try {
39
+ const base64data = reader.result;
40
+ // Remove the data:image/jpeg;base64, prefix
41
+ const base64 = base64data.split(',')[1];
42
+ resolve(base64);
43
+ } catch (error) {
44
+ reject(error);
45
+ }
46
+ };
47
+ reader.onerror = reject;
48
+ reader.readAsDataURL(blob);
49
+ });
50
+ } catch (error) {
51
+ console.error('Error converting image to base64:', error);
52
+ return null;
53
+ }
54
+ };
55
+
56
+ /**
57
+ * Compress image with iterative quality reduction to meet size target
58
+ */
59
+ const compressImageToTarget = async (imageUri, options = {}) => {
60
+ const {
61
+ maxSizeKB = 300,
62
+ maxWidth = 1200,
63
+ maxHeight = 1200,
64
+ quality = 0.8,
65
+ format = 'JPEG'
66
+ } = options;
67
+ try {
68
+ console.log('🖼️ [COMPRESSION] Starting compression for:', imageUri);
69
+
70
+ // Get original file size
71
+ const originalSize = await getFileSizeFromUri(imageUri);
72
+ const originalSizeKB = Math.round(originalSize / 1024);
73
+ console.log('📊 [COMPRESSION] Original size:', originalSizeKB, 'KB');
74
+
75
+ // If already under target, just convert to base64
76
+ if (originalSizeKB <= maxSizeKB) {
77
+ console.log('✅ [COMPRESSION] Image already under target size');
78
+ const base64 = await imageToBase64(imageUri);
79
+ if (base64) {
80
+ return {
81
+ success: true,
82
+ base64,
83
+ sizeKB: originalSizeKB,
84
+ originalSizeKB,
85
+ compressionRatio: 1.0
86
+ };
87
+ }
88
+ }
89
+
90
+ // Start with initial compression parameters
91
+ let currentQuality = quality;
92
+ let currentWidth = maxWidth;
93
+ let currentHeight = maxHeight;
94
+ let attempts = 0;
95
+ const maxAttempts = 8;
96
+ while (attempts < maxAttempts) {
97
+ attempts++;
98
+ console.log(`🔄 [COMPRESSION] Attempt ${attempts}: quality=${currentQuality}, size=${currentWidth}x${currentHeight}`);
99
+ try {
100
+ // Resize and compress the image
101
+ const resizedImage = await _reactNativeImageResizer.default.createResizedImage(imageUri, currentWidth, currentHeight, format, Math.round(currentQuality * 100),
102
+ // Convert to percentage
103
+ 0,
104
+ // rotation
105
+ undefined,
106
+ // outputPath
107
+ false,
108
+ // keepMeta
109
+ {
110
+ mode: 'contain',
111
+ // Maintain aspect ratio
112
+ onlyScaleDown: true // Don't upscale
113
+ });
114
+
115
+ // Check the size of the compressed image
116
+ const compressedSize = await getFileSizeFromUri(resizedImage.uri);
117
+ const compressedSizeKB = Math.round(compressedSize / 1024);
118
+ console.log(`📊 [COMPRESSION] Attempt ${attempts} result: ${compressedSizeKB} KB`);
119
+
120
+ // If we've hit our target, convert to base64 and return
121
+ if (compressedSizeKB <= maxSizeKB) {
122
+ console.log('✅ [COMPRESSION] Target size achieved!');
123
+ const base64 = await imageToBase64(resizedImage.uri);
124
+ if (base64) {
125
+ const compressionRatio = originalSizeKB / compressedSizeKB;
126
+ console.log('🎯 [COMPRESSION] Success:', {
127
+ originalSizeKB,
128
+ finalSizeKB: compressedSizeKB,
129
+ compressionRatio: compressionRatio.toFixed(2) + 'x',
130
+ attempts
131
+ });
132
+ return {
133
+ success: true,
134
+ base64,
135
+ sizeKB: compressedSizeKB,
136
+ originalSizeKB,
137
+ compressionRatio
138
+ };
139
+ }
140
+ }
141
+
142
+ // If still too large, adjust parameters for next attempt
143
+ if (compressedSizeKB > maxSizeKB) {
144
+ // Reduce quality more aggressively if we're way over
145
+ const sizeRatio = compressedSizeKB / maxSizeKB;
146
+ if (sizeRatio > 2.0) {
147
+ // Way too big - reduce quality and dimensions significantly
148
+ currentQuality *= 0.6;
149
+ currentWidth = Math.round(currentWidth * 0.8);
150
+ currentHeight = Math.round(currentHeight * 0.8);
151
+ } else if (sizeRatio > 1.5) {
152
+ // Moderately too big - reduce quality more
153
+ currentQuality *= 0.75;
154
+ currentWidth = Math.round(currentWidth * 0.9);
155
+ currentHeight = Math.round(currentHeight * 0.9);
156
+ } else {
157
+ // Close to target - fine-tune quality
158
+ currentQuality *= 0.85;
159
+ }
160
+
161
+ // Ensure we don't go below minimum thresholds
162
+ currentQuality = Math.max(0.1, currentQuality);
163
+ currentWidth = Math.max(400, currentWidth);
164
+ currentHeight = Math.max(400, currentHeight);
165
+ }
166
+ } catch (resizeError) {
167
+ console.error(`❌ [COMPRESSION] Resize attempt ${attempts} failed:`, resizeError);
168
+
169
+ // Try with more aggressive settings
170
+ currentQuality *= 0.7;
171
+ currentWidth = Math.round(currentWidth * 0.8);
172
+ currentHeight = Math.round(currentHeight * 0.8);
173
+ if (currentQuality < 0.1 || currentWidth < 200 || currentHeight < 200) {
174
+ break;
175
+ }
176
+ }
177
+ }
178
+
179
+ // If we've exhausted all attempts, return the best effort
180
+ console.log('⚠️ [COMPRESSION] Max attempts reached, using best effort');
181
+ try {
182
+ const finalImage = await _reactNativeImageResizer.default.createResizedImage(imageUri, Math.max(400, currentWidth), Math.max(400, currentHeight), format, 30,
183
+ // Very low quality as last resort
184
+ 0, undefined, false, {
185
+ mode: 'contain',
186
+ onlyScaleDown: true
187
+ });
188
+ const finalSize = await getFileSizeFromUri(finalImage.uri);
189
+ const finalSizeKB = Math.round(finalSize / 1024);
190
+ const base64 = await imageToBase64(finalImage.uri);
191
+ if (base64) {
192
+ console.log('📤 [COMPRESSION] Final result (best effort):', finalSizeKB, 'KB');
193
+ return {
194
+ success: true,
195
+ base64,
196
+ sizeKB: finalSizeKB,
197
+ originalSizeKB,
198
+ compressionRatio: originalSizeKB / finalSizeKB
199
+ };
200
+ }
201
+ } catch (finalError) {
202
+ console.error('❌ [COMPRESSION] Final compression attempt failed:', finalError);
203
+ }
204
+ return {
205
+ success: false,
206
+ error: `Failed to compress image to ${maxSizeKB}KB after ${maxAttempts} attempts`,
207
+ originalSizeKB
208
+ };
209
+ } catch (error) {
210
+ console.error('❌ [COMPRESSION] Compression service error:', error);
211
+ return {
212
+ success: false,
213
+ error: error instanceof Error ? error.message : 'Unknown compression error',
214
+ originalSizeKB: 0
215
+ };
216
+ }
217
+ };
218
+
219
+ /**
220
+ * Quick compression for profile pictures (300KB target)
221
+ */
222
+ exports.compressImageToTarget = compressImageToTarget;
223
+ const compressProfilePicture = async imageUri => {
224
+ return compressImageToTarget(imageUri, {
225
+ maxSizeKB: 300,
226
+ maxWidth: 1200,
227
+ maxHeight: 1200,
228
+ quality: 0.8,
229
+ format: 'JPEG'
230
+ });
231
+ };
232
+
233
+ /**
234
+ * Compress image for upload with custom settings
235
+ */
236
+ exports.compressProfilePicture = compressProfilePicture;
237
+ const compressForUpload = async (imageUri, maxSizeKB = 300) => {
238
+ return compressImageToTarget(imageUri, {
239
+ maxSizeKB,
240
+ maxWidth: 1200,
241
+ maxHeight: 1200,
242
+ quality: 0.8,
243
+ format: 'JPEG'
244
+ });
245
+ };
246
+
247
+ /**
248
+ * Legacy function for backward compatibility
249
+ */
250
+ exports.compressForUpload = compressForUpload;
251
+ const convertImageToOptimizedBase64 = async (imageUri, quality = 0.8) => {
252
+ const result = await compressImageToTarget(imageUri, {
253
+ maxSizeKB: 300,
254
+ quality,
255
+ format: 'JPEG'
256
+ });
257
+ return result.success ? result.base64 || null : null;
258
+ };
259
+ exports.convertImageToOptimizedBase64 = convertImageToOptimizedBase64;
260
+ //# sourceMappingURL=imageCompressionService.js.map
@@ -1,8 +1,126 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("./instagramDataService"),
5
- require("react-native")
6
- ];
7
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
8
- Object[_0x1663(0x0)](exports,_0x1663(0x1),{'value':!![]}),exports[_0x1663(0x2)]=void 0x0;var _instagramDataService=__ONAIROS_REQ_FUNC__(0x0),_reactNative=__ONAIROS_REQ_FUNC__(0x1);const useInstagramDataExtractor=()=>{const _0x575b46={'UBHCa':function(_0x101f66,_0x512ea6){return _0x101f66===_0x512ea6;},'ACyll':_0x1663(0x3),'dPqTC':function(_0x45a986,_0x11dbc7){return _0x45a986!==_0x11dbc7;},'CIPVv':_0x1663(0x4),'AcpkT':'UcczS','QogET':_0x1663(0x5),'zMnHM':_0x1663(0x6),'rovYy':_0x1663(0x7),'tEyir':function(_0x4e611e,_0x1dfc2d){return _0x4e611e===_0x1dfc2d;},'efFRh':'joaxG','CpRWw':_0x1663(0x8),'IsWce':_0x1663(0x9),'nAKgw':_0x1663(0xa),'gCzbi':_0x1663(0xb),'QTsPj':_0x1663(0xc),'ndcxE':'📊\x20[INSTAGRAM_EXTRACTOR]\x20Likes:','czpik':_0x1663(0xd),'naOzq':_0x1663(0xe),'OkaBR':'❌\x20[INSTAGRAM_EXTRACTOR]\x20Username\x20is\x20required','FUgey':_0x1663(0xf),'AjyCp':_0x1663(0x10),'knrVi':_0x1663(0x11),'WKJtd':function(_0xaa58bd,_0x56817d){return _0xaa58bd+_0x56817d;},'PQBfw':function(_0x1d326f,_0x5779be){return _0x1d326f+_0x5779be;},'ndpSG':function(_0x24a283,_0x140d09){return _0x24a283===_0x140d09;},'gPruP':function(_0x4b3874,_0x415c20){return _0x4b3874===_0x415c20;},'lDOsI':function(_0xcd909b,_0x1c5c97){return _0xcd909b===_0x1c5c97;},'RIqhN':_0x1663(0x12),'fsLVY':function(_0x40e841,_0x71c5c9){return _0x40e841-_0x71c5c9;},'EKPqR':function(_0x13ad59,_0x2acf5c){return _0x13ad59+_0x2acf5c;},'XOMnN':function(_0x2ed25d,_0x2dcc12){return _0x2ed25d-_0x2dcc12;},'MoDAa':function(_0x119c23,_0x1ed27a){return _0x119c23+_0x1ed27a;},'GjcrP':function(_0x17acab,_0x22d625){return _0x17acab-_0x22d625;},'pQKNg':function(_0x1ab159,_0x86da2f){return _0x1ab159===_0x86da2f;},'gCtay':function(_0x1a8f1b,_0x2efd15){return _0x1a8f1b===_0x2efd15;},'ifVwK':function(_0x551255,_0x1e7c42){return _0x551255>_0x1e7c42;},'swAth':function(_0x587c30,_0x27123e){return _0x587c30!==_0x27123e;},'IbeIQ':_0x1663(0x13),'UCpXr':_0x1663(0x14),'TiWNA':_0x1663(0x15),'NwpKZ':_0x1663(0x16),'PcTDs':_0x1663(0x17),'QMwIi':'❌\x20[INSTAGRAM_EXTRACTOR]\x20Unexpected\x20error\x20during\x20export:','vUOGg':'Export\x20Error','XRMvA':_0x1663(0x18)},_0x19aa06=async(_0x59a0d9,_0x532d3f)=>{const _0x5ec79a={'njWMp':function(_0x38a17d,_0x3d220f){return _0x575b46[_0x1663(0x19)](_0x38a17d,_0x3d220f);},'jwjrk':_0x575b46[_0x1663(0x1a)],'XzRLa':function(_0x3bbae2,_0xea64ef){return _0x575b46[_0x1663(0x1b)](_0x3bbae2,_0xea64ef);},'UEFPd':_0x575b46['zMnHM'],'scGMN':_0x575b46[_0x1663(0x1c)],'IMEeJ':_0x575b46[_0x1663(0x1d)],'qiUbu':_0x1663(0x1e),'tNxLM':_0x575b46[_0x1663(0x1f)],'YJauC':_0x575b46[_0x1663(0x20)]};if(_0x575b46[_0x1663(0x21)]!==_0x575b46[_0x1663(0x21)]){const _0x582ef7=_0x4be04d['id']&&_0x575b46[_0x1663(0x19)](_0x793661[_0x1663(0x22)],_0x575b46['ACyll']);return!_0x582ef7&&_0x57d499['warn']('⚠️\x20[INSTAGRAM_EXTRACTOR]\x20Invalid\x20save:',_0x1ec088),_0x582ef7;}else{var _0x1a41cc,_0x341a1b,_0x2f6a98,_0x3a7f55,_0x1c1b7e,_0x5ceece;console[_0x1663(0x23)](_0x575b46[_0x1663(0x24)]),console[_0x1663(0x23)](_0x575b46[_0x1663(0x25)],_0x59a0d9),console[_0x1663(0x23)](_0x575b46[_0x1663(0x26)],_0x532d3f['total_likes']),console[_0x1663(0x23)](_0x575b46[_0x1663(0x27)],_0x532d3f[_0x1663(0x28)]),console['log'](_0x575b46['naOzq'],_0x532d3f['total_collections']);if(!_0x59a0d9)return console['error'](_0x575b46[_0x1663(0x29)]),_reactNative[_0x1663(0x2a)][_0x1663(0x2b)](_0x575b46[_0x1663(0x2c)],_0x575b46[_0x1663(0x2d)],[{'text':'OK','style':_0x575b46[_0x1663(0x2e)]}]),![];const _0x29ab8f=_0x575b46['WKJtd'](_0x575b46[_0x1663(0x2f)]((_0x575b46['UBHCa'](_0x1a41cc=_0x532d3f[_0x1663(0x30)],null)||_0x1a41cc===void 0x0?void 0x0:_0x1a41cc['length'])||0x0,((_0x341a1b=_0x532d3f[_0x1663(0x31)])===null||_0x575b46['ndpSG'](_0x341a1b,void 0x0)?void 0x0:_0x341a1b[_0x1663(0x32)])||0x0),(_0x575b46[_0x1663(0x33)](_0x2f6a98=_0x532d3f[_0x1663(0x34)],null)||_0x575b46['ndpSG'](_0x2f6a98,void 0x0)?void 0x0:_0x2f6a98[_0x1663(0x32)])||0x0);if(_0x575b46[_0x1663(0x35)](_0x29ab8f,0x0))return console[_0x1663(0x23)](_0x575b46[_0x1663(0x36)]),!![];const _0x3fa28c=(_0x532d3f['likes']||[])[_0x1663(0x37)](_0x23f918=>{const _0x10ab65=_0x23f918['id']&&_0x5ec79a[_0x1663(0x38)](_0x23f918[_0x1663(0x22)],_0x5ec79a[_0x1663(0x39)]);return!_0x10ab65&&console['warn']('⚠️\x20[INSTAGRAM_EXTRACTOR]\x20Invalid\x20like:',_0x23f918),_0x10ab65;}),_0x294895=(_0x532d3f[_0x1663(0x31)]||[])[_0x1663(0x37)](_0x5dabc4=>{const _0x243800={'PFhVS':function(_0x2841e5,_0x2d0b93){return _0x5ec79a[_0x1663(0x3a)](_0x2841e5,_0x2d0b93);},'TufpD':_0x5ec79a['UEFPd']},_0x23127a=_0x5dabc4['id']&&_0x5ec79a[_0x1663(0x38)](_0x5dabc4[_0x1663(0x22)],_0x5ec79a[_0x1663(0x3b)]);if(!_0x23127a){if(_0x5ec79a['IMEeJ']===_0x5ec79a[_0x1663(0x3c)])console[_0x1663(0x3d)](_0x5ec79a[_0x1663(0x3e)],_0x5dabc4);else{const _0x8541b9=_0x2c1fd0['id']&&_0x243800[_0x1663(0x3f)](_0x8835f5[_0x1663(0x22)],_0x1663(0x7));return!_0x8541b9&&_0x55adc3[_0x1663(0x3d)](_0x243800['TufpD'],_0x3d6880),_0x8541b9;}}return _0x23127a;}),_0x5e0a1b=(_0x532d3f[_0x1663(0x34)]||[])[_0x1663(0x37)](_0x6e6207=>{const _0x380517=_0x6e6207['id']&&_0x6e6207[_0x1663(0x40)];return!_0x380517&&(_0x575b46[_0x1663(0x41)](_0x575b46[_0x1663(0x42)],_0x575b46['AcpkT'])?console[_0x1663(0x3d)](_0x575b46['QogET'],_0x6e6207):_0x5ee887[_0x1663(0x3d)](_0x1663(0x43)+_0x5e7e49+_0x1663(0x44))),_0x380517;}),_0x21f7de=_0x575b46[_0x1663(0x45)](_0x575b46[_0x1663(0x46)](_0x575b46['XOMnN'](_0x575b46[_0x1663(0x47)](_0x575b46[_0x1663(0x48)]((_0x575b46[_0x1663(0x49)](_0x3a7f55=_0x532d3f[_0x1663(0x30)],null)||_0x575b46[_0x1663(0x1b)](_0x3a7f55,void 0x0)?void 0x0:_0x3a7f55[_0x1663(0x32)])||0x0,_0x3fa28c[_0x1663(0x32)]),(_0x575b46['gCtay'](_0x1c1b7e=_0x532d3f[_0x1663(0x31)],null)||_0x1c1b7e===void 0x0?void 0x0:_0x1c1b7e[_0x1663(0x32)])||0x0),_0x294895[_0x1663(0x32)]),(_0x575b46[_0x1663(0x33)](_0x5ceece=_0x532d3f[_0x1663(0x34)],null)||_0x575b46[_0x1663(0x35)](_0x5ceece,void 0x0)?void 0x0:_0x5ceece[_0x1663(0x32)])||0x0),_0x5e0a1b[_0x1663(0x32)]);_0x575b46[_0x1663(0x4a)](_0x21f7de,0x0)&&console[_0x1663(0x3d)](_0x1663(0x43)+_0x21f7de+_0x1663(0x44));try{if(_0x575b46[_0x1663(0x4b)](_0x575b46['IbeIQ'],_0x1663(0x13)))_0x89e20c[_0x1663(0x3d)](_0x575b46[_0x1663(0x4c)],_0x5e2294);else{console[_0x1663(0x23)](_0x1663(0x4d));const _0x2ff75d=await(0x0,_instagramDataService[_0x1663(0x4e)])(_0x59a0d9,{'likes':_0x3fa28c,'saves':_0x294895,'collections':_0x5e0a1b,'userId':_0x532d3f[_0x1663(0x4f)]});return _0x2ff75d[_0x1663(0x50)]?(console[_0x1663(0x23)](_0x575b46[_0x1663(0x1f)]),console[_0x1663(0x23)](_0x575b46[_0x1663(0x20)],_0x2ff75d[_0x1663(0x51)]),!![]):_0x575b46[_0x1663(0x41)](_0x575b46[_0x1663(0x52)],_0x575b46[_0x1663(0x53)])?(console[_0x1663(0x54)](_0x575b46[_0x1663(0x55)],_0x2ff75d['error']),_reactNative[_0x1663(0x2a)][_0x1663(0x2b)](_0x1663(0x56),_0x2ff75d[_0x1663(0x54)]||_0x575b46[_0x1663(0x57)],[{'text':'OK','style':_0x575b46[_0x1663(0x2e)]}]),![]):(_0x275293[_0x1663(0x23)](_0x5ec79a[_0x1663(0x58)]),_0x464641[_0x1663(0x23)](_0x5ec79a[_0x1663(0x59)],_0x3d059f[_0x1663(0x51)]),!![]);}}catch(_0x4ebfb4){return console['error'](_0x575b46[_0x1663(0x5a)],_0x4ebfb4),_reactNative[_0x1663(0x2a)][_0x1663(0x2b)](_0x575b46[_0x1663(0x5b)],_0x575b46[_0x1663(0x5c)],[{'text':'OK','style':_0x575b46['knrVi']}]),![];}}};return{'initiateDataExport':_0x19aa06};};function _0x1663(_0x39bf2a,_0x166388){_0x39bf2a=_0x39bf2a-0x0;const _0x4c38f=_0x39bf();let _0x2f1d95=_0x4c38f[_0x39bf2a];return _0x2f1d95;}function _0x39bf(){const _0x361b46=['defineProperty','__esModule','useInstagramDataExtractor','save','ReBvh','⚠️\x20[INSTAGRAM_EXTRACTOR]\x20Invalid\x20collection:','⚠️\x20[INSTAGRAM_EXTRACTOR]\x20Invalid\x20like:','like','✅\x20[INSTAGRAM_EXTRACTOR]\x20Export\x20completed\x20successfully','📊\x20[INSTAGRAM_EXTRACTOR]\x20Backend\x20response:','DwJCt','🚀\x20[INSTAGRAM_EXTRACTOR]\x20Initiating\x20data\x20export','👤\x20[INSTAGRAM_EXTRACTOR]\x20Username:','📊\x20[INSTAGRAM_EXTRACTOR]\x20Saves:','📊\x20[INSTAGRAM_EXTRACTOR]\x20Collections:','Error','Username\x20is\x20required\x20to\x20export\x20Instagram\x20data.','default','ℹ️\x20[INSTAGRAM_EXTRACTOR]\x20No\x20data\x20to\x20export\x20-\x20treating\x20as\x20success\x20(connected)','hmSko','BdaAO','nyYwI','❌\x20[INSTAGRAM_EXTRACTOR]\x20Backend\x20storage\x20failed:','An\x20unknown\x20error\x20occurred\x20during\x20data\x20storage.','Failed\x20to\x20connect\x20to\x20the\x20data\x20storage\x20service.\x20Please\x20check\x20your\x20network\x20connection.','UBHCa','rovYy','tEyir','ACyll','efFRh','⚠️\x20[INSTAGRAM_EXTRACTOR]\x20Invalid\x20save:','CpRWw','IsWce','nAKgw','type','log','gCzbi','QTsPj','ndcxE','czpik','total_saves','OkaBR','Alert','alert','FUgey','AjyCp','knrVi','PQBfw','likes','saves','length','gPruP','collections','lDOsI','RIqhN','filter','njWMp','jwjrk','XzRLa','scGMN','IMEeJ','warn','qiUbu','PFhVS','name','dPqTC','CIPVv','⚠️\x20[INSTAGRAM_EXTRACTOR]\x20Filtered\x20out\x20','\x20invalid\x20items','fsLVY','EKPqR','MoDAa','GjcrP','pQKNg','ifVwK','swAth','zMnHM','📡\x20[INSTAGRAM_EXTRACTOR]\x20Sending\x20to\x20backend...','storeInstagramData','userId','success','data','UCpXr','TiWNA','error','NwpKZ','Export\x20Failed','PcTDs','tNxLM','YJauC','QMwIi','vUOGg','XRMvA'];_0x39bf=function(){return _0x361b46;};return _0x39bf();}exports[_0x1663(0x2)]=useInstagramDataExtractor;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useInstagramDataExtractor = void 0;
7
+ var _instagramDataService = require("./instagramDataService");
8
+ var _reactNative = require("react-native");
9
+ /**
10
+ * Instagram Data Extractor
11
+ *
12
+ * Orchestrates the Instagram data export flow:
13
+ * 1. Receives extracted activity data from WebView
14
+ * 2. Validates and formats data
15
+ * 3. Sends to backend via instagramDataService
16
+ *
17
+ * This acts as the bridge between OAuthWebView and the backend API.
18
+ *
19
+ * @reference ChatGPT implementation: src/services/chatGPTConversationExtractor.ts
20
+ */
21
+
22
+ /**
23
+ * Combined Instagram export data from WebView
24
+ */
25
+
26
+ /**
27
+ * Hook for Instagram data extraction operations
28
+ */
29
+ const useInstagramDataExtractor = () => {
30
+ /**
31
+ * Initiate data export to backend
32
+ *
33
+ * @param username - User identifier
34
+ * @param data - Extracted Instagram data (likes, saves, collections)
35
+ * @returns true if successful, false otherwise
36
+ */
37
+ const initiateDataExport = async (username, data) => {
38
+ var _data$likes, _data$saves, _data$collections, _data$likes2, _data$saves2, _data$collections2;
39
+ console.log('🚀 [INSTAGRAM_EXTRACTOR] Initiating data export');
40
+ console.log('👤 [INSTAGRAM_EXTRACTOR] Username:', username);
41
+ console.log('📊 [INSTAGRAM_EXTRACTOR] Likes:', data.total_likes);
42
+ console.log('📊 [INSTAGRAM_EXTRACTOR] Saves:', data.total_saves);
43
+ console.log('📊 [INSTAGRAM_EXTRACTOR] Collections:', data.total_collections);
44
+
45
+ // Validation
46
+ if (!username) {
47
+ console.error('❌ [INSTAGRAM_EXTRACTOR] Username is required');
48
+ _reactNative.Alert.alert('Error', 'Username is required to export Instagram data.', [{
49
+ text: 'OK',
50
+ style: 'default'
51
+ }]);
52
+ return false;
53
+ }
54
+
55
+ // Handle empty data as success - user might be new or have private activity
56
+ const totalItems = (((_data$likes = data.likes) === null || _data$likes === void 0 ? void 0 : _data$likes.length) || 0) + (((_data$saves = data.saves) === null || _data$saves === void 0 ? void 0 : _data$saves.length) || 0) + (((_data$collections = data.collections) === null || _data$collections === void 0 ? void 0 : _data$collections.length) || 0);
57
+ if (totalItems === 0) {
58
+ console.log('ℹ️ [INSTAGRAM_EXTRACTOR] No data to export - treating as success (connected)');
59
+ return true;
60
+ }
61
+
62
+ // Validate likes structure
63
+ const validLikes = (data.likes || []).filter(like => {
64
+ const isValid = like.id && like.type === 'like';
65
+ if (!isValid) {
66
+ console.warn('⚠️ [INSTAGRAM_EXTRACTOR] Invalid like:', like);
67
+ }
68
+ return isValid;
69
+ });
70
+
71
+ // Validate saves structure
72
+ const validSaves = (data.saves || []).filter(save => {
73
+ const isValid = save.id && save.type === 'save';
74
+ if (!isValid) {
75
+ console.warn('⚠️ [INSTAGRAM_EXTRACTOR] Invalid save:', save);
76
+ }
77
+ return isValid;
78
+ });
79
+
80
+ // Validate collections structure
81
+ const validCollections = (data.collections || []).filter(col => {
82
+ const isValid = col.id && col.name;
83
+ if (!isValid) {
84
+ console.warn('⚠️ [INSTAGRAM_EXTRACTOR] Invalid collection:', col);
85
+ }
86
+ return isValid;
87
+ });
88
+ const filteredOut = (((_data$likes2 = data.likes) === null || _data$likes2 === void 0 ? void 0 : _data$likes2.length) || 0) - validLikes.length + (((_data$saves2 = data.saves) === null || _data$saves2 === void 0 ? void 0 : _data$saves2.length) || 0) - validSaves.length + (((_data$collections2 = data.collections) === null || _data$collections2 === void 0 ? void 0 : _data$collections2.length) || 0) - validCollections.length;
89
+ if (filteredOut > 0) {
90
+ console.warn(`⚠️ [INSTAGRAM_EXTRACTOR] Filtered out ${filteredOut} invalid items`);
91
+ }
92
+ try {
93
+ console.log('📡 [INSTAGRAM_EXTRACTOR] Sending to backend...');
94
+ const result = await (0, _instagramDataService.storeInstagramData)(username, {
95
+ likes: validLikes,
96
+ saves: validSaves,
97
+ collections: validCollections,
98
+ userId: data.userId
99
+ });
100
+ if (result.success) {
101
+ console.log('✅ [INSTAGRAM_EXTRACTOR] Export completed successfully');
102
+ console.log('📊 [INSTAGRAM_EXTRACTOR] Backend response:', result.data);
103
+ return true;
104
+ } else {
105
+ console.error('❌ [INSTAGRAM_EXTRACTOR] Backend storage failed:', result.error);
106
+ _reactNative.Alert.alert('Export Failed', result.error || 'An unknown error occurred during data storage.', [{
107
+ text: 'OK',
108
+ style: 'default'
109
+ }]);
110
+ return false;
111
+ }
112
+ } catch (error) {
113
+ console.error('❌ [INSTAGRAM_EXTRACTOR] Unexpected error during export:', error);
114
+ _reactNative.Alert.alert('Export Error', 'Failed to connect to the data storage service. Please check your network connection.', [{
115
+ text: 'OK',
116
+ style: 'default'
117
+ }]);
118
+ return false;
119
+ }
120
+ };
121
+ return {
122
+ initiateDataExport
123
+ };
124
+ };
125
+ exports.useInstagramDataExtractor = useInstagramDataExtractor;
126
+ //# sourceMappingURL=instagramDataExtractor.js.map
@@ -1,9 +1,163 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("../config/api"),
5
- require("@react-native-async-storage/async-storage"),
6
- require("react-native")
7
- ];
8
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
9
- Object[_0x1c29(0x0)](exports,_0x1c29(0x1),{'value':!![]}),exports[_0x1c29(0x2)]=void 0x0;var _api=__ONAIROS_REQ_FUNC__(0x0),_asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x1)),_reactNative=__ONAIROS_REQ_FUNC__(0x2);function _interopRequireDefault(_0x359913){return _0x359913&&_0x359913[_0x1c29(0x1)]?_0x359913:{'default':_0x359913};}function _0x1c29(_0x5e637,_0x1c291c){_0x5e637=_0x5e637-0x0;const _0x301716=_0x5e63();let _0xd8ae02=_0x301716[_0x5e637];return _0xd8ae02;}const storeInstagramData=async(_0x2e6513,_0x4cf4ca)=>{const _0x1335e4={'cznhY':_0x1c29(0x3),'McMIT':_0x1c29(0x4),'lTGdP':_0x1c29(0x5),'ZCiod':_0x1c29(0x6),'yUUsg':_0x1c29(0x7),'PkVWU':function(_0x2f96b9,_0x59a551){return _0x2f96b9!==_0x59a551;},'WgTMW':_0x1c29(0x8),'DgctH':_0x1c29(0x9),'MLvYC':_0x1c29(0xa),'aWFuR':_0x1c29(0xb),'MVhaY':'auth_token','Bejcb':_0x1c29(0xc),'bCEBo':_0x1c29(0xd),'gbSOr':function(_0x246d63,_0x3f2398){return _0x246d63===_0x3f2398;},'cuqAG':_0x1c29(0xe),'JTHGt':_0x1c29(0xf),'XxTZR':function(_0x1404f9,_0x4ca481){return _0x1404f9===_0x4ca481;},'nNweB':_0x1c29(0x10),'ncQae':_0x1c29(0x11),'IRAHR':_0x1c29(0x12),'qgTAD':function(_0x1149a5,_0x2061fd){return _0x1149a5+_0x2061fd;},'FRfbQ':_0x1c29(0x13),'cFwBk':_0x1c29(0x14),'tSjZv':_0x1c29(0x15),'RXFRu':'ITPDH','pwEFb':_0x1c29(0x16),'pgjmW':function(_0x520907,_0x24786b){return _0x520907===_0x24786b;},'ZrSQY':'dqwxe','IGPZk':'❌\x20[INSTAGRAM_SERVICE]\x20Network\x20error:'};console[_0x1c29(0x17)](_0x1335e4[_0x1c29(0x18)],_0x2e6513),console['log'](_0x1c29(0x19),_0x4cf4ca[_0x1c29(0x1a)][_0x1c29(0x1b)]),console[_0x1c29(0x17)](_0x1335e4['yUUsg'],_0x4cf4ca[_0x1c29(0x1c)][_0x1c29(0x1b)]),console['log']('📊\x20[INSTAGRAM_SERVICE]\x20Collections:',_0x4cf4ca['collections'][_0x1c29(0x1b)]);if(!_0x2e6513)return _0x1335e4[_0x1c29(0x1d)](_0x1335e4[_0x1c29(0x1e)],_0x1335e4[_0x1c29(0x1e)])?_0x1fed81&&_0x1548f1[_0x1c29(0x1)]?_0x8792f6:{'default':_0x3edbaf}:(console[_0x1c29(0x1f)](_0x1c29(0x20)),{'success':![],'error':_0x1335e4[_0x1c29(0x21)]});try{const _0xa4d975=await _asyncStorage[_0x1c29(0x22)][_0x1c29(0x23)](_0x1335e4[_0x1c29(0x24)])||await _asyncStorage[_0x1c29(0x22)][_0x1c29(0x23)](_0x1335e4[_0x1c29(0x25)])||await _asyncStorage[_0x1c29(0x22)][_0x1c29(0x23)](_0x1335e4[_0x1c29(0x26)]);if(!_0xa4d975)return console['error'](_0x1335e4[_0x1c29(0x27)]),{'success':![],'error':_0x1335e4[_0x1c29(0x28)]};console['log'](_0x1335e4[_0x1c29(0x29)]);const _0x5cd018={'platform':_reactNative[_0x1c29(0x2a)]['OS'],'appVersion':_0x1335e4['bCEBo'],'osVersion':_0x1335e4[_0x1c29(0x2b)](_reactNative[_0x1c29(0x2a)]['OS'],_0x1335e4[_0x1c29(0x2c)])?_0x1335e4[_0x1c29(0x2d)]:_reactNative[_0x1c29(0x2a)]['OS'],'deviceModel':_0x1335e4[_0x1c29(0x2e)](_reactNative[_0x1c29(0x2a)]['OS'],_0x1335e4['cuqAG'])?_0x1335e4[_0x1c29(0x2f)]:_0x1335e4[_0x1c29(0x30)],'isOfflineSync':![],'extractedAt':new Date()['toISOString']()},_0x2ba3f1={'platform':_0x1c29(0x31),'dataType':_0x1335e4[_0x1c29(0x32)],'data':{'likes':_0x4cf4ca['likes'][_0x1c29(0x33)](_0x1f770f=>({'postId':_0x1f770f['id'],'type':'like','mediaType':_0x1f770f[_0x1c29(0x34)],'caption':_0x1f770f[_0x1c29(0x35)],'owner':_0x1f770f[_0x1c29(0x36)],'timestamp':_0x1f770f[_0x1c29(0x37)],'url':_0x1f770f[_0x1c29(0x38)]})),'saves':_0x4cf4ca[_0x1c29(0x1c)][_0x1c29(0x33)](_0x477e50=>({'postId':_0x477e50['id'],'type':_0x1c29(0x39),'mediaType':_0x477e50[_0x1c29(0x34)],'caption':_0x477e50[_0x1c29(0x35)],'owner':_0x477e50[_0x1c29(0x36)],'timestamp':_0x477e50['timestamp'],'url':_0x477e50['url']})),'collections':_0x4cf4ca[_0x1c29(0x3a)][_0x1c29(0x33)](_0x51c82c=>({'collectionId':_0x51c82c['id'],'name':_0x51c82c[_0x1c29(0x3b)],'mediaCount':_0x51c82c[_0x1c29(0x3c)],'coverUrl':_0x51c82c['coverUrl']})),'instagramUserId':_0x4cf4ca[_0x1c29(0x3d)]},'summary':{'likeCount':_0x4cf4ca[_0x1c29(0x1a)][_0x1c29(0x1b)],'saveCount':_0x4cf4ca[_0x1c29(0x1c)][_0x1c29(0x1b)],'collectionCount':_0x4cf4ca[_0x1c29(0x3a)][_0x1c29(0x1b)],'totalEngagements':_0x1335e4[_0x1c29(0x3e)](_0x4cf4ca[_0x1c29(0x1a)][_0x1c29(0x1b)],_0x4cf4ca[_0x1c29(0x1c)][_0x1c29(0x1b)])},'mobileMetadata':_0x5cd018};console[_0x1c29(0x17)](_0x1335e4['FRfbQ']),console[_0x1c29(0x17)](_0x1335e4[_0x1c29(0x3f)],_api[_0x1c29(0x40)][_0x1c29(0x41)]+'/platform-data/store');const _0x54a560=await fetch(_api[_0x1c29(0x40)][_0x1c29(0x41)]+_0x1c29(0x42),{'method':'POST','headers':{'Content-Type':'application/json','Authorization':'Bearer\x20'+_0xa4d975,'User-Agent':_0x1c29(0x43)+_reactNative[_0x1c29(0x2a)]['OS']+')'},'body':JSON['stringify'](_0x2ba3f1)}),_0x2662c6=await _0x54a560[_0x1c29(0x44)]();if(_0x54a560['ok']){console[_0x1c29(0x17)](_0x1335e4['tSjZv']);if(_0x2662c6['message']){if(_0x1335e4[_0x1c29(0x1d)](_0x1335e4[_0x1c29(0x45)],_0x1335e4[_0x1c29(0x45)]))return _0x4dd3c8['error'](_0x1335e4[_0x1c29(0x27)]),{'success':![],'error':_0x1335e4[_0x1c29(0x28)]};else console[_0x1c29(0x17)]('📝\x20[INSTAGRAM_SERVICE]\x20Backend\x20response:\x20'+_0x2662c6[_0x1c29(0x46)]);}return{'success':!![],'message':_0x2662c6[_0x1c29(0x46)]||_0x1335e4[_0x1c29(0x47)],'data':_0x2662c6[_0x1c29(0x48)]};}else return console['warn'](_0x1c29(0x49)+_0x54a560[_0x1c29(0x4a)]),console['warn'](_0x1c29(0x4b)+(_0x2662c6[_0x1c29(0x1f)]||_0x1335e4[_0x1c29(0x4c)])),{'success':![],'error':_0x2662c6[_0x1c29(0x1f)]||_0x1c29(0x4d)+_0x54a560[_0x1c29(0x4a)]};}catch(_0x34c760){return _0x1335e4['pgjmW'](_0x1335e4[_0x1c29(0x4e)],_0x1335e4[_0x1c29(0x4e)])?(console[_0x1c29(0x1f)](_0x1335e4[_0x1c29(0x4f)],_0x34c760),{'success':![],'error':_0x34c760[_0x1c29(0x46)]||_0x1c29(0x50)}):(_0x162a8e[_0x1c29(0x17)]('✅\x20[INSTAGRAM_SERVICE]\x20Successfully\x20stored\x20Instagram\x20data'),_0x21131f[_0x1c29(0x46)]&&_0x19907a[_0x1c29(0x17)](_0x1c29(0x51)+_0x380f5e[_0x1c29(0x46)]),{'success':!![],'message':_0x68bd27['message']||_0x1335e4['lTGdP'],'data':_0x3b524e[_0x1c29(0x48)]});}};exports[_0x1c29(0x2)]=storeInstagramData;function _0x5e63(){const _0x1a271b=['defineProperty','__esModule','storeInstagramData','❌\x20[INSTAGRAM_SERVICE]\x20No\x20auth\x20token\x20found','Authentication\x20token\x20not\x20found.\x20Please\x20log\x20in\x20again.','Instagram\x20data\x20stored\x20successfully','🚀\x20[INSTAGRAM_SERVICE]\x20Storing\x20Instagram\x20data\x20for:','📊\x20[INSTAGRAM_SERVICE]\x20Saves:','noFbs','Invalid\x20input:\x20userId\x20missing.','onairos_jwt_token','enoch_token','🔑\x20[INSTAGRAM_SERVICE]\x20Auth\x20token\x20found','1.0.0','ios','17.0','iPhone','Android','social','📡\x20[INSTAGRAM_SERVICE]\x20Sending\x20to\x20backend...','📍\x20[INSTAGRAM_SERVICE]\x20URL:','✅\x20[INSTAGRAM_SERVICE]\x20Successfully\x20stored\x20Instagram\x20data','Unknown\x20error','log','ZCiod','📊\x20[INSTAGRAM_SERVICE]\x20Likes:','likes','length','saves','PkVWU','WgTMW','error','❌\x20[INSTAGRAM_SERVICE]\x20Invalid\x20input:\x20userId\x20missing','DgctH','default','getItem','MLvYC','aWFuR','MVhaY','cznhY','McMIT','Bejcb','Platform','gbSOr','cuqAG','JTHGt','XxTZR','nNweB','ncQae','mobile-instagram','IRAHR','map','mediaType','caption','owner','timestamp','url','save','collections','name','mediaCount','userId','qgTAD','cFwBk','API_CONFIG','BASE_URL','/platform-data/store','OnairosSDK/1.0.0\x20(','json','RXFRu','message','lTGdP','data','⚠️\x20[INSTAGRAM_SERVICE]\x20Backend\x20returned\x20status:\x20','status','⚠️\x20[INSTAGRAM_SERVICE]\x20Error:\x20','pwEFb','HTTP\x20','ZrSQY','IGPZk','Network\x20error.\x20Please\x20check\x20your\x20connection.','📝\x20[INSTAGRAM_SERVICE]\x20Backend\x20response:\x20'];_0x5e63=function(){return _0x1a271b;};return _0x5e63();}
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.storeInstagramData = void 0;
7
+ var _api = require("../config/api");
8
+ var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
9
+ var _reactNative = require("react-native");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ /**
12
+ * Instagram Data Service
13
+ *
14
+ * API layer for storing Instagram activity data on backend.
15
+ * Sends extracted likes, saves, and collections to /platform-data/store endpoint.
16
+ *
17
+ * MATCHES ChatGPT implementation pattern
18
+ * - Uses format: { platform, data, metadata }
19
+ * - Platform: "mobile-instagram"
20
+ */
21
+
22
+ /**
23
+ * Structure of a liked post
24
+ */
25
+
26
+ /**
27
+ * Structure of a saved post
28
+ */
29
+
30
+ /**
31
+ * Structure of a collection
32
+ */
33
+
34
+ /**
35
+ * Combined Instagram data to store
36
+ */
37
+
38
+ /**
39
+ * Response from backend endpoint
40
+ */
41
+
42
+ /**
43
+ * Store Instagram data on backend
44
+ *
45
+ * @param userId - Username or identifier
46
+ * @param data - Instagram likes, saves, and collections data
47
+ * @returns Response indicating success/failure with metadata
48
+ */
49
+ const storeInstagramData = async (userId, data) => {
50
+ console.log('🚀 [INSTAGRAM_SERVICE] Storing Instagram data for:', userId);
51
+ console.log('📊 [INSTAGRAM_SERVICE] Likes:', data.likes.length);
52
+ console.log('📊 [INSTAGRAM_SERVICE] Saves:', data.saves.length);
53
+ console.log('📊 [INSTAGRAM_SERVICE] Collections:', data.collections.length);
54
+
55
+ // Input validation
56
+ if (!userId) {
57
+ console.error('❌ [INSTAGRAM_SERVICE] Invalid input: userId missing');
58
+ return {
59
+ success: false,
60
+ error: 'Invalid input: userId missing.'
61
+ };
62
+ }
63
+ try {
64
+ // Get auth token - check all possible storage keys
65
+ const authToken = (await _asyncStorage.default.getItem('onairos_jwt_token')) || (await _asyncStorage.default.getItem('enoch_token')) || (await _asyncStorage.default.getItem('auth_token'));
66
+ if (!authToken) {
67
+ console.error('❌ [INSTAGRAM_SERVICE] No auth token found');
68
+ return {
69
+ success: false,
70
+ error: 'Authentication token not found. Please log in again.'
71
+ };
72
+ }
73
+ console.log('🔑 [INSTAGRAM_SERVICE] Auth token found');
74
+
75
+ // Mobile metadata
76
+ const mobileMetadata = {
77
+ platform: _reactNative.Platform.OS,
78
+ appVersion: '1.0.0',
79
+ osVersion: _reactNative.Platform.OS === 'ios' ? '17.0' : _reactNative.Platform.OS,
80
+ deviceModel: _reactNative.Platform.OS === 'ios' ? 'iPhone' : 'Android',
81
+ isOfflineSync: false,
82
+ extractedAt: new Date().toISOString()
83
+ };
84
+
85
+ // Build request body
86
+ const requestBody = {
87
+ platform: 'mobile-instagram',
88
+ dataType: 'social',
89
+ data: {
90
+ likes: data.likes.map(like => ({
91
+ postId: like.id,
92
+ type: 'like',
93
+ mediaType: like.mediaType,
94
+ caption: like.caption,
95
+ owner: like.owner,
96
+ timestamp: like.timestamp,
97
+ url: like.url
98
+ })),
99
+ saves: data.saves.map(save => ({
100
+ postId: save.id,
101
+ type: 'save',
102
+ mediaType: save.mediaType,
103
+ caption: save.caption,
104
+ owner: save.owner,
105
+ timestamp: save.timestamp,
106
+ url: save.url
107
+ })),
108
+ collections: data.collections.map(col => ({
109
+ collectionId: col.id,
110
+ name: col.name,
111
+ mediaCount: col.mediaCount,
112
+ coverUrl: col.coverUrl
113
+ })),
114
+ instagramUserId: data.userId
115
+ },
116
+ summary: {
117
+ likeCount: data.likes.length,
118
+ saveCount: data.saves.length,
119
+ collectionCount: data.collections.length,
120
+ totalEngagements: data.likes.length + data.saves.length
121
+ },
122
+ mobileMetadata: mobileMetadata
123
+ };
124
+ console.log('📡 [INSTAGRAM_SERVICE] Sending to backend...');
125
+ console.log('📍 [INSTAGRAM_SERVICE] URL:', `${_api.API_CONFIG.BASE_URL}/platform-data/store`);
126
+ const response = await fetch(`${_api.API_CONFIG.BASE_URL}/platform-data/store`, {
127
+ method: 'POST',
128
+ headers: {
129
+ 'Content-Type': 'application/json',
130
+ 'Authorization': `Bearer ${authToken}`,
131
+ 'User-Agent': `OnairosSDK/1.0.0 (${_reactNative.Platform.OS})`
132
+ },
133
+ body: JSON.stringify(requestBody)
134
+ });
135
+ const responseData = await response.json();
136
+ if (response.ok) {
137
+ console.log('✅ [INSTAGRAM_SERVICE] Successfully stored Instagram data');
138
+ if (responseData.message) {
139
+ console.log(`📝 [INSTAGRAM_SERVICE] Backend response: ${responseData.message}`);
140
+ }
141
+ return {
142
+ success: true,
143
+ message: responseData.message || 'Instagram data stored successfully',
144
+ data: responseData.data
145
+ };
146
+ } else {
147
+ console.warn(`⚠️ [INSTAGRAM_SERVICE] Backend returned status: ${response.status}`);
148
+ console.warn(`⚠️ [INSTAGRAM_SERVICE] Error: ${responseData.error || 'Unknown error'}`);
149
+ return {
150
+ success: false,
151
+ error: responseData.error || `HTTP ${response.status}`
152
+ };
153
+ }
154
+ } catch (error) {
155
+ console.error('❌ [INSTAGRAM_SERVICE] Network error:', error);
156
+ return {
157
+ success: false,
158
+ error: error.message || 'Network error. Please check your connection.'
159
+ };
160
+ }
161
+ };
162
+ exports.storeInstagramData = storeInstagramData;
163
+ //# sourceMappingURL=instagramDataService.js.map