@onairos/react-native 3.7.2 → 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 (237) hide show
  1. package/lib/commonjs/api/index.js +219 -9
  2. package/lib/commonjs/components/BodyText.js +27 -9
  3. package/lib/commonjs/components/BrandMark.js +111 -10
  4. package/lib/commonjs/components/CodeInput.js +116 -9
  5. package/lib/commonjs/components/EmailInput.js +30 -8
  6. package/lib/commonjs/components/GoogleButton.js +56 -9
  7. package/lib/commonjs/components/HeadingGroup.js +43 -9
  8. package/lib/commonjs/components/LLMDataInputModal.js +664 -14
  9. package/lib/commonjs/components/ModalHeader.js +99 -9
  10. package/lib/commonjs/components/ModalSheet.js +47 -9
  11. package/lib/commonjs/components/Onairos.js +380 -14
  12. package/lib/commonjs/components/OnairosButton.js +313 -13
  13. package/lib/commonjs/components/OnairosSignInButton.js +130 -12
  14. package/lib/commonjs/components/Overlay.js +465 -13
  15. package/lib/commonjs/components/PersonaImage.js +137 -10
  16. package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
  17. package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
  18. package/lib/commonjs/components/PinCreationScreen.js +403 -12
  19. package/lib/commonjs/components/PinInput.js +464 -9
  20. package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
  21. package/lib/commonjs/components/PlatformList.js +137 -10
  22. package/lib/commonjs/components/PlatformToggle.js +180 -9
  23. package/lib/commonjs/components/PrimaryButton.js +180 -10
  24. package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
  25. package/lib/commonjs/components/SignInStep.js +345 -12
  26. package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
  27. package/lib/commonjs/components/VerificationStep.js +176 -11
  28. package/lib/commonjs/components/WelcomeScreen.js +461 -22
  29. package/lib/commonjs/components/icons/Basicproficon.js +37 -8
  30. package/lib/commonjs/components/icons/Basicprofile.js +21 -8
  31. package/lib/commonjs/components/icons/Checkbox.js +21 -8
  32. package/lib/commonjs/components/icons/Checkmark.js +27 -8
  33. package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
  34. package/lib/commonjs/components/icons/Contenticon.js +39 -8
  35. package/lib/commonjs/components/icons/EnochE.js +41 -8
  36. package/lib/commonjs/components/icons/Personalityicon.js +30 -8
  37. package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
  38. package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
  39. package/lib/commonjs/components/icons/Userpreferences.js +21 -8
  40. package/lib/commonjs/components/icons/index.js +84 -17
  41. package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
  42. package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
  43. package/lib/commonjs/components/onboarding/PinInput.js +283 -10
  44. package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
  45. package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
  46. package/lib/commonjs/config/api.js +56 -7
  47. package/lib/commonjs/constants/index.js +120 -7
  48. package/lib/commonjs/context/AuthContext.js +345 -10
  49. package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
  50. package/lib/commonjs/hooks/useConnections.js +102 -8
  51. package/lib/commonjs/hooks/useCredentials.js +178 -10
  52. package/lib/commonjs/hooks/useUserConnections.js +148 -10
  53. package/lib/commonjs/index.js +439 -34
  54. package/lib/commonjs/services/apiClient.js +298 -8
  55. package/lib/commonjs/services/biometricPinService.js +180 -8
  56. package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
  57. package/lib/commonjs/services/chatGPTConversationService.js +275 -9
  58. package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
  59. package/lib/commonjs/services/claudeConversationService.js +158 -9
  60. package/lib/commonjs/services/connectedAccountsService.js +310 -10
  61. package/lib/commonjs/services/googleAuthService.js +252 -11
  62. package/lib/commonjs/services/hingeDataExtractor.js +105 -8
  63. package/lib/commonjs/services/hingeDataService.js +150 -9
  64. package/lib/commonjs/services/imageCompressionService.js +260 -7
  65. package/lib/commonjs/services/instagramDataExtractor.js +126 -8
  66. package/lib/commonjs/services/instagramDataService.js +163 -9
  67. package/lib/commonjs/services/jwtStorageService.js +276 -7
  68. package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
  69. package/lib/commonjs/services/linkedinProfileService.js +222 -9
  70. package/lib/commonjs/services/linkedinScrapingService.js +230 -8
  71. package/lib/commonjs/services/llmDataStorage.js +294 -8
  72. package/lib/commonjs/services/mobileTrainingService.js +186 -8
  73. package/lib/commonjs/services/netflixDataExtractor.js +120 -8
  74. package/lib/commonjs/services/netflixDataService.js +198 -9
  75. package/lib/commonjs/services/pinEncryptionService.js +84 -8
  76. package/lib/commonjs/services/pinStorageUtils.js +105 -7
  77. package/lib/commonjs/services/platformAuthService.js +1484 -12
  78. package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
  79. package/lib/commonjs/services/sephoraDataService.js +200 -9
  80. package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
  81. package/lib/commonjs/services/spotifyDataService.js +241 -9
  82. package/lib/commonjs/services/storageService.js +404 -8
  83. package/lib/commonjs/services/telegramDataExtractor.js +115 -8
  84. package/lib/commonjs/services/telegramDataService.js +499 -9
  85. package/lib/commonjs/services/trainingApiHelpers.js +73 -7
  86. package/lib/commonjs/services/userConnectionsService.js +340 -10
  87. package/lib/commonjs/services/youtubeMigrationService.js +416 -10
  88. package/lib/commonjs/theme/index.js +250 -7
  89. package/lib/commonjs/types/ambient.d.js +2 -1
  90. package/lib/commonjs/types/declarations.d.js +2 -1
  91. package/lib/commonjs/types/index.js +6 -1
  92. package/lib/commonjs/types/node-fix.d.js +2 -1
  93. package/lib/commonjs/types/node-override.d.js +2 -1
  94. package/lib/commonjs/types/opacity.d.js +2 -1
  95. package/lib/commonjs/types.js +14 -1
  96. package/lib/commonjs/utils/Portal.js +98 -8
  97. package/lib/commonjs/utils/api.js +130 -9
  98. package/lib/commonjs/utils/assetRegistry.js +210 -35
  99. package/lib/commonjs/utils/auth.js +112 -9
  100. package/lib/commonjs/utils/connectorTests.js +613 -29
  101. package/lib/commonjs/utils/crypto.js +62 -8
  102. package/lib/commonjs/utils/debugHelper.js +64 -1
  103. package/lib/commonjs/utils/encryption.js +76 -7
  104. package/lib/commonjs/utils/eventUtils.js +288 -1
  105. package/lib/commonjs/utils/haptics.js +66 -9
  106. package/lib/commonjs/utils/imagePreloader.js +6 -1
  107. package/lib/commonjs/utils/networkDiagnostics.js +226 -8
  108. package/lib/commonjs/utils/onairosApi.js +350 -9
  109. package/lib/commonjs/utils/programmaticFlow.js +117 -9
  110. package/lib/commonjs/utils/retryHelper.js +220 -1
  111. package/lib/commonjs/utils/secureStorage.js +349 -10
  112. package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
  113. package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
  114. package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
  115. package/lib/commonjs/utils/webviewScripts/index.js +698 -15
  116. package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
  117. package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
  118. package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
  119. package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
  120. package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
  121. package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
  122. package/lib/module/api/index.js +211 -1
  123. package/lib/module/components/BodyText.js +20 -1
  124. package/lib/module/components/BrandMark.js +104 -1
  125. package/lib/module/components/CodeInput.js +109 -1
  126. package/lib/module/components/EmailInput.js +23 -1
  127. package/lib/module/components/GoogleButton.js +49 -1
  128. package/lib/module/components/HeadingGroup.js +36 -1
  129. package/lib/module/components/LLMDataInputModal.js +656 -7
  130. package/lib/module/components/ModalHeader.js +92 -1
  131. package/lib/module/components/ModalSheet.js +39 -1
  132. package/lib/module/components/Onairos.js +373 -1
  133. package/lib/module/components/OnairosButton.js +305 -1
  134. package/lib/module/components/OnairosSignInButton.js +121 -1
  135. package/lib/module/components/Overlay.js +456 -1
  136. package/lib/module/components/PersonaImage.js +129 -1
  137. package/lib/module/components/PersonaLoadingScreen.js +310 -1
  138. package/lib/module/components/PersonalizationConsentScreen.js +460 -1
  139. package/lib/module/components/PinCreationScreen.js +396 -1
  140. package/lib/module/components/PinInput.js +456 -1
  141. package/lib/module/components/PlatformConnectorsStep.js +1302 -6
  142. package/lib/module/components/PlatformList.js +129 -1
  143. package/lib/module/components/PlatformToggle.js +173 -1
  144. package/lib/module/components/PrimaryButton.js +172 -1
  145. package/lib/module/components/SignInMatchAnimation.js +189 -1
  146. package/lib/module/components/SignInStep.js +338 -1
  147. package/lib/module/components/UniversalOnboarding.js +2770 -1
  148. package/lib/module/components/VerificationStep.js +168 -1
  149. package/lib/module/components/WelcomeScreen.js +453 -1
  150. package/lib/module/components/icons/Basicproficon.js +30 -1
  151. package/lib/module/components/icons/Basicprofile.js +14 -1
  152. package/lib/module/components/icons/Checkbox.js +14 -1
  153. package/lib/module/components/icons/Checkmark.js +20 -1
  154. package/lib/module/components/icons/Contentanalysis.js +14 -1
  155. package/lib/module/components/icons/Contenticon.js +32 -1
  156. package/lib/module/components/icons/EnochE.js +34 -1
  157. package/lib/module/components/icons/Personalityicon.js +23 -1
  158. package/lib/module/components/icons/Personalityprofile.js +14 -1
  159. package/lib/module/components/icons/Personalitytraits.js +14 -1
  160. package/lib/module/components/icons/Userpreferences.js +14 -1
  161. package/lib/module/components/icons/index.js +13 -1
  162. package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
  163. package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
  164. package/lib/module/components/onboarding/PinInput.js +274 -1
  165. package/lib/module/components/onboarding/PlatformConnector.js +240 -1
  166. package/lib/module/config/PLATFORM_APIS.md +849 -0
  167. package/lib/module/config/api.js +47 -1
  168. package/lib/module/constants/index.js +114 -1
  169. package/lib/module/context/AuthContext.js +335 -1
  170. package/lib/module/hooks/useConnectedAccounts.js +106 -1
  171. package/lib/module/hooks/useConnections.js +95 -1
  172. package/lib/module/hooks/useCredentials.js +171 -6
  173. package/lib/module/hooks/useUserConnections.js +140 -1
  174. package/lib/module/index.js +172 -1
  175. package/lib/module/services/apiClient.js +295 -1
  176. package/lib/module/services/biometricPinService.js +169 -1
  177. package/lib/module/services/chatGPTConversationExtractor.js +149 -1
  178. package/lib/module/services/chatGPTConversationService.js +268 -1
  179. package/lib/module/services/claudeConversationExtractor.js +97 -1
  180. package/lib/module/services/claudeConversationService.js +151 -1
  181. package/lib/module/services/connectedAccountsService.js +293 -1
  182. package/lib/module/services/googleAuthService.js +241 -1
  183. package/lib/module/services/hingeDataExtractor.js +99 -1
  184. package/lib/module/services/hingeDataService.js +143 -1
  185. package/lib/module/services/imageCompressionService.js +250 -1
  186. package/lib/module/services/instagramDataExtractor.js +120 -1
  187. package/lib/module/services/instagramDataService.js +156 -1
  188. package/lib/module/services/jwtStorageService.js +257 -1
  189. package/lib/module/services/linkedinDOMExtractor.js +234 -1
  190. package/lib/module/services/linkedinProfileService.js +210 -1
  191. package/lib/module/services/linkedinScrapingService.js +219 -1
  192. package/lib/module/services/llmDataStorage.js +277 -1
  193. package/lib/module/services/mobileTrainingService.js +173 -1
  194. package/lib/module/services/netflixDataExtractor.js +114 -1
  195. package/lib/module/services/netflixDataService.js +191 -1
  196. package/lib/module/services/pinEncryptionService.js +74 -6
  197. package/lib/module/services/pinStorageUtils.js +93 -1
  198. package/lib/module/services/platformAuthService.js +1461 -1
  199. package/lib/module/services/sephoraDataExtractor.js +134 -1
  200. package/lib/module/services/sephoraDataService.js +193 -1
  201. package/lib/module/services/spotifyDataExtractor.js +142 -1
  202. package/lib/module/services/spotifyDataService.js +234 -1
  203. package/lib/module/services/storageService.js +383 -1
  204. package/lib/module/services/telegramDataExtractor.js +109 -1
  205. package/lib/module/services/telegramDataService.js +493 -1
  206. package/lib/module/services/trainingApiHelpers.js +67 -1
  207. package/lib/module/services/userConnectionsService.js +329 -1
  208. package/lib/module/services/youtubeMigrationService.js +405 -1
  209. package/lib/module/theme/index.js +245 -1
  210. package/lib/module/types.js +10 -1
  211. package/lib/module/utils/Portal.js +90 -1
  212. package/lib/module/utils/api.js +118 -1
  213. package/lib/module/utils/assetRegistry.js +200 -34
  214. package/lib/module/utils/auth.js +100 -1
  215. package/lib/module/utils/connectorTests.js +600 -27
  216. package/lib/module/utils/crypto.js +54 -1
  217. package/lib/module/utils/debugHelper.js +54 -1
  218. package/lib/module/utils/encryption.js +67 -1
  219. package/lib/module/utils/eventUtils.js +270 -1
  220. package/lib/module/utils/haptics.js +59 -8
  221. package/lib/module/utils/imagePreloader.js +3 -1
  222. package/lib/module/utils/networkDiagnostics.js +217 -1
  223. package/lib/module/utils/onairosApi.js +333 -1
  224. package/lib/module/utils/programmaticFlow.js +111 -1
  225. package/lib/module/utils/retryHelper.js +211 -1
  226. package/lib/module/utils/secureStorage.js +330 -6
  227. package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
  228. package/lib/module/utils/webviewScripts/claude.js +370 -1
  229. package/lib/module/utils/webviewScripts/hinge.js +405 -1
  230. package/lib/module/utils/webviewScripts/index.js +434 -1
  231. package/lib/module/utils/webviewScripts/instagram.js +448 -1
  232. package/lib/module/utils/webviewScripts/linkedin.js +874 -1
  233. package/lib/module/utils/webviewScripts/netflix.js +376 -1
  234. package/lib/module/utils/webviewScripts/sephora.js +510 -1
  235. package/lib/module/utils/webviewScripts/spotify.js +413 -1
  236. package/lib/module/utils/webviewScripts/telegram.js +672 -1
  237. package/package.json +2 -2
@@ -1,11 +1,252 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("@react-native-google-signin/google-signin"),
5
- require("@react-native-async-storage/async-storage"),
6
- require("../config/api"),
7
- require("./apiKeyService"),
8
- require("./jwtStorageService")
9
- ];
10
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
11
- Object[_0x2a6a(0x0)](exports,_0x2a6a(0x1),{'value':!![]}),exports[_0x2a6a(0x2)]=exports[_0x2a6a(0x3)]=exports[_0x2a6a(0x4)]=exports[_0x2a6a(0x5)]=void 0x0;var _googleSignin=__ONAIROS_REQ_FUNC__(0x0),_asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x1)),_api=__ONAIROS_REQ_FUNC__(0x2),_apiKeyService=__ONAIROS_REQ_FUNC__(0x3),_jwtStorageService=__ONAIROS_REQ_FUNC__(0x4);function _interopRequireDefault(_0x77ad1){return _0x77ad1&&_0x77ad1[_0x2a6a(0x1)]?_0x77ad1:{'default':_0x77ad1};}let WEB_CLIENT_ID=_0x2a6a(0x6),IOS_CLIENT_ID=_0x2a6a(0x6);const updateGoogleClientIds=_0x31983e=>{const _0x457f06={'EecIG':_0x2a6a(0x7),'NaiWc':function(_0x514f33,_0x4e1713){return _0x514f33===_0x4e1713;},'iHnKg':_0x2a6a(0x8)};_0x31983e[_0x2a6a(0x9)]&&(_0x457f06[_0x2a6a(0xa)](_0x457f06[_0x2a6a(0xb)],_0x457f06[_0x2a6a(0xb)])?WEB_CLIENT_ID=_0x31983e[_0x2a6a(0x9)]:(_0x2acf07[_0x2a6a(0x9)]&&(_0x10d164=_0x35e08c[_0x2a6a(0x9)]),_0x12e2ef[_0x2a6a(0xc)]&&(_0x4e2cec=_0x28fbb0[_0x2a6a(0xc)]),_0x5241d3[_0x2a6a(0xd)](_0x457f06[_0x2a6a(0xe)],{'webClientId':_0x2ba12f,'iosClientId':_0x3405ad}))),_0x31983e[_0x2a6a(0xc)]&&(IOS_CLIENT_ID=_0x31983e[_0x2a6a(0xc)]),console[_0x2a6a(0xd)](_0x457f06[_0x2a6a(0xe)],{'webClientId':WEB_CLIENT_ID,'iosClientId':IOS_CLIENT_ID});};exports[_0x2a6a(0x2)]=updateGoogleClientIds;function _0x2a6a(_0x35e9b8,_0x2a6a1c){_0x35e9b8=_0x35e9b8-0x0;const _0x2d8849=_0x35e9();let _0x252428=_0x2d8849[_0x35e9b8];return _0x252428;}const initializeGoogleAuth=()=>{const _0xda6f27={'lRGcz':_0x2a6a(0xf),'ULQqs':_0x2a6a(0x10),'sWdyu':_0x2a6a(0x11)};_googleSignin[_0x2a6a(0x12)][_0x2a6a(0x13)]({'webClientId':WEB_CLIENT_ID,'iosClientId':IOS_CLIENT_ID,'scopes':[_0xda6f27[_0x2a6a(0x14)],_0xda6f27[_0x2a6a(0x15)],_0xda6f27['sWdyu']],'offlineAccess':!![],'forceCodeForRefreshToken':!![],'hostedDomain':'','accountName':''});},signInWithGoogle=async()=>{const _0x47cf0e={'iZikn':_0x2a6a(0x16),'fyfvO':_0x2a6a(0x17),'pOFrM':'🔄\x20Signed\x20out\x20to\x20ensure\x20fresh\x20consent','GIzAY':function(_0xc0ad69,_0x5ee984){return _0xc0ad69!==_0x5ee984;},'tQUlG':'fVQUJ','rlDqA':'qRqgv','YFPmb':_0x2a6a(0x18),'XyNhm':'✅\x20Google\x20Sign-In\x20successful:','utlpd':function(_0x4fea5b,_0xccbd96){return _0x4fea5b===_0xccbd96;},'ISrGc':function(_0xf95acf,_0x1685d0){return _0xf95acf===_0x1685d0;},'PjWhn':_0x2a6a(0x19),'xYsHc':_0x2a6a(0x1a),'jQSlz':_0x2a6a(0x1b),'PRUBQ':function(_0x325441,_0x51f0c8){return _0x325441(_0x51f0c8);},'eYdQc':_0x2a6a(0x1c),'znbgV':_0x2a6a(0x1d),'fpCds':_0x2a6a(0x1e),'ZMiWH':'auth_method','kXMdG':_0x2a6a(0x1f),'jfGfg':function(_0x55945e,_0x212c34){return _0x55945e===_0x212c34;},'QSyLf':_0x2a6a(0x20),'meaxb':'❌\x20Google\x20Sign-In\x20error:','xuPix':'Google\x20Sign-In\x20was\x20cancelled','fyoVy':function(_0x11abc4,_0x39dc03){return _0x11abc4===_0x39dc03;},'cHhns':function(_0x426663,_0x4c3974){return _0x426663===_0x4c3974;},'mgKmL':'Google\x20Play\x20Services\x20not\x20available','dGyFq':_0x2a6a(0x21),'crsgq':_0x2a6a(0x22)};try{var _0x680338,_0x1dee6;console[_0x2a6a(0xd)](_0x47cf0e[_0x2a6a(0x23)]),initializeGoogleAuth(),await _googleSignin[_0x2a6a(0x12)][_0x2a6a(0x24)]();try{await _googleSignin[_0x2a6a(0x12)]['signOut'](),console[_0x2a6a(0xd)](_0x47cf0e[_0x2a6a(0x25)]);}catch(_0x4a5a70){if(_0x47cf0e[_0x2a6a(0x26)](_0x47cf0e[_0x2a6a(0x27)],_0x47cf0e['rlDqA']))console[_0x2a6a(0xd)](_0x47cf0e[_0x2a6a(0x28)],_0x4a5a70);else return{'isSignedIn':!![],'user':_0x4c0063===null||_0x2d962e===void 0x0?void 0x0:_0x10da8d[_0x2a6a(0x29)]};}const _0x3dafbd=await _googleSignin['GoogleSignin'][_0x2a6a(0x2a)]();console[_0x2a6a(0xd)](_0x47cf0e[_0x2a6a(0x2b)],_0x47cf0e[_0x2a6a(0x2c)](_0x680338=_0x3dafbd[_0x2a6a(0x2d)],null)||_0x47cf0e[_0x2a6a(0x2c)](_0x680338,void 0x0)||_0x47cf0e[_0x2a6a(0x2e)](_0x680338=_0x680338[_0x2a6a(0x29)],null)||_0x47cf0e[_0x2a6a(0x2e)](_0x680338,void 0x0)?void 0x0:_0x680338[_0x2a6a(0x11)]);const _0x193a3f=(_0x1dee6=_0x3dafbd[_0x2a6a(0x2d)])===null||_0x47cf0e[_0x2a6a(0x2c)](_0x1dee6,void 0x0)?void 0x0:_0x1dee6[_0x2a6a(0x29)];if(!_0x193a3f||!_0x193a3f[_0x2a6a(0x11)])throw new Error(_0x47cf0e['PjWhn']);console['log'](_0x47cf0e[_0x2a6a(0x2f)],{'email':_0x193a3f[_0x2a6a(0x11)],'name':_0x193a3f[_0x2a6a(0x30)],'photo':_0x193a3f[_0x2a6a(0x31)],'id':_0x193a3f['id']});const _0x3e0927=await _googleSignin[_0x2a6a(0x12)]['getTokens']();console[_0x2a6a(0xd)](_0x47cf0e[_0x2a6a(0x32)]);const _0x513e4f=await _0x47cf0e['PRUBQ'](createUserAccount,{'email':_0x193a3f[_0x2a6a(0x11)],'name':_0x193a3f[_0x2a6a(0x30)]||_0x193a3f['email']['split']('@')[0x0],'photoUrl':_0x193a3f[_0x2a6a(0x31)]||'','googleId':_0x193a3f['id'],'accessToken':_0x3e0927[_0x2a6a(0x33)],'idToken':_0x3e0927['idToken']});if(_0x513e4f[_0x2a6a(0x34)]){var _0x3edeea,_0x41f0a6;return console['log'](_0x47cf0e[_0x2a6a(0x35)]),await _asyncStorage[_0x2a6a(0x36)][_0x2a6a(0x37)](_0x47cf0e[_0x2a6a(0x38)],_0x193a3f[_0x2a6a(0x11)]),await _asyncStorage[_0x2a6a(0x36)][_0x2a6a(0x37)](_0x47cf0e[_0x2a6a(0x39)],_0x193a3f[_0x2a6a(0x11)][_0x2a6a(0x3a)]('@')[0x0]),await _asyncStorage[_0x2a6a(0x36)][_0x2a6a(0x37)](_0x47cf0e[_0x2a6a(0x3b)],_0x47cf0e[_0x2a6a(0x3c)]),_0x513e4f[_0x2a6a(0x3d)]&&await(0x0,_jwtStorageService['storeJWT'])(_0x513e4f[_0x2a6a(0x3d)]),{'success':!![],'user':{'id':(_0x47cf0e['jfGfg'](_0x3edeea=_0x513e4f[_0x2a6a(0x29)],null)||_0x3edeea===void 0x0?void 0x0:_0x3edeea['id'])||'','email':_0x193a3f[_0x2a6a(0x11)],'username':_0x193a3f[_0x2a6a(0x30)]||_0x193a3f[_0x2a6a(0x11)]['split']('@')[0x0],'odeanId':_0x47cf0e[_0x2a6a(0x2c)](_0x41f0a6=_0x513e4f[_0x2a6a(0x29)],null)||_0x41f0a6===void 0x0?void 0x0:_0x41f0a6['odeanId']},'token':_0x513e4f[_0x2a6a(0x3d)],'isNewUser':_0x513e4f['isNewUser']||![]};}else throw new Error(_0x513e4f[_0x2a6a(0x3e)]||_0x47cf0e[_0x2a6a(0x3f)]);}catch(_0x457d7a){console[_0x2a6a(0x40)](_0x47cf0e[_0x2a6a(0x41)],_0x457d7a);if(_0x47cf0e[_0x2a6a(0x42)](_0x457d7a['code'],_googleSignin[_0x2a6a(0x43)][_0x2a6a(0x44)]))return{'success':![],'message':_0x47cf0e['xuPix'],'cancelled':!![]};else{if(_0x47cf0e[_0x2a6a(0x45)](_0x457d7a[_0x2a6a(0x46)],_googleSignin['statusCodes'][_0x2a6a(0x47)]))return{'success':![],'message':_0x2a6a(0x48)};else return _0x47cf0e[_0x2a6a(0x49)](_0x457d7a['code'],_googleSignin['statusCodes']['PLAY_SERVICES_NOT_AVAILABLE'])?{'success':![],'message':_0x47cf0e[_0x2a6a(0x4a)]}:_0x47cf0e['GIzAY']('OWpBm',_0x47cf0e[_0x2a6a(0x4b)])?(_0x51bbf1[_0x2a6a(0x40)](_0x47cf0e['iZikn'],_0x50682b),![]):{'success':![],'message':_0x457d7a[_0x2a6a(0x3e)]||_0x47cf0e[_0x2a6a(0x4c)]};}}};exports[_0x2a6a(0x4)]=signInWithGoogle;function _0x35e9(){const _0x529983=['defineProperty','__esModule','updateGoogleClientIds','signOutFromGoogle','signInWithGoogle','isGoogleSignedIn','1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com','✅\x20Google\x20client\x20IDs\x20updated:','xvCjP','webClientId','NaiWc','iHnKg','iosClientId','log','EecIG','openid','profile','email','GoogleSignin','configure','lRGcz','ULQqs','❌\x20Google\x20sign-out\x20error:','🔗\x20Initiating\x20Google\x20Sign-In\x20for\x20user\x20authentication','ℹ️\x20Sign\x20out\x20not\x20needed\x20or\x20failed:','No\x20user\x20data\x20received\x20from\x20Google','👤\x20Google\x20user\x20data:','🔑\x20Got\x20Google\x20tokens','✅\x20User\x20account\x20created/authenticated\x20successfully','user_email','onairos_username','google','Failed\x20to\x20create\x20user\x20account','OWpBm','Google\x20Sign-In\x20failed','fyfvO','hasPlayServices','pOFrM','GIzAY','tQUlG','YFPmb','user','signIn','XyNhm','utlpd','data','ISrGc','xYsHc','name','photo','jQSlz','accessToken','success','eYdQc','default','setItem','znbgV','fpCds','split','ZMiWH','kXMdG','token','message','QSyLf','error','meaxb','jfGfg','statusCodes','SIGN_IN_CANCELLED','fyoVy','code','IN_PROGRESS','Google\x20Sign-In\x20is\x20already\x20in\x20progress','cHhns','mgKmL','dGyFq','crsgq','❌\x20Error\x20checking\x20Google\x20sign-in\x20status:','nuXMb','📡\x20Google\x20register\x20response\x20status:','🔗\x20Account\x20creation\x20response:','SxXsX','bpWap','zZZVG','🔐\x20Creating/authenticating\x20user\x20account\x20for:','🔐\x20Calling\x20generic\x20/register/google\x20endpoint...','lXdPb','API_CONFIG','BASE_URL','/register/google','stringify','dgKUR','status','json','VulPk','isNewUser','neefh','cBawr','Failed\x20to\x20create\x20account','Xliis','Account\x20created/authenticated\x20successfully','kSOus','nmmHd','jrjoj','rFcwV','xEMRG','WWHUi','ShKzS','HEOVo','signOut','CYNab','ZdQfJ'];_0x35e9=function(){return _0x529983;};return _0x35e9();}const createUserAccount=async _0x51a6fd=>{const _0x8f473c={'cBawr':'❌\x20Error\x20creating\x20user\x20account:','Xliis':_0x2a6a(0x4d),'zZZVG':_0x2a6a(0x4e),'lXdPb':function(_0x553baf,_0x31d1ff,_0x288532){return _0x553baf(_0x31d1ff,_0x288532);},'dgKUR':_0x2a6a(0x4f),'SAKRK':_0x2a6a(0x50),'VulPk':_0x2a6a(0x51),'bsrMs':_0x2a6a(0x52),'neefh':'Account\x20created/authenticated\x20successfully'};try{if(_0x8f473c[_0x2a6a(0x53)]===_0x8f473c[_0x2a6a(0x53)]){console[_0x2a6a(0xd)](_0x2a6a(0x54),_0x51a6fd[_0x2a6a(0x11)]),console['log'](_0x2a6a(0x55));const _0x24faeb=await(0x0,_apiKeyService['getDeveloperAuthHeaders'])(),_0x6ec329=await _0x8f473c[_0x2a6a(0x56)](fetch,_api[_0x2a6a(0x57)][_0x2a6a(0x58)]+_0x2a6a(0x59),{'method':'POST','headers':_0x24faeb,'body':JSON[_0x2a6a(0x5a)]({'credential':_0x51a6fd['idToken'],'email':_0x51a6fd[_0x2a6a(0x11)],'name':_0x51a6fd[_0x2a6a(0x30)],'photoUrl':_0x51a6fd['photoUrl']})});console[_0x2a6a(0xd)](_0x8f473c[_0x2a6a(0x5b)],_0x6ec329[_0x2a6a(0x5c)]);const _0x510587=await _0x6ec329[_0x2a6a(0x5d)]();return console['log'](_0x8f473c['SAKRK'],_0x510587),_0x6ec329['ok']&&_0x510587[_0x2a6a(0x3d)]?_0x8f473c[_0x2a6a(0x5e)]!==_0x8f473c['bsrMs']?{'success':!![],'token':_0x510587['token'],'user':_0x510587['user'],'isNewUser':_0x510587[_0x2a6a(0x5f)]||![],'message':_0x8f473c[_0x2a6a(0x60)]}:(_0x28540a[_0x2a6a(0x40)](_0x8f473c[_0x2a6a(0x61)],_0x58f72c),{'success':![],'message':_0x58ad26[_0x2a6a(0x3e)]||_0x2a6a(0x20)}):{'success':![],'message':_0x510587['message']||_0x510587[_0x2a6a(0x40)]||_0x2a6a(0x62)};}else return _0x50e939['error'](_0x8f473c[_0x2a6a(0x63)],_0x19286f),{'isSignedIn':![]};}catch(_0x21643a){return console['error'](_0x8f473c[_0x2a6a(0x61)],_0x21643a),{'success':![],'message':_0x21643a['message']||_0x2a6a(0x20)};}},isGoogleSignedIn=async()=>{const _0x36322e={'WWHUi':_0x2a6a(0x64),'kSOus':function(_0x418efa,_0x1e4cc5){return _0x418efa===_0x1e4cc5;},'nmmHd':'jrjoj','rFcwV':function(_0x46a7f5,_0x459bb8){return _0x46a7f5!==_0x459bb8;},'xEMRG':function(_0xa5dccb,_0xc0d77d){return _0xa5dccb===_0xc0d77d;},'Pjqud':function(_0x52616d,_0x2049c8){return _0x52616d===_0x2049c8;},'ShKzS':'❌\x20Error\x20checking\x20Google\x20sign-in\x20status:'};try{if(_0x36322e[_0x2a6a(0x65)](_0x36322e[_0x2a6a(0x66)],_0x2a6a(0x67))){const _0x1ef7a1=await _googleSignin[_0x2a6a(0x12)]['getCurrentUser'](),_0x32cc79=_0x36322e[_0x2a6a(0x68)](_0x1ef7a1,null);if(_0x32cc79)return{'isSignedIn':!![],'user':_0x36322e[_0x2a6a(0x69)](_0x1ef7a1,null)||_0x36322e['Pjqud'](_0x1ef7a1,void 0x0)?void 0x0:_0x1ef7a1[_0x2a6a(0x29)]};return{'isSignedIn':![]};}else return{'success':!![],'token':_0x4b266b[_0x2a6a(0x3d)],'user':_0x2343e1['user'],'isNewUser':_0x32004a['isNewUser']||![],'message':_0x36322e[_0x2a6a(0x6a)]};}catch(_0x26257b){return console[_0x2a6a(0x40)](_0x36322e[_0x2a6a(0x6b)],_0x26257b),{'isSignedIn':![]};}};exports[_0x2a6a(0x5)]=isGoogleSignedIn;const signOutFromGoogle=async()=>{const _0x3b27a3={'CYNab':_0x2a6a(0x6c),'ZdQfJ':_0x2a6a(0x16)};try{return await _googleSignin[_0x2a6a(0x12)][_0x2a6a(0x6d)](),console[_0x2a6a(0xd)]('✅\x20Google\x20sign-out\x20successful'),!![];}catch(_0x2c9a33){if(_0x2a6a(0x6c)!==_0x3b27a3[_0x2a6a(0x6e)])_0x3ea66a=_0x2f5c2c[_0x2a6a(0x9)];else return console[_0x2a6a(0x40)](_0x3b27a3[_0x2a6a(0x6f)],_0x2c9a33),![];}};exports[_0x2a6a(0x3)]=signOutFromGoogle;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.updateGoogleClientIds = exports.signOutFromGoogle = exports.signInWithGoogle = exports.isGoogleSignedIn = void 0;
7
+ var _googleSignin = require("@react-native-google-signin/google-signin");
8
+ var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
9
+ var _api = require("../config/api");
10
+ var _apiKeyService = require("./apiKeyService");
11
+ var _jwtStorageService = require("./jwtStorageService");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ /**
14
+ * Google Authentication Service
15
+ * Handles Google Sign-In for user authentication and account creation
16
+ */
17
+
18
+ // CRITICAL FIX: Use static imports to avoid Hermes transpilation issues
19
+
20
+ // 🔑 Using the same client ID configuration as platform auth
21
+ let WEB_CLIENT_ID = '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com';
22
+ let IOS_CLIENT_ID = '1030678346906-lovkuds2ouqmoc8eu5qpo98spa6edv4o.apps.googleusercontent.com';
23
+
24
+ /**
25
+ * Update Google OAuth client IDs for custom configurations
26
+ */
27
+ const updateGoogleClientIds = config => {
28
+ if (config.webClientId) {
29
+ WEB_CLIENT_ID = config.webClientId;
30
+ }
31
+ if (config.iosClientId) {
32
+ IOS_CLIENT_ID = config.iosClientId;
33
+ }
34
+ console.log('✅ Google client IDs updated:', {
35
+ webClientId: WEB_CLIENT_ID,
36
+ iosClientId: IOS_CLIENT_ID
37
+ });
38
+ };
39
+
40
+ /**
41
+ * Initialize Google Sign-In for user authentication
42
+ */
43
+ exports.updateGoogleClientIds = updateGoogleClientIds;
44
+ const initializeGoogleAuth = () => {
45
+ _googleSignin.GoogleSignin.configure({
46
+ webClientId: WEB_CLIENT_ID,
47
+ iosClientId: IOS_CLIENT_ID,
48
+ // Basic scopes for user authentication
49
+ scopes: ['openid', 'profile', 'email'],
50
+ // Enable offline access for refresh tokens
51
+ offlineAccess: true,
52
+ forceCodeForRefreshToken: true,
53
+ // Clear settings to avoid conflicts
54
+ hostedDomain: '',
55
+ accountName: ''
56
+ });
57
+ };
58
+
59
+ /**
60
+ * Sign in with Google and create/authenticate user account
61
+ */
62
+ const signInWithGoogle = async () => {
63
+ try {
64
+ var _userInfo$data, _userInfo$data2;
65
+ console.log('🔗 Initiating Google Sign-In for user authentication');
66
+
67
+ // Initialize Google Sign-In
68
+ initializeGoogleAuth();
69
+
70
+ // Check if Google Play Services are available
71
+ await _googleSignin.GoogleSignin.hasPlayServices();
72
+
73
+ // Sign out first to ensure fresh consent
74
+ try {
75
+ await _googleSignin.GoogleSignin.signOut();
76
+ console.log('🔄 Signed out to ensure fresh consent');
77
+ } catch (signOutError) {
78
+ console.log('ℹ️ Sign out not needed or failed:', signOutError);
79
+ }
80
+
81
+ // Sign in with Google
82
+ const userInfo = await _googleSignin.GoogleSignin.signIn();
83
+ console.log('✅ Google Sign-In successful:', (_userInfo$data = userInfo.data) === null || _userInfo$data === void 0 || (_userInfo$data = _userInfo$data.user) === null || _userInfo$data === void 0 ? void 0 : _userInfo$data.email);
84
+ const googleUser = (_userInfo$data2 = userInfo.data) === null || _userInfo$data2 === void 0 ? void 0 : _userInfo$data2.user;
85
+ if (!googleUser || !googleUser.email) {
86
+ throw new Error('No user data received from Google');
87
+ }
88
+ console.log('👤 Google user data:', {
89
+ email: googleUser.email,
90
+ name: googleUser.name,
91
+ photo: googleUser.photo,
92
+ id: googleUser.id
93
+ });
94
+
95
+ // Get tokens for account creation
96
+ const tokens = await _googleSignin.GoogleSignin.getTokens();
97
+ console.log('🔑 Got Google tokens');
98
+
99
+ // Create user account on backend
100
+ const accountResult = await createUserAccount({
101
+ email: googleUser.email,
102
+ name: googleUser.name || googleUser.email.split('@')[0],
103
+ photoUrl: googleUser.photo || '',
104
+ googleId: googleUser.id,
105
+ accessToken: tokens.accessToken,
106
+ idToken: tokens.idToken
107
+ });
108
+ if (accountResult.success) {
109
+ var _accountResult$user, _accountResult$user2;
110
+ console.log('✅ User account created/authenticated successfully');
111
+
112
+ // Store authentication data
113
+ await _asyncStorage.default.setItem('user_email', googleUser.email);
114
+ // ✅ FIX: Always use email prefix for username (matches backend userName field)
115
+ // This ensures LinkedIn scraper can find the user by userName
116
+ await _asyncStorage.default.setItem('onairos_username', googleUser.email.split('@')[0]);
117
+ await _asyncStorage.default.setItem('auth_method', 'google');
118
+
119
+ // Use simplified JWT storage
120
+ if (accountResult.token) {
121
+ await (0, _jwtStorageService.storeJWT)(accountResult.token);
122
+ }
123
+ return {
124
+ success: true,
125
+ user: {
126
+ id: ((_accountResult$user = accountResult.user) === null || _accountResult$user === void 0 ? void 0 : _accountResult$user.id) || '',
127
+ email: googleUser.email,
128
+ username: googleUser.name || googleUser.email.split('@')[0],
129
+ odeanId: (_accountResult$user2 = accountResult.user) === null || _accountResult$user2 === void 0 ? void 0 : _accountResult$user2.odeanId
130
+ },
131
+ token: accountResult.token,
132
+ isNewUser: accountResult.isNewUser || false
133
+ };
134
+ } else {
135
+ throw new Error(accountResult.message || 'Failed to create user account');
136
+ }
137
+ } catch (error) {
138
+ console.error('❌ Google Sign-In error:', error);
139
+
140
+ // Handle specific Google Sign-In errors
141
+ if (error.code === _googleSignin.statusCodes.SIGN_IN_CANCELLED) {
142
+ return {
143
+ success: false,
144
+ message: 'Google Sign-In was cancelled',
145
+ cancelled: true
146
+ };
147
+ } else if (error.code === _googleSignin.statusCodes.IN_PROGRESS) {
148
+ return {
149
+ success: false,
150
+ message: 'Google Sign-In is already in progress'
151
+ };
152
+ } else if (error.code === _googleSignin.statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
153
+ return {
154
+ success: false,
155
+ message: 'Google Play Services not available'
156
+ };
157
+ } else {
158
+ return {
159
+ success: false,
160
+ message: error.message || 'Google Sign-In failed'
161
+ };
162
+ }
163
+ }
164
+ };
165
+
166
+ /**
167
+ * Create or authenticate user account on backend using generic SDK endpoint
168
+ * NOTE: This is generic SDK auth - does NOT create EnochUser
169
+ * Consuming apps should call /enoch/users/register after this if needed
170
+ */
171
+ exports.signInWithGoogle = signInWithGoogle;
172
+ const createUserAccount = async userData => {
173
+ try {
174
+ console.log('🔐 Creating/authenticating user account for:', userData.email);
175
+ console.log('🔐 Calling generic /register/google endpoint...');
176
+ const headers = await (0, _apiKeyService.getDeveloperAuthHeaders)();
177
+ const response = await fetch(`${_api.API_CONFIG.BASE_URL}/register/google`, {
178
+ method: 'POST',
179
+ headers,
180
+ body: JSON.stringify({
181
+ credential: userData.idToken,
182
+ email: userData.email,
183
+ name: userData.name,
184
+ photoUrl: userData.photoUrl
185
+ })
186
+ });
187
+ console.log('📡 Google register response status:', response.status);
188
+ const responseData = await response.json();
189
+ console.log('🔗 Account creation response:', responseData);
190
+ if (response.ok && responseData.token) {
191
+ return {
192
+ success: true,
193
+ token: responseData.token,
194
+ user: responseData.user,
195
+ isNewUser: responseData.isNewUser || false,
196
+ message: 'Account created/authenticated successfully'
197
+ };
198
+ } else {
199
+ return {
200
+ success: false,
201
+ message: responseData.message || responseData.error || 'Failed to create account'
202
+ };
203
+ }
204
+ } catch (error) {
205
+ console.error('❌ Error creating user account:', error);
206
+ return {
207
+ success: false,
208
+ message: error.message || 'Failed to create user account'
209
+ };
210
+ }
211
+ };
212
+
213
+ /**
214
+ * Check if user is already signed in with Google
215
+ */
216
+ const isGoogleSignedIn = async () => {
217
+ try {
218
+ const currentUser = await _googleSignin.GoogleSignin.getCurrentUser();
219
+ const isSignedIn = currentUser !== null;
220
+ if (isSignedIn) {
221
+ return {
222
+ isSignedIn: true,
223
+ user: currentUser === null || currentUser === void 0 ? void 0 : currentUser.user
224
+ };
225
+ }
226
+ return {
227
+ isSignedIn: false
228
+ };
229
+ } catch (error) {
230
+ console.error('❌ Error checking Google sign-in status:', error);
231
+ return {
232
+ isSignedIn: false
233
+ };
234
+ }
235
+ };
236
+
237
+ /**
238
+ * Sign out from Google
239
+ */
240
+ exports.isGoogleSignedIn = isGoogleSignedIn;
241
+ const signOutFromGoogle = async () => {
242
+ try {
243
+ await _googleSignin.GoogleSignin.signOut();
244
+ console.log('✅ Google sign-out successful');
245
+ return true;
246
+ } catch (error) {
247
+ console.error('❌ Google sign-out error:', error);
248
+ return false;
249
+ }
250
+ };
251
+ exports.signOutFromGoogle = signOutFromGoogle;
252
+ //# sourceMappingURL=googleAuthService.js.map
@@ -1,8 +1,105 @@
1
- 'use strict';
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require("./hingeDataService"),
5
- require("react-native")
6
- ];
7
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
8
- Object[_0x33a3(0x0)](exports,_0x33a3(0x1),{'value':!![]}),exports[_0x33a3(0x2)]=void 0x0;var _hingeDataService=__ONAIROS_REQ_FUNC__(0x0),_reactNative=__ONAIROS_REQ_FUNC__(0x1);const useHingeDataExtractor=()=>{const _0x24f96d={'WKihy':_0x33a3(0x3),'Dvkqp':_0x33a3(0x4),'bwXuw':'An\x20unknown\x20error\x20occurred\x20during\x20data\x20storage.','AAPHX':'UmrPW','fNbVV':function(_0x332d38,_0x3e5059){return _0x332d38>_0x3e5059;},'OtScX':function(_0x3c8382,_0x1c8148){return _0x3c8382!==_0x1c8148;},'AeWEr':_0x33a3(0x5),'MAbIq':'❌\x20[HINGE_EXTRACTOR]\x20Unexpected\x20error\x20during\x20export:','KDttg':_0x33a3(0x6),'nyddX':'default','MywPf':'✅\x20[HINGE_EXTRACTOR]\x20Export\x20completed\x20successfully','BTmQj':_0x33a3(0x7),'qlngW':function(_0x36997c,_0x3f0a94){return _0x36997c===_0x3f0a94;},'mQeMH':_0x33a3(0x8),'AUaxZ':_0x33a3(0x9),'HufWQ':_0x33a3(0xa),'kXAbY':function(_0x77843b,_0x570789){return _0x77843b===_0x570789;},'Mlqrb':_0x33a3(0xb),'Lhgmv':'🚀\x20[HINGE_EXTRACTOR]\x20Initiating\x20data\x20export','VvjgQ':'👤\x20[HINGE_EXTRACTOR]\x20Username:','seFot':'📊\x20[HINGE_EXTRACTOR]\x20Matches:','yUAGm':'📊\x20[HINGE_EXTRACTOR]\x20Chats:','gcYnK':function(_0x5b4262,_0x3454b7){return _0x5b4262===_0x3454b7;},'onyZi':_0x33a3(0xc),'hufhc':_0x33a3(0xd),'mCjWw':function(_0xd7991,_0x1a4d1e){return _0xd7991<_0x1a4d1e;},'bpZyt':function(_0x5a074d,_0x2bfe78){return _0x5a074d-_0x2bfe78;},'yVNdf':function(_0x33bb84,_0xaa2993){return _0x33bb84!==_0xaa2993;},'ClZYs':_0x33a3(0xe),'JUTsl':_0x33a3(0xf),'JuUuD':'📡\x20[HINGE_EXTRACTOR]\x20Sending\x20to\x20backend...','MXKCU':function(_0xbff44f,_0x519e76){return _0xbff44f===_0x519e76;},'vkPDE':'VDHGX','DgRhX':_0x33a3(0x10),'FmtGN':_0x33a3(0x11)},_0x394f39=async(_0x2b6c17,_0x299ae7)=>{const _0x3160d9={'JFuwl':_0x24f96d[_0x33a3(0x12)],'xHQKx':_0x24f96d[_0x33a3(0x13)],'TjDoU':_0x24f96d[_0x33a3(0x14)],'Syydz':_0x24f96d[_0x33a3(0x15)]};if(_0x24f96d['kXAbY']('TqAYq',_0x24f96d[_0x33a3(0x16)]))return _0x49bb40['error'](_0x3160d9[_0x33a3(0x17)]),_0x52f175[_0x33a3(0x18)][_0x33a3(0x19)](_0x3160d9['xHQKx'],_0x3160d9['TjDoU'],[{'text':'OK','style':_0x3160d9[_0x33a3(0x1a)]}]),![];else{var _0x511f68;console[_0x33a3(0x1b)](_0x24f96d['Lhgmv']),console[_0x33a3(0x1b)](_0x24f96d['VvjgQ'],_0x2b6c17),console[_0x33a3(0x1b)](_0x24f96d[_0x33a3(0x1c)],_0x299ae7['total_matches']),console[_0x33a3(0x1b)](_0x24f96d[_0x33a3(0x1d)],_0x299ae7['total_chats']),console[_0x33a3(0x1b)](_0x33a3(0x1e),_0x299ae7[_0x33a3(0x1f)]);if(!_0x2b6c17)return console[_0x33a3(0x20)]('❌\x20[HINGE_EXTRACTOR]\x20Username\x20is\x20required'),_reactNative[_0x33a3(0x18)]['alert'](_0x33a3(0x9),_0x33a3(0xa),[{'text':'OK','style':_0x33a3(0x21)}]),![];if((!_0x299ae7['matches']||_0x299ae7[_0x33a3(0x22)][_0x33a3(0x23)]===0x0)&&(!_0x299ae7[_0x33a3(0x24)]||_0x24f96d[_0x33a3(0x25)](_0x299ae7[_0x33a3(0x24)][_0x33a3(0x23)],0x0)))return _0x24f96d[_0x33a3(0x26)]!==_0x24f96d['hufhc']?(console['log'](_0x24f96d[_0x33a3(0x27)]),!![]):(_0x224b1b[_0x33a3(0x1b)](_0x24f96d[_0x33a3(0x27)]),!![]);const _0x4444d9=(_0x299ae7['chats']||[])[_0x33a3(0x28)](_0x14dc2f=>{const _0x2058ad={'bJoEA':_0x24f96d[_0x33a3(0x29)],'KHncN':_0x33a3(0x2a),'IsfEK':_0x24f96d[_0x33a3(0x2b)],'WGCzG':_0x33a3(0x21)};if(_0x33a3(0x2c)!==_0x24f96d[_0x33a3(0x2d)]){const _0x305b04=_0x14dc2f[_0x33a3(0x2e)]&&Array['isArray'](_0x14dc2f[_0x33a3(0x2f)])&&_0x24f96d[_0x33a3(0x30)](_0x14dc2f[_0x33a3(0x2f)][_0x33a3(0x23)],0x0);return!_0x305b04&&(_0x24f96d[_0x33a3(0x31)](_0x24f96d[_0x33a3(0x32)],_0x24f96d[_0x33a3(0x32)])?_0x4c1bdd[_0x33a3(0x33)](_0x33a3(0x34),_0x30d43d):console[_0x33a3(0x33)](_0x33a3(0x34),_0x14dc2f)),_0x305b04;}else return _0x26efd8['error'](_0x2058ad[_0x33a3(0x35)],_0x31875b[_0x33a3(0x20)]),_0x4a3877[_0x33a3(0x18)][_0x33a3(0x19)](_0x2058ad[_0x33a3(0x36)],_0x1ca1f5[_0x33a3(0x20)]||_0x2058ad[_0x33a3(0x37)],[{'text':'OK','style':_0x2058ad[_0x33a3(0x38)]}]),![];});if(_0x24f96d[_0x33a3(0x39)](_0x4444d9[_0x33a3(0x23)],((_0x511f68=_0x299ae7[_0x33a3(0x24)])===null||_0x24f96d[_0x33a3(0x25)](_0x511f68,void 0x0)?void 0x0:_0x511f68[_0x33a3(0x23)])||0x0)){var _0x3a6c0a;console[_0x33a3(0x33)](_0x33a3(0x3a)+_0x24f96d[_0x33a3(0x3b)]((_0x24f96d[_0x33a3(0x3c)](_0x3a6c0a=_0x299ae7[_0x33a3(0x24)],null)||_0x3a6c0a===void 0x0?void 0x0:_0x3a6c0a[_0x33a3(0x23)])||0x0,_0x4444d9[_0x33a3(0x23)])+'\x20invalid\x20chats');}try{if(_0x24f96d['yVNdf'](_0x24f96d['ClZYs'],_0x24f96d[_0x33a3(0x3d)])){console[_0x33a3(0x1b)](_0x24f96d[_0x33a3(0x3e)]);const _0x402f4a=await(0x0,_hingeDataService[_0x33a3(0x3f)])(_0x2b6c17,{'matches':_0x299ae7['matches']||[],'chats':_0x4444d9});return _0x402f4a[_0x33a3(0x40)]?_0x24f96d[_0x33a3(0x41)](_0x24f96d[_0x33a3(0x42)],_0x24f96d[_0x33a3(0x42)])?(console[_0x33a3(0x1b)](_0x24f96d[_0x33a3(0x43)]),console[_0x33a3(0x1b)](_0x24f96d[_0x33a3(0x44)],_0x402f4a[_0x33a3(0x45)]),!![]):(_0xa4a067[_0x33a3(0x20)](_0x24f96d[_0x33a3(0x46)],_0x368832),_0x32fe54[_0x33a3(0x18)][_0x33a3(0x19)](_0x24f96d['KDttg'],_0x33a3(0x11),[{'text':'OK','style':_0x24f96d[_0x33a3(0x15)]}]),![]):_0x24f96d[_0x33a3(0x41)](_0x24f96d[_0x33a3(0x47)],_0x24f96d[_0x33a3(0x47)])?(console[_0x33a3(0x20)](_0x24f96d[_0x33a3(0x29)],_0x402f4a[_0x33a3(0x20)]),_reactNative['Alert'][_0x33a3(0x19)](_0x33a3(0x2a),_0x402f4a[_0x33a3(0x20)]||_0x33a3(0x48),[{'text':'OK','style':_0x24f96d[_0x33a3(0x15)]}]),![]):(_0x281124['log'](_0x24f96d[_0x33a3(0x43)]),_0x23278d[_0x33a3(0x1b)](_0x24f96d[_0x33a3(0x44)],_0x1ab174[_0x33a3(0x45)]),!![]);}else{var _0x38499e;_0x354c9e[_0x33a3(0x33)](_0x33a3(0x3a)+(((_0x24f96d[_0x33a3(0x3c)](_0x38499e=_0xf7cf60[_0x33a3(0x24)],null)||_0x38499e===void 0x0?void 0x0:_0x38499e['length'])||0x0)-_0x51184c[_0x33a3(0x23)])+_0x33a3(0x49));}}catch(_0x118109){return console[_0x33a3(0x20)](_0x24f96d[_0x33a3(0x46)],_0x118109),_reactNative[_0x33a3(0x18)][_0x33a3(0x19)](_0x24f96d[_0x33a3(0x4a)],_0x24f96d[_0x33a3(0x4b)],[{'text':'OK','style':_0x24f96d[_0x33a3(0x15)]}]),![];}}};return{'initiateDataExport':_0x394f39};};function _0x9c0d(){const _0x59ed27=['defineProperty','__esModule','useHingeDataExtractor','ℹ️\x20[HINGE_EXTRACTOR]\x20No\x20data\x20to\x20export\x20-\x20treating\x20as\x20success\x20(connected)','❌\x20[HINGE_EXTRACTOR]\x20Backend\x20storage\x20failed:','XTeHZ','Export\x20Error','📊\x20[HINGE_EXTRACTOR]\x20Backend\x20response:','❌\x20[HINGE_EXTRACTOR]\x20Username\x20is\x20required','Error','Username\x20is\x20required\x20to\x20export\x20Hinge\x20data.','PYpPx','RRNTL','SvTsM','cBwHv','KjWPy','XcXwD','Failed\x20to\x20connect\x20to\x20the\x20data\x20storage\x20service.\x20Please\x20check\x20your\x20network\x20connection.','mQeMH','AUaxZ','HufWQ','nyddX','Mlqrb','JFuwl','Alert','alert','Syydz','log','seFot','yUAGm','📊\x20[HINGE_EXTRACTOR]\x20Messages:','total_messages','error','default','matches','length','chats','gcYnK','onyZi','WKihy','filter','Dvkqp','Export\x20Failed','bwXuw','DJlFI','AAPHX','match_id','user_messages','fNbVV','OtScX','AeWEr','warn','⚠️\x20[HINGE_EXTRACTOR]\x20Invalid\x20chat:','bJoEA','KHncN','IsfEK','WGCzG','mCjWw','⚠️\x20[HINGE_EXTRACTOR]\x20Filtered\x20out\x20','bpZyt','qlngW','JUTsl','JuUuD','storeHingeData','success','MXKCU','vkPDE','MywPf','BTmQj','data','MAbIq','DgRhX','An\x20unknown\x20error\x20occurred\x20during\x20data\x20storage.','\x20invalid\x20chats','KDttg','FmtGN'];_0x9c0d=function(){return _0x59ed27;};return _0x9c0d();}function _0x33a3(_0x9c0d1c,_0x33a3e1){_0x9c0d1c=_0x9c0d1c-0x0;const _0x5a70b2=_0x9c0d();let _0x122e33=_0x5a70b2[_0x9c0d1c];return _0x122e33;}exports[_0x33a3(0x2)]=useHingeDataExtractor;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useHingeDataExtractor = void 0;
7
+ var _hingeDataService = require("./hingeDataService");
8
+ var _reactNative = require("react-native");
9
+ /**
10
+ * Hinge Data Extractor
11
+ *
12
+ * Orchestrates the Hinge data export flow:
13
+ * 1. Receives extracted matches/chats from WebView
14
+ * 2. Validates and formats data
15
+ * 3. Sends to backend via hingeDataService
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 Hinge export data from WebView
24
+ */
25
+
26
+ /**
27
+ * Hook for Hinge data extraction operations
28
+ */
29
+ const useHingeDataExtractor = () => {
30
+ /**
31
+ * Initiate data export to backend
32
+ *
33
+ * @param username - User identifier
34
+ * @param data - Extracted Hinge data (matches and chats)
35
+ * @returns true if successful, false otherwise
36
+ */
37
+ const initiateDataExport = async (username, data) => {
38
+ var _data$chats;
39
+ console.log('🚀 [HINGE_EXTRACTOR] Initiating data export');
40
+ console.log('👤 [HINGE_EXTRACTOR] Username:', username);
41
+ console.log('📊 [HINGE_EXTRACTOR] Matches:', data.total_matches);
42
+ console.log('📊 [HINGE_EXTRACTOR] Chats:', data.total_chats);
43
+ console.log('📊 [HINGE_EXTRACTOR] Messages:', data.total_messages);
44
+
45
+ // Validation
46
+ if (!username) {
47
+ console.error('❌ [HINGE_EXTRACTOR] Username is required');
48
+ _reactNative.Alert.alert('Error', 'Username is required to export Hinge data.', [{
49
+ text: 'OK',
50
+ style: 'default'
51
+ }]);
52
+ return false;
53
+ }
54
+
55
+ // Handle empty data as success - user might be new
56
+ if ((!data.matches || data.matches.length === 0) && (!data.chats || data.chats.length === 0)) {
57
+ console.log('ℹ️ [HINGE_EXTRACTOR] No data to export - treating as success (connected)');
58
+ return true;
59
+ }
60
+
61
+ // Validate chat structure
62
+ const validChats = (data.chats || []).filter(chat => {
63
+ const isValid = chat.match_id && Array.isArray(chat.user_messages) && chat.user_messages.length > 0;
64
+ if (!isValid) {
65
+ console.warn('⚠️ [HINGE_EXTRACTOR] Invalid chat:', chat);
66
+ }
67
+ return isValid;
68
+ });
69
+ if (validChats.length < (((_data$chats = data.chats) === null || _data$chats === void 0 ? void 0 : _data$chats.length) || 0)) {
70
+ var _data$chats2;
71
+ console.warn(`⚠️ [HINGE_EXTRACTOR] Filtered out ${(((_data$chats2 = data.chats) === null || _data$chats2 === void 0 ? void 0 : _data$chats2.length) || 0) - validChats.length} invalid chats`);
72
+ }
73
+ try {
74
+ console.log('📡 [HINGE_EXTRACTOR] Sending to backend...');
75
+ const result = await (0, _hingeDataService.storeHingeData)(username, {
76
+ matches: data.matches || [],
77
+ chats: validChats
78
+ });
79
+ if (result.success) {
80
+ console.log('✅ [HINGE_EXTRACTOR] Export completed successfully');
81
+ console.log('📊 [HINGE_EXTRACTOR] Backend response:', result.data);
82
+ return true;
83
+ } else {
84
+ console.error('❌ [HINGE_EXTRACTOR] Backend storage failed:', result.error);
85
+ _reactNative.Alert.alert('Export Failed', result.error || 'An unknown error occurred during data storage.', [{
86
+ text: 'OK',
87
+ style: 'default'
88
+ }]);
89
+ return false;
90
+ }
91
+ } catch (error) {
92
+ console.error('❌ [HINGE_EXTRACTOR] Unexpected error during export:', error);
93
+ _reactNative.Alert.alert('Export Error', 'Failed to connect to the data storage service. Please check your network connection.', [{
94
+ text: 'OK',
95
+ style: 'default'
96
+ }]);
97
+ return false;
98
+ }
99
+ };
100
+ return {
101
+ initiateDataExport
102
+ };
103
+ };
104
+ exports.useHingeDataExtractor = useHingeDataExtractor;
105
+ //# sourceMappingURL=hingeDataExtractor.js.map
@@ -1,9 +1,150 @@
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['defineProperty'](exports,_0x3e63(0x0),{'value':!![]}),exports[_0x3e63(0x1)]=void 0x0;function _0x3e63(_0x4e0713,_0x3e63ea){_0x4e0713=_0x4e0713-0x0;const _0x3ab5b1=_0x4e07();let _0x1a5e99=_0x3ab5b1[_0x4e0713];return _0x1a5e99;}function _0x4e07(){const _0x20e033=['__esModule','storeHingeData','❌\x20[HINGE_SERVICE]\x20Invalid\x20input:\x20userId\x20missing','🚀\x20[HINGE_SERVICE]\x20Storing\x20Hinge\x20data\x20for:','📊\x20[HINGE_SERVICE]\x20Matches:','📊\x20[HINGE_SERVICE]\x20Total\x20user\x20messages:','onairos_jwt_token','enoch_token','uhVkI','❌\x20[HINGE_SERVICE]\x20No\x20auth\x20token\x20found','ios','17.0','iPhone','mobile-hinge','dating','📡\x20[HINGE_SERVICE]\x20Sending\x20to\x20backend...','Unknown\x20error','NJtda','log','ZFDia','matches','length','PSTCb','chats','fiGSZ','reduce','user_messages','xXGhH','Invalid\x20input:\x20userId\x20missing.','default','getItem','vnQiG','vIJVC','UVZEz','Authentication\x20token\x20not\x20found.\x20Please\x20log\x20in\x20again.','🔑\x20[HINGE_SERVICE]\x20Auth\x20token\x20found','Platform','aKuhf','uQwPr','GEpKo','Android','toISOString','AWNQl','match_id','map','-msg-','content','timestamp','user','total_messages','WWxvh','📍\x20[HINGE_SERVICE]\x20URL:','API_CONFIG','BASE_URL','/platform-data/store','tORiN','Bearer\x20','OnairosSDK/1.0.0\x20(','stringify','json','zJpga','message','⚠️\x20[HINGE_SERVICE]\x20Backend\x20returned\x20status:\x20','warn','⚠️\x20[HINGE_SERVICE]\x20Error:\x20','error','HTTP\x20','status','xeGvA','qukyk','plUkO','❌\x20[HINGE_SERVICE]\x20Network\x20error:','buUyt'];_0x4e07=function(){return _0x20e033;};return _0x4e07();}var _api=__ONAIROS_REQ_FUNC__(0x0),_asyncStorage=_interopRequireDefault(__ONAIROS_REQ_FUNC__(0x1)),_reactNative=__ONAIROS_REQ_FUNC__(0x2);function _interopRequireDefault(_0x296fd1){return _0x296fd1&&_0x296fd1[_0x3e63(0x0)]?_0x296fd1:{'default':_0x296fd1};}const storeHingeData=async(_0x25105a,_0x492ffb)=>{const _0xb2b95c={'xXGhH':_0x3e63(0x2),'kxrOP':_0x3e63(0x3),'ZFDia':_0x3e63(0x4),'PSTCb':'📊\x20[HINGE_SERVICE]\x20Chats:','fiGSZ':_0x3e63(0x5),'vnQiG':_0x3e63(0x6),'vIJVC':_0x3e63(0x7),'UVZEz':_0x3e63(0x8),'mpNIa':_0x3e63(0x9),'eeSGi':'1.0.0','xeGvA':function(_0x1e8f6c,_0x56a41c){return _0x1e8f6c===_0x56a41c;},'aKuhf':_0x3e63(0xa),'uQwPr':_0x3e63(0xb),'GEpKo':_0x3e63(0xc),'JYRCc':_0x3e63(0xd),'AWNQl':_0x3e63(0xe),'WWxvh':_0x3e63(0xf),'tORiN':function(_0x545fdf,_0x201d31,_0x46b1ee){return _0x545fdf(_0x201d31,_0x46b1ee);},'zJpga':'✅\x20[HINGE_SERVICE]\x20Successfully\x20stored\x20Hinge\x20data','uOkGv':_0x3e63(0x10),'qukyk':_0x3e63(0x11),'plUkO':'aDAHj','buUyt':'Network\x20error.\x20Please\x20check\x20your\x20connection.'};console[_0x3e63(0x12)](_0xb2b95c['kxrOP'],_0x25105a),console['log'](_0xb2b95c[_0x3e63(0x13)],_0x492ffb[_0x3e63(0x14)][_0x3e63(0x15)]),console[_0x3e63(0x12)](_0xb2b95c[_0x3e63(0x16)],_0x492ffb[_0x3e63(0x17)][_0x3e63(0x15)]),console[_0x3e63(0x12)](_0xb2b95c[_0x3e63(0x18)],_0x492ffb[_0x3e63(0x17)][_0x3e63(0x19)]((_0x386699,_0x352743)=>_0x386699+_0x352743[_0x3e63(0x1a)][_0x3e63(0x15)],0x0));if(!_0x25105a)return console['error'](_0xb2b95c[_0x3e63(0x1b)]),{'success':![],'error':_0x3e63(0x1c)};try{const _0xc86732=await _asyncStorage[_0x3e63(0x1d)][_0x3e63(0x1e)](_0xb2b95c[_0x3e63(0x1f)])||await _asyncStorage[_0x3e63(0x1d)][_0x3e63(0x1e)](_0xb2b95c[_0x3e63(0x20)])||await _asyncStorage[_0x3e63(0x1d)]['getItem']('auth_token');if(!_0xc86732)return _0xb2b95c[_0x3e63(0x21)]!==_0x3e63(0x8)?(_0x3add16['error'](_0xb2b95c[_0x3e63(0x1b)]),{'success':![],'error':_0x3e63(0x1c)}):(console['error'](_0xb2b95c['mpNIa']),{'success':![],'error':_0x3e63(0x22)});console[_0x3e63(0x12)](_0x3e63(0x23));const _0x1b55dc={'platform':_reactNative['Platform']['OS'],'appVersion':_0xb2b95c['eeSGi'],'osVersion':_0xb2b95c['xeGvA'](_reactNative[_0x3e63(0x24)]['OS'],_0xb2b95c[_0x3e63(0x25)])?_0xb2b95c[_0x3e63(0x26)]:_reactNative['Platform']['OS'],'deviceModel':_0xb2b95c['xeGvA'](_reactNative[_0x3e63(0x24)]['OS'],_0xb2b95c['aKuhf'])?_0xb2b95c[_0x3e63(0x27)]:_0x3e63(0x28),'isOfflineSync':![],'extractedAt':new Date()[_0x3e63(0x29)]()},_0x14ff0b={'platform':_0xb2b95c['JYRCc'],'dataType':_0xb2b95c[_0x3e63(0x2a)],'data':{'matches':_0x492ffb['matches'],'chats':_0x492ffb[_0x3e63(0x17)]['map'](_0x29852b=>({'matchId':_0x29852b[_0x3e63(0x2b)],'matchName':_0x29852b['match_name'],'messages':_0x29852b['user_messages'][_0x3e63(0x2c)]((_0x11b65a,_0x4f540a)=>({'id':_0x29852b[_0x3e63(0x2b)]+_0x3e63(0x2d)+_0x4f540a,'content':_0x11b65a[_0x3e63(0x2e)],'timestamp':_0x11b65a[_0x3e63(0x2f)]||new Date()[_0x3e63(0x29)](),'role':_0x3e63(0x30)})),'totalMessages':_0x29852b[_0x3e63(0x31)]}))},'summary':{'matchCount':_0x492ffb[_0x3e63(0x14)][_0x3e63(0x15)],'chatCount':_0x492ffb[_0x3e63(0x17)][_0x3e63(0x15)],'totalUserMessages':_0x492ffb[_0x3e63(0x17)][_0x3e63(0x19)]((_0xb86c5f,_0xc34c5a)=>_0xb86c5f+_0xc34c5a[_0x3e63(0x1a)][_0x3e63(0x15)],0x0)},'mobileMetadata':_0x1b55dc};console[_0x3e63(0x12)](_0xb2b95c[_0x3e63(0x32)]),console[_0x3e63(0x12)](_0x3e63(0x33),_api[_0x3e63(0x34)][_0x3e63(0x35)]+_0x3e63(0x36));const _0x555df3=await _0xb2b95c[_0x3e63(0x37)](fetch,_api[_0x3e63(0x34)]['BASE_URL']+'/platform-data/store',{'method':'POST','headers':{'Content-Type':'application/json','Authorization':_0x3e63(0x38)+_0xc86732,'User-Agent':_0x3e63(0x39)+_reactNative[_0x3e63(0x24)]['OS']+')'},'body':JSON[_0x3e63(0x3a)](_0x14ff0b)}),_0x4998d1=await _0x555df3[_0x3e63(0x3b)]();return _0x555df3['ok']?(console[_0x3e63(0x12)](_0xb2b95c[_0x3e63(0x3c)]),_0x4998d1[_0x3e63(0x3d)]&&console[_0x3e63(0x12)]('📝\x20[HINGE_SERVICE]\x20Backend\x20response:\x20'+_0x4998d1[_0x3e63(0x3d)]),{'success':!![],'message':_0x4998d1['message']||'Hinge\x20data\x20stored\x20successfully','data':_0x4998d1['data']}):(console['warn'](_0x3e63(0x3e)+_0x555df3['status']),console[_0x3e63(0x3f)](_0x3e63(0x40)+(_0x4998d1[_0x3e63(0x41)]||_0xb2b95c['uOkGv'])),{'success':![],'error':_0x4998d1[_0x3e63(0x41)]||_0x3e63(0x42)+_0x555df3[_0x3e63(0x43)]});}catch(_0x268c3d){return _0xb2b95c[_0x3e63(0x44)](_0xb2b95c[_0x3e63(0x45)],_0xb2b95c[_0x3e63(0x46)])?_0x4575cd&&_0x1a4467[_0x3e63(0x0)]?_0x176164:{'default':_0x20af6a}:(console['error'](_0x3e63(0x47),_0x268c3d),{'success':![],'error':_0x268c3d[_0x3e63(0x3d)]||_0xb2b95c[_0x3e63(0x48)]});}};exports[_0x3e63(0x1)]=storeHingeData;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.storeHingeData = 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
+ * Hinge Data Service
13
+ *
14
+ * API layer for storing Hinge data on backend.
15
+ * Sends extracted matches and chats to /platform-data/store endpoint.
16
+ *
17
+ * MATCHES ChatGPT implementation pattern
18
+ * - Sends data in batches
19
+ * - Uses format: { platform, data, metadata }
20
+ * - Platform: "mobile-hinge"
21
+ */
22
+
23
+ /**
24
+ * Structure of a single message in a chat
25
+ */
26
+
27
+ /**
28
+ * Structure of chat data extracted from Hinge
29
+ */
30
+
31
+ /**
32
+ * Structure of match data extracted from Hinge
33
+ */
34
+
35
+ /**
36
+ * Combined Hinge data to store
37
+ */
38
+
39
+ /**
40
+ * Response from backend endpoint
41
+ */
42
+
43
+ /**
44
+ * Store Hinge data on backend
45
+ *
46
+ * @param userId - Username or identifier
47
+ * @param data - Hinge matches and chat data
48
+ * @returns Response indicating success/failure with metadata
49
+ */
50
+ const storeHingeData = async (userId, data) => {
51
+ console.log('🚀 [HINGE_SERVICE] Storing Hinge data for:', userId);
52
+ console.log('📊 [HINGE_SERVICE] Matches:', data.matches.length);
53
+ console.log('📊 [HINGE_SERVICE] Chats:', data.chats.length);
54
+ console.log('📊 [HINGE_SERVICE] Total user messages:', data.chats.reduce((sum, c) => sum + c.user_messages.length, 0));
55
+
56
+ // Input validation
57
+ if (!userId) {
58
+ console.error('❌ [HINGE_SERVICE] Invalid input: userId missing');
59
+ return {
60
+ success: false,
61
+ error: 'Invalid input: userId missing.'
62
+ };
63
+ }
64
+ try {
65
+ // Get auth token - check all possible storage keys
66
+ const authToken = (await _asyncStorage.default.getItem('onairos_jwt_token')) || (await _asyncStorage.default.getItem('enoch_token')) || (await _asyncStorage.default.getItem('auth_token'));
67
+ if (!authToken) {
68
+ console.error('❌ [HINGE_SERVICE] No auth token found');
69
+ return {
70
+ success: false,
71
+ error: 'Authentication token not found. Please log in again.'
72
+ };
73
+ }
74
+ console.log('🔑 [HINGE_SERVICE] Auth token found');
75
+
76
+ // Mobile metadata
77
+ const mobileMetadata = {
78
+ platform: _reactNative.Platform.OS,
79
+ appVersion: '1.0.0',
80
+ osVersion: _reactNative.Platform.OS === 'ios' ? '17.0' : _reactNative.Platform.OS,
81
+ deviceModel: _reactNative.Platform.OS === 'ios' ? 'iPhone' : 'Android',
82
+ isOfflineSync: false,
83
+ extractedAt: new Date().toISOString()
84
+ };
85
+
86
+ // Build request body
87
+ const requestBody = {
88
+ platform: 'mobile-hinge',
89
+ dataType: 'dating',
90
+ data: {
91
+ matches: data.matches,
92
+ chats: data.chats.map(chat => ({
93
+ matchId: chat.match_id,
94
+ matchName: chat.match_name,
95
+ messages: chat.user_messages.map((msg, idx) => ({
96
+ id: `${chat.match_id}-msg-${idx}`,
97
+ content: msg.content,
98
+ timestamp: msg.timestamp || new Date().toISOString(),
99
+ role: 'user'
100
+ })),
101
+ totalMessages: chat.total_messages
102
+ }))
103
+ },
104
+ summary: {
105
+ matchCount: data.matches.length,
106
+ chatCount: data.chats.length,
107
+ totalUserMessages: data.chats.reduce((sum, c) => sum + c.user_messages.length, 0)
108
+ },
109
+ mobileMetadata: mobileMetadata
110
+ };
111
+ console.log('📡 [HINGE_SERVICE] Sending to backend...');
112
+ console.log('📍 [HINGE_SERVICE] URL:', `${_api.API_CONFIG.BASE_URL}/platform-data/store`);
113
+ const response = await fetch(`${_api.API_CONFIG.BASE_URL}/platform-data/store`, {
114
+ method: 'POST',
115
+ headers: {
116
+ 'Content-Type': 'application/json',
117
+ 'Authorization': `Bearer ${authToken}`,
118
+ 'User-Agent': `OnairosSDK/1.0.0 (${_reactNative.Platform.OS})`
119
+ },
120
+ body: JSON.stringify(requestBody)
121
+ });
122
+ const responseData = await response.json();
123
+ if (response.ok) {
124
+ console.log('✅ [HINGE_SERVICE] Successfully stored Hinge data');
125
+ if (responseData.message) {
126
+ console.log(`📝 [HINGE_SERVICE] Backend response: ${responseData.message}`);
127
+ }
128
+ return {
129
+ success: true,
130
+ message: responseData.message || 'Hinge data stored successfully',
131
+ data: responseData.data
132
+ };
133
+ } else {
134
+ console.warn(`⚠️ [HINGE_SERVICE] Backend returned status: ${response.status}`);
135
+ console.warn(`⚠️ [HINGE_SERVICE] Error: ${responseData.error || 'Unknown error'}`);
136
+ return {
137
+ success: false,
138
+ error: responseData.error || `HTTP ${response.status}`
139
+ };
140
+ }
141
+ } catch (error) {
142
+ console.error('❌ [HINGE_SERVICE] Network error:', error);
143
+ return {
144
+ success: false,
145
+ error: error.message || 'Network error. Please check your connection.'
146
+ };
147
+ }
148
+ };
149
+ exports.storeHingeData = storeHingeData;
150
+ //# sourceMappingURL=hingeDataService.js.map