@oxyhq/services 5.5.9 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (393) hide show
  1. package/README.md +16 -2
  2. package/lib/commonjs/core/index.js +69 -82
  3. package/lib/commonjs/core/index.js.map +1 -1
  4. package/lib/commonjs/index.js +24 -183
  5. package/lib/commonjs/index.js.map +1 -1
  6. package/lib/commonjs/node/index.js +0 -2
  7. package/lib/commonjs/node/index.js.map +1 -1
  8. package/lib/commonjs/ui/components/FollowButton.js +100 -229
  9. package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
  10. package/lib/commonjs/ui/components/OxyPayButton.js +131 -0
  11. package/lib/commonjs/ui/components/OxyPayButton.js.map +1 -0
  12. package/lib/commonjs/ui/components/OxyProvider.js +41 -198
  13. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  14. package/lib/commonjs/ui/components/OxySignInButton.js +15 -2
  15. package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
  16. package/lib/commonjs/ui/components/icon/FAIRWalletIcon.js +66 -0
  17. package/lib/commonjs/ui/components/icon/FAIRWalletIcon.js.map +1 -0
  18. package/lib/commonjs/ui/components/icon/index.js +7 -0
  19. package/lib/commonjs/ui/components/icon/index.js.map +1 -1
  20. package/lib/commonjs/ui/components/index.js +7 -0
  21. package/lib/commonjs/ui/components/index.js.map +1 -1
  22. package/lib/commonjs/ui/components/internal/GroupedPillButtons.js +14 -7
  23. package/lib/commonjs/ui/components/internal/GroupedPillButtons.js.map +1 -1
  24. package/lib/commonjs/ui/components/internal/PinInput.js +108 -0
  25. package/lib/commonjs/ui/components/internal/PinInput.js.map +1 -0
  26. package/lib/commonjs/ui/components/internal/TextField.js +20 -0
  27. package/lib/commonjs/ui/components/internal/TextField.js.map +1 -1
  28. package/lib/commonjs/ui/context/OxyContext.js +26 -36
  29. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  30. package/lib/commonjs/ui/hooks/index.js +2 -15
  31. package/lib/commonjs/ui/hooks/index.js.map +1 -1
  32. package/lib/commonjs/ui/hooks/useFollow.js +52 -136
  33. package/lib/commonjs/ui/hooks/useFollow.js.map +1 -1
  34. package/lib/commonjs/ui/hooks/useSessionSocket.js +52 -0
  35. package/lib/commonjs/ui/hooks/useSessionSocket.js.map +1 -0
  36. package/lib/commonjs/ui/index.js +8 -191
  37. package/lib/commonjs/ui/index.js.map +1 -1
  38. package/lib/commonjs/ui/navigation/OxyRouter.js +52 -60
  39. package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -1
  40. package/lib/commonjs/ui/screens/AccountCenterScreen.js +18 -30
  41. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
  42. package/lib/commonjs/ui/screens/AccountOverviewScreen.js +4 -22
  43. package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
  44. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +6 -14
  45. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  46. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +37 -66
  47. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
  48. package/lib/commonjs/ui/screens/AppInfoScreen.js +21 -44
  49. package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
  50. package/lib/commonjs/ui/screens/FeedbackScreen.js +44 -23
  51. package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
  52. package/lib/commonjs/ui/screens/FileManagementScreen.js +59 -78
  53. package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
  54. package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +1588 -0
  55. package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -0
  56. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +22 -36
  57. package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  58. package/lib/commonjs/ui/screens/RecoverAccountScreen.js +269 -0
  59. package/lib/commonjs/ui/screens/RecoverAccountScreen.js.map +1 -0
  60. package/lib/commonjs/ui/screens/SessionManagementScreen.js +47 -69
  61. package/lib/commonjs/ui/screens/SessionManagementScreen.js.map +1 -1
  62. package/lib/commonjs/ui/screens/SignInScreen.js +99 -333
  63. package/lib/commonjs/ui/screens/SignInScreen.js.map +1 -1
  64. package/lib/commonjs/ui/screens/SignUpScreen.js +136 -340
  65. package/lib/commonjs/ui/screens/SignUpScreen.js.map +1 -1
  66. package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js +192 -0
  67. package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js.map +1 -0
  68. package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js +135 -0
  69. package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js.map +1 -0
  70. package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js +108 -0
  71. package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js.map +1 -0
  72. package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js +126 -0
  73. package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js.map +1 -0
  74. package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js +84 -0
  75. package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js.map +1 -0
  76. package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js +59 -0
  77. package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js.map +1 -0
  78. package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js +15 -2
  79. package/lib/commonjs/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
  80. package/lib/commonjs/ui/stores/authStore.js +31 -0
  81. package/lib/commonjs/ui/stores/authStore.js.map +1 -0
  82. package/lib/commonjs/ui/stores/followStore.js +124 -0
  83. package/lib/commonjs/ui/stores/followStore.js.map +1 -0
  84. package/lib/commonjs/ui/styles/index.js +0 -11
  85. package/lib/commonjs/ui/styles/index.js.map +1 -1
  86. package/lib/commonjs/ui/utils/confirmAction.js +28 -0
  87. package/lib/commonjs/ui/utils/confirmAction.js.map +1 -0
  88. package/lib/module/core/index.js +69 -81
  89. package/lib/module/core/index.js.map +1 -1
  90. package/lib/module/index.js +14 -17
  91. package/lib/module/index.js.map +1 -1
  92. package/lib/module/node/index.js +0 -3
  93. package/lib/module/node/index.js.map +1 -1
  94. package/lib/module/ui/components/FollowButton.js +100 -229
  95. package/lib/module/ui/components/FollowButton.js.map +1 -1
  96. package/lib/module/ui/components/OxyPayButton.js +125 -0
  97. package/lib/module/ui/components/OxyPayButton.js.map +1 -0
  98. package/lib/module/ui/components/OxyProvider.js +42 -199
  99. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  100. package/lib/module/ui/components/OxySignInButton.js +15 -2
  101. package/lib/module/ui/components/OxySignInButton.js.map +1 -1
  102. package/lib/module/ui/components/icon/FAIRWalletIcon.js +60 -0
  103. package/lib/module/ui/components/icon/FAIRWalletIcon.js.map +1 -0
  104. package/lib/module/ui/components/icon/index.js +1 -0
  105. package/lib/module/ui/components/icon/index.js.map +1 -1
  106. package/lib/module/ui/components/index.js +1 -0
  107. package/lib/module/ui/components/index.js.map +1 -1
  108. package/lib/module/ui/components/internal/GroupedPillButtons.js +15 -8
  109. package/lib/module/ui/components/internal/GroupedPillButtons.js.map +1 -1
  110. package/lib/module/ui/components/internal/PinInput.js +103 -0
  111. package/lib/module/ui/components/internal/PinInput.js.map +1 -0
  112. package/lib/module/ui/components/internal/TextField.js +20 -0
  113. package/lib/module/ui/components/internal/TextField.js.map +1 -1
  114. package/lib/module/ui/context/OxyContext.js +26 -36
  115. package/lib/module/ui/context/OxyContext.js.map +1 -1
  116. package/lib/module/ui/hooks/index.js +1 -2
  117. package/lib/module/ui/hooks/index.js.map +1 -1
  118. package/lib/module/ui/hooks/useFollow.js +52 -137
  119. package/lib/module/ui/hooks/useFollow.js.map +1 -1
  120. package/lib/module/ui/hooks/useSessionSocket.js +47 -0
  121. package/lib/module/ui/hooks/useSessionSocket.js.map +1 -0
  122. package/lib/module/ui/index.js +2 -13
  123. package/lib/module/ui/index.js.map +1 -1
  124. package/lib/module/ui/navigation/OxyRouter.js +53 -61
  125. package/lib/module/ui/navigation/OxyRouter.js.map +1 -1
  126. package/lib/module/ui/screens/AccountCenterScreen.js +6 -18
  127. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
  128. package/lib/module/ui/screens/AccountOverviewScreen.js +5 -23
  129. package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
  130. package/lib/module/ui/screens/AccountSettingsScreen.js +7 -15
  131. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  132. package/lib/module/ui/screens/AccountSwitcherScreen.js +38 -67
  133. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  134. package/lib/module/ui/screens/AppInfoScreen.js +22 -45
  135. package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
  136. package/lib/module/ui/screens/FeedbackScreen.js +44 -23
  137. package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
  138. package/lib/module/ui/screens/FileManagementScreen.js +59 -78
  139. package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
  140. package/lib/module/ui/screens/PaymentGatewayScreen.js +1583 -0
  141. package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -0
  142. package/lib/module/ui/screens/PremiumSubscriptionScreen.js +23 -37
  143. package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
  144. package/lib/module/ui/screens/RecoverAccountScreen.js +263 -0
  145. package/lib/module/ui/screens/RecoverAccountScreen.js.map +1 -0
  146. package/lib/module/ui/screens/SessionManagementScreen.js +47 -69
  147. package/lib/module/ui/screens/SessionManagementScreen.js.map +1 -1
  148. package/lib/module/ui/screens/SignInScreen.js +100 -334
  149. package/lib/module/ui/screens/SignInScreen.js.map +1 -1
  150. package/lib/module/ui/screens/SignUpScreen.js +137 -341
  151. package/lib/module/ui/screens/SignUpScreen.js.map +1 -1
  152. package/lib/module/ui/screens/internal/SignInPasswordStep.js +186 -0
  153. package/lib/module/ui/screens/internal/SignInPasswordStep.js.map +1 -0
  154. package/lib/module/ui/screens/internal/SignInUsernameStep.js +129 -0
  155. package/lib/module/ui/screens/internal/SignInUsernameStep.js.map +1 -0
  156. package/lib/module/ui/screens/internal/SignUpIdentityStep.js +102 -0
  157. package/lib/module/ui/screens/internal/SignUpIdentityStep.js.map +1 -0
  158. package/lib/module/ui/screens/internal/SignUpSecurityStep.js +120 -0
  159. package/lib/module/ui/screens/internal/SignUpSecurityStep.js.map +1 -0
  160. package/lib/module/ui/screens/internal/SignUpSummaryStep.js +79 -0
  161. package/lib/module/ui/screens/internal/SignUpSummaryStep.js.map +1 -0
  162. package/lib/module/ui/screens/internal/SignUpWelcomeStep.js +54 -0
  163. package/lib/module/ui/screens/internal/SignUpWelcomeStep.js.map +1 -0
  164. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js +16 -3
  165. package/lib/module/ui/screens/karma/KarmaRewardsScreen.js.map +1 -1
  166. package/lib/module/ui/stores/authStore.js +27 -0
  167. package/lib/module/ui/stores/authStore.js.map +1 -0
  168. package/lib/module/ui/stores/followStore.js +120 -0
  169. package/lib/module/ui/stores/followStore.js.map +1 -0
  170. package/lib/module/ui/styles/index.js +0 -1
  171. package/lib/module/ui/styles/index.js.map +1 -1
  172. package/lib/module/ui/utils/confirmAction.js +25 -0
  173. package/lib/module/ui/utils/confirmAction.js.map +1 -0
  174. package/lib/typescript/core/index.d.ts +28 -10
  175. package/lib/typescript/core/index.d.ts.map +1 -1
  176. package/lib/typescript/index.d.ts +5 -4
  177. package/lib/typescript/index.d.ts.map +1 -1
  178. package/lib/typescript/models/secureSession.d.ts +0 -1
  179. package/lib/typescript/models/secureSession.d.ts.map +1 -1
  180. package/lib/typescript/node/index.d.ts +0 -1
  181. package/lib/typescript/node/index.d.ts.map +1 -1
  182. package/lib/typescript/ui/components/FollowButton.d.ts +1 -77
  183. package/lib/typescript/ui/components/FollowButton.d.ts.map +1 -1
  184. package/lib/typescript/ui/components/OxyPayButton.d.ts +29 -0
  185. package/lib/typescript/ui/components/OxyPayButton.d.ts.map +1 -0
  186. package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
  187. package/lib/typescript/ui/components/OxySignInButton.d.ts.map +1 -1
  188. package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts +8 -0
  189. package/lib/typescript/ui/components/icon/FAIRWalletIcon.d.ts.map +1 -0
  190. package/lib/typescript/ui/components/icon/index.d.ts +1 -0
  191. package/lib/typescript/ui/components/icon/index.d.ts.map +1 -1
  192. package/lib/typescript/ui/components/index.d.ts +1 -0
  193. package/lib/typescript/ui/components/index.d.ts.map +1 -1
  194. package/lib/typescript/ui/components/internal/GroupedPillButtons.d.ts.map +1 -1
  195. package/lib/typescript/ui/components/internal/PinInput.d.ts +12 -0
  196. package/lib/typescript/ui/components/internal/PinInput.d.ts.map +1 -0
  197. package/lib/typescript/ui/components/internal/TextField.d.ts +1 -0
  198. package/lib/typescript/ui/components/internal/TextField.d.ts.map +1 -1
  199. package/lib/typescript/ui/context/OxyContext.d.ts +0 -2
  200. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
  201. package/lib/typescript/ui/hooks/index.d.ts +1 -2
  202. package/lib/typescript/ui/hooks/index.d.ts.map +1 -1
  203. package/lib/typescript/ui/hooks/useFollow.d.ts +14 -15
  204. package/lib/typescript/ui/hooks/useFollow.d.ts.map +1 -1
  205. package/lib/typescript/ui/hooks/useSessionSocket.d.ts +11 -0
  206. package/lib/typescript/ui/hooks/useSessionSocket.d.ts.map +1 -0
  207. package/lib/typescript/ui/index.d.ts +2 -5
  208. package/lib/typescript/ui/index.d.ts.map +1 -1
  209. package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -1
  210. package/lib/typescript/ui/navigation/types.d.ts +5 -23
  211. package/lib/typescript/ui/navigation/types.d.ts.map +1 -1
  212. package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -1
  213. package/lib/typescript/ui/screens/AccountOverviewScreen.d.ts.map +1 -1
  214. package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  215. package/lib/typescript/ui/screens/AccountSwitcherScreen.d.ts.map +1 -1
  216. package/lib/typescript/ui/screens/AppInfoScreen.d.ts.map +1 -1
  217. package/lib/typescript/ui/screens/FeedbackScreen.d.ts.map +1 -1
  218. package/lib/typescript/ui/screens/FileManagementScreen.d.ts.map +1 -1
  219. package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts +27 -0
  220. package/lib/typescript/ui/screens/PaymentGatewayScreen.d.ts.map +1 -0
  221. package/lib/typescript/ui/screens/PremiumSubscriptionScreen.d.ts.map +1 -1
  222. package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts +8 -0
  223. package/lib/typescript/ui/screens/RecoverAccountScreen.d.ts.map +1 -0
  224. package/lib/typescript/ui/screens/SessionManagementScreen.d.ts.map +1 -1
  225. package/lib/typescript/ui/screens/SignInScreen.d.ts.map +1 -1
  226. package/lib/typescript/ui/screens/SignUpScreen.d.ts.map +1 -1
  227. package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts +27 -0
  228. package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts.map +1 -0
  229. package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts +26 -0
  230. package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts.map +1 -0
  231. package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts +20 -0
  232. package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts.map +1 -0
  233. package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts +24 -0
  234. package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts.map +1 -0
  235. package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts +15 -0
  236. package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts.map +1 -0
  237. package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts +13 -0
  238. package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts.map +1 -0
  239. package/lib/typescript/ui/screens/karma/KarmaRewardsScreen.d.ts.map +1 -1
  240. package/lib/typescript/ui/stores/authStore.d.ts +14 -0
  241. package/lib/typescript/ui/stores/authStore.d.ts.map +1 -0
  242. package/lib/typescript/ui/stores/followStore.d.ts +15 -0
  243. package/lib/typescript/ui/stores/followStore.d.ts.map +1 -0
  244. package/lib/typescript/ui/styles/index.d.ts +0 -1
  245. package/lib/typescript/ui/styles/index.d.ts.map +1 -1
  246. package/lib/typescript/ui/utils/confirmAction.d.ts +7 -0
  247. package/lib/typescript/ui/utils/confirmAction.d.ts.map +1 -0
  248. package/package.json +12 -7
  249. package/src/core/index.ts +78 -88
  250. package/src/index.ts +8 -45
  251. package/src/models/secureSession.ts +1 -2
  252. package/src/node/index.ts +0 -3
  253. package/src/ui/components/FollowButton.tsx +100 -322
  254. package/src/ui/components/OxyPayButton.tsx +133 -0
  255. package/src/ui/components/OxyProvider.tsx +39 -201
  256. package/src/ui/components/OxySignInButton.tsx +13 -2
  257. package/src/ui/components/icon/FAIRWalletIcon.tsx +49 -0
  258. package/src/ui/components/icon/index.ts +1 -0
  259. package/src/ui/components/index.ts +1 -0
  260. package/src/ui/components/internal/GroupedPillButtons.tsx +12 -8
  261. package/src/ui/components/internal/PinInput.tsx +102 -0
  262. package/src/ui/components/internal/TextField.tsx +9 -0
  263. package/src/ui/context/OxyContext.tsx +26 -40
  264. package/src/ui/hooks/index.ts +1 -2
  265. package/src/ui/hooks/useFollow.ts +58 -129
  266. package/src/ui/hooks/useSessionSocket.ts +50 -0
  267. package/src/ui/index.ts +2 -37
  268. package/src/ui/navigation/OxyRouter.tsx +47 -63
  269. package/src/ui/navigation/types.ts +5 -26
  270. package/src/ui/screens/AccountCenterScreen.tsx +12 -21
  271. package/src/ui/screens/AccountOverviewScreen.tsx +6 -30
  272. package/src/ui/screens/AccountSettingsScreen.tsx +7 -22
  273. package/src/ui/screens/AccountSwitcherScreen.tsx +46 -88
  274. package/src/ui/screens/AppInfoScreen.tsx +27 -47
  275. package/src/ui/screens/FeedbackScreen.tsx +34 -19
  276. package/src/ui/screens/FileManagementScreen.tsx +293 -321
  277. package/src/ui/screens/PaymentGatewayScreen.tsx +1315 -0
  278. package/src/ui/screens/PremiumSubscriptionScreen.tsx +109 -124
  279. package/src/ui/screens/RecoverAccountScreen.tsx +260 -0
  280. package/src/ui/screens/SessionManagementScreen.tsx +65 -137
  281. package/src/ui/screens/SignInScreen.tsx +89 -283
  282. package/src/ui/screens/SignUpScreen.tsx +138 -291
  283. package/src/ui/screens/internal/SignInPasswordStep.tsx +179 -0
  284. package/src/ui/screens/internal/SignInUsernameStep.tsx +139 -0
  285. package/src/ui/screens/internal/SignUpIdentityStep.tsx +114 -0
  286. package/src/ui/screens/internal/SignUpSecurityStep.tsx +132 -0
  287. package/src/ui/screens/internal/SignUpSummaryStep.tsx +66 -0
  288. package/src/ui/screens/internal/SignUpWelcomeStep.tsx +52 -0
  289. package/src/ui/screens/karma/KarmaRewardsScreen.tsx +13 -3
  290. package/src/ui/stores/authStore.ts +24 -0
  291. package/src/ui/stores/followStore.ts +80 -0
  292. package/src/ui/styles/index.ts +0 -1
  293. package/src/ui/utils/confirmAction.ts +23 -0
  294. package/lib/commonjs/ui/components/bottomSheet/index.js +0 -37
  295. package/lib/commonjs/ui/components/bottomSheet/index.js.map +0 -1
  296. package/lib/commonjs/ui/hooks/useAuthFetch.js +0 -217
  297. package/lib/commonjs/ui/hooks/useAuthFetch.js.map +0 -1
  298. package/lib/commonjs/ui/hooks/useOxyFollow.js +0 -190
  299. package/lib/commonjs/ui/hooks/useOxyFollow.js.map +0 -1
  300. package/lib/commonjs/ui/screens/BillingManagementScreen.js +0 -636
  301. package/lib/commonjs/ui/screens/BillingManagementScreen.js.map +0 -1
  302. package/lib/commonjs/ui/store/index.js +0 -67
  303. package/lib/commonjs/ui/store/index.js.map +0 -1
  304. package/lib/commonjs/ui/store/setupOxyStore.js +0 -63
  305. package/lib/commonjs/ui/store/setupOxyStore.js.map +0 -1
  306. package/lib/commonjs/ui/store/slices/authSlice.js +0 -56
  307. package/lib/commonjs/ui/store/slices/authSlice.js.map +0 -1
  308. package/lib/commonjs/ui/store/slices/followSlice.js +0 -238
  309. package/lib/commonjs/ui/store/slices/followSlice.js.map +0 -1
  310. package/lib/commonjs/ui/store/slices/index.js +0 -129
  311. package/lib/commonjs/ui/store/slices/index.js.map +0 -1
  312. package/lib/commonjs/ui/store/slices/types.js +0 -19
  313. package/lib/commonjs/ui/store/slices/types.js.map +0 -1
  314. package/lib/commonjs/ui/styles/shadows.js +0 -123
  315. package/lib/commonjs/ui/styles/shadows.js.map +0 -1
  316. package/lib/commonjs/utils/polyfills.js +0 -42
  317. package/lib/commonjs/utils/polyfills.js.map +0 -1
  318. package/lib/module/ui/components/bottomSheet/index.js +0 -5
  319. package/lib/module/ui/components/bottomSheet/index.js.map +0 -1
  320. package/lib/module/ui/hooks/useAuthFetch.js +0 -212
  321. package/lib/module/ui/hooks/useAuthFetch.js.map +0 -1
  322. package/lib/module/ui/hooks/useOxyFollow.js +0 -186
  323. package/lib/module/ui/hooks/useOxyFollow.js.map +0 -1
  324. package/lib/module/ui/screens/BillingManagementScreen.js +0 -631
  325. package/lib/module/ui/screens/BillingManagementScreen.js.map +0 -1
  326. package/lib/module/ui/store/index.js +0 -33
  327. package/lib/module/ui/store/index.js.map +0 -1
  328. package/lib/module/ui/store/setupOxyStore.js +0 -59
  329. package/lib/module/ui/store/setupOxyStore.js.map +0 -1
  330. package/lib/module/ui/store/slices/authSlice.js +0 -48
  331. package/lib/module/ui/store/slices/authSlice.js.map +0 -1
  332. package/lib/module/ui/store/slices/followSlice.js +0 -232
  333. package/lib/module/ui/store/slices/followSlice.js.map +0 -1
  334. package/lib/module/ui/store/slices/index.js +0 -11
  335. package/lib/module/ui/store/slices/index.js.map +0 -1
  336. package/lib/module/ui/store/slices/types.js +0 -15
  337. package/lib/module/ui/store/slices/types.js.map +0 -1
  338. package/lib/module/ui/styles/shadows.js +0 -119
  339. package/lib/module/ui/styles/shadows.js.map +0 -1
  340. package/lib/module/utils/polyfills.js +0 -36
  341. package/lib/module/utils/polyfills.js.map +0 -1
  342. package/lib/typescript/types/react-redux.d.ts +0 -5
  343. package/lib/typescript/ui/components/bottomSheet/index.d.ts +0 -4
  344. package/lib/typescript/ui/components/bottomSheet/index.d.ts.map +0 -1
  345. package/lib/typescript/ui/hooks/useAuthFetch.d.ts +0 -34
  346. package/lib/typescript/ui/hooks/useAuthFetch.d.ts.map +0 -1
  347. package/lib/typescript/ui/hooks/useOxyFollow.d.ts +0 -81
  348. package/lib/typescript/ui/hooks/useOxyFollow.d.ts.map +0 -1
  349. package/lib/typescript/ui/screens/BillingManagementScreen.d.ts +0 -5
  350. package/lib/typescript/ui/screens/BillingManagementScreen.d.ts.map +0 -1
  351. package/lib/typescript/ui/store/index.d.ts +0 -27
  352. package/lib/typescript/ui/store/index.d.ts.map +0 -1
  353. package/lib/typescript/ui/store/setupOxyStore.d.ts +0 -29
  354. package/lib/typescript/ui/store/setupOxyStore.d.ts.map +0 -1
  355. package/lib/typescript/ui/store/slices/authSlice.d.ts +0 -32
  356. package/lib/typescript/ui/store/slices/authSlice.d.ts.map +0 -1
  357. package/lib/typescript/ui/store/slices/followSlice.d.ts +0 -120
  358. package/lib/typescript/ui/store/slices/followSlice.d.ts.map +0 -1
  359. package/lib/typescript/ui/store/slices/index.d.ts +0 -9
  360. package/lib/typescript/ui/store/slices/index.d.ts.map +0 -1
  361. package/lib/typescript/ui/store/slices/types.d.ts +0 -16
  362. package/lib/typescript/ui/store/slices/types.d.ts.map +0 -1
  363. package/lib/typescript/ui/styles/shadows.d.ts +0 -233
  364. package/lib/typescript/ui/styles/shadows.d.ts.map +0 -1
  365. package/lib/typescript/utils/polyfills.d.ts +0 -6
  366. package/lib/typescript/utils/polyfills.d.ts.map +0 -1
  367. package/src/__tests__/backend-middleware.test.ts +0 -209
  368. package/src/__tests__/polyfills.test.ts +0 -30
  369. package/src/__tests__/setup.ts +0 -43
  370. package/src/__tests__/ui/hooks/authfetch-integration.test.ts +0 -197
  371. package/src/__tests__/ui/hooks/backward-compatibility.test.ts +0 -159
  372. package/src/__tests__/ui/hooks/real-world-scenarios.test.ts +0 -224
  373. package/src/__tests__/ui/hooks/url-resolution.test.ts +0 -129
  374. package/src/__tests__/ui/hooks/useAuthFetch-separation.test.ts +0 -69
  375. package/src/__tests__/ui/hooks/useAuthFetch.test.ts +0 -70
  376. package/src/__tests__/ui/hooks/useOxyFollow.test.tsx +0 -92
  377. package/src/__tests__/ui/screens/AccountSettingsScreen.test.tsx +0 -112
  378. package/src/__tests__/ui/store/setupOxyStore.test.ts +0 -50
  379. package/src/__tests__/validate-structure.js +0 -91
  380. package/src/__tests__/validation.js +0 -42
  381. package/src/types/react-redux.d.ts +0 -5
  382. package/src/ui/components/bottomSheet/index.tsx +0 -14
  383. package/src/ui/hooks/useAuthFetch.ts +0 -238
  384. package/src/ui/hooks/useOxyFollow.ts +0 -188
  385. package/src/ui/screens/BillingManagementScreen.tsx +0 -589
  386. package/src/ui/store/index.ts +0 -36
  387. package/src/ui/store/setupOxyStore.ts +0 -58
  388. package/src/ui/store/slices/authSlice.ts +0 -43
  389. package/src/ui/store/slices/followSlice.ts +0 -207
  390. package/src/ui/store/slices/index.ts +0 -31
  391. package/src/ui/store/slices/types.ts +0 -33
  392. package/src/ui/styles/shadows.ts +0 -112
  393. package/src/utils/polyfills.ts +0 -34
@@ -1,53 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  import React, { useEffect, useCallback } from 'react';
4
- import { TouchableOpacity, StyleSheet, Platform, ActivityIndicator } from 'react-native';
5
- import Animated, { useSharedValue, useAnimatedStyle, withSpring, interpolateColor, Easing, withTiming } from 'react-native-reanimated';
6
- import { useDispatch, useSelector } from 'react-redux';
4
+ import { TouchableOpacity, Text, StyleSheet, ActivityIndicator } from 'react-native';
5
+ import { useSharedValue, Easing, withTiming } from 'react-native-reanimated';
7
6
  import { useOxy } from '../context/OxyContext';
8
7
  import { fontFamilies } from '../styles/fonts';
9
8
  import { toast } from '../../lib/sonner';
10
- import { toggleFollowUser, setFollowingStatus, clearFollowError, fetchFollowStatus } from '../store';
9
+ import { useFollow } from '../hooks/useFollow';
11
10
  import { jsx as _jsx } from "react/jsx-runtime";
12
- /**
13
- * An animated follow button with interactive state changes and preventDefault support
14
- * Uses Redux for state management to ensure all buttons with the same user ID stay synchronized
15
- *
16
- * @example
17
- * ```tsx
18
- * // Basic usage
19
- * <FollowButton userId="123" />
20
- *
21
- * // With custom styling
22
- * <FollowButton
23
- * userId="123"
24
- * initiallyFollowing={true}
25
- * size="large"
26
- * style={{ borderRadius: 12 }}
27
- * onFollowChange={(isFollowing) => console.log(`User is now ${isFollowing ? 'followed' : 'unfollowed'}`)}
28
- * />
29
- *
30
- * // Inside a pressable container (prevents parent actions)
31
- * <TouchableOpacity onPress={() => navigateToProfile()}>
32
- * <View>
33
- * <Text>User Profile</Text>
34
- * <FollowButton
35
- * userId="123"
36
- * preventParentActions={true} // Default: true
37
- * />
38
- * </View>
39
- * </TouchableOpacity>
40
- *
41
- * // Custom onPress handler
42
- * <FollowButton
43
- * userId="123"
44
- * onPress={(event) => {
45
- * event.preventDefault(); // Custom preventDefault
46
- * // Custom logic here
47
- * }}
48
- * />
49
- * ```
50
- */
51
11
  const FollowButton = ({
52
12
  userId,
53
13
  initiallyFollowing = false,
@@ -57,233 +17,144 @@ const FollowButton = ({
57
17
  textStyle,
58
18
  disabled = false,
59
19
  showLoadingState = true,
60
- preventParentActions = true,
61
- onPress
20
+ preventParentActions = true
62
21
  }) => {
63
- const dispatch = useDispatch();
64
22
  const {
65
23
  oxyServices,
66
24
  isAuthenticated
67
25
  } = useOxy();
68
-
69
- // Optimized single selector to prevent multiple re-renders
70
- const followState = useSelector(state => ({
71
- isFollowing: state.follow.followingUsers[userId] ?? initiallyFollowing ?? false,
72
- isLoading: state.follow.loadingUsers[userId] ?? false,
73
- error: state.follow.errors[userId]
74
- }));
75
-
76
- // Whether the follow status has been loaded from the store
77
- const isStatusKnown = useSelector(state => Object.prototype.hasOwnProperty.call(state.follow.followingUsers, userId));
78
26
  const {
79
27
  isFollowing,
80
28
  isLoading,
81
- error
82
- } = followState;
29
+ error,
30
+ toggleFollow,
31
+ setFollowStatus,
32
+ fetchStatus,
33
+ clearError
34
+ } = useFollow(userId);
83
35
 
84
36
  // Animation values
85
37
  const animationProgress = useSharedValue(isFollowing ? 1 : 0);
86
38
  const scale = useSharedValue(1);
87
39
 
88
- // Initialize Redux state with initial value if not already set
40
+ // Initialize Zustand state with initial value if not already set
89
41
  useEffect(() => {
90
- if (userId && !isStatusKnown) {
91
- // Set the initial state regardless of whether initiallyFollowing is defined
92
- const initialState = initiallyFollowing ?? false;
93
- dispatch(setFollowingStatus({
94
- userId,
95
- isFollowing: initialState
96
- }));
42
+ if (userId && !isFollowing && initiallyFollowing) {
43
+ setFollowStatus?.(initiallyFollowing);
97
44
  }
98
- }, [userId, initiallyFollowing, isStatusKnown, dispatch]);
45
+ // eslint-disable-next-line react-hooks/exhaustive-deps
46
+ }, [userId, initiallyFollowing]);
99
47
 
100
48
  // Fetch latest follow status from backend on mount if authenticated
101
- // This runs separately and will overwrite the initial state with actual data
102
49
  useEffect(() => {
103
50
  if (userId && isAuthenticated) {
104
- dispatch(fetchFollowStatus({
105
- userId,
106
- oxyServices
107
- }));
51
+ fetchStatus?.();
108
52
  }
109
- }, [userId, oxyServices, isAuthenticated, dispatch]);
53
+ // eslint-disable-next-line react-hooks/exhaustive-deps
54
+ }, [userId, oxyServices, isAuthenticated]);
110
55
 
111
- // Update the animation value when isFollowing changes
56
+ // Animate button on follow/unfollow
112
57
  useEffect(() => {
113
58
  animationProgress.value = withTiming(isFollowing ? 1 : 0, {
114
59
  duration: 300,
115
- easing: Easing.bezier(0.25, 0.1, 0.25, 1)
60
+ easing: Easing.inOut(Easing.ease)
116
61
  });
117
- }, [isFollowing]); // Removed animationProgress from dependencies as it's stable
118
-
119
- // Show error toast when error occurs
120
- useEffect(() => {
121
- if (error) {
122
- toast.error(error);
123
- dispatch(clearFollowError(userId));
124
- }
125
- }, [error]); // Removed userId and dispatch to prevent unnecessary runs
62
+ }, [isFollowing, animationProgress]);
126
63
 
127
- // The button press handler with preventDefault support - memoized to prevent recreation
64
+ // Button press handler
128
65
  const handlePress = useCallback(async event => {
129
- // Prevent parent actions if enabled (e.g., if inside a link or pressable container)
130
- if (preventParentActions && event) {
131
- // For React Native Web compatibility
132
- if (Platform.OS === 'web' && event.preventDefault) {
133
- event.preventDefault();
134
- }
135
-
136
- // Stop event propagation to prevent parent TouchableOpacity/Pressable actions
137
- if (event.stopPropagation) {
138
- event.stopPropagation();
139
- }
140
-
141
- // For React Native, prevent gesture bubbling
142
- if (event.nativeEvent && event.nativeEvent.stopPropagation) {
143
- event.nativeEvent.stopPropagation();
144
- }
145
- }
146
-
147
- // If custom onPress is provided, use it instead of default behavior
148
- if (onPress) {
149
- onPress(event);
150
- return;
66
+ if (preventParentActions && event && event.preventDefault) {
67
+ event.preventDefault();
68
+ event.stopPropagation();
151
69
  }
152
- if (disabled || followState.isLoading) return;
153
-
154
- // Check if user is authenticated - show toast instead of disabling
155
- if (!isAuthenticated) {
156
- toast.error('Please sign in to follow users');
157
- return;
158
- }
159
-
160
- // Touch feedback animation
161
- scale.value = withSpring(0.95, {
162
- damping: 10
163
- }, () => {
164
- scale.value = withSpring(1);
165
- });
70
+ if (disabled || isLoading) return;
166
71
  try {
167
- // Dispatch the async action to follow/unfollow
168
- const result = await dispatch(toggleFollowUser({
169
- userId,
170
- oxyServices,
171
- isCurrentlyFollowing: followState.isFollowing
172
- })).unwrap();
173
-
174
- // Call the callback if provided
175
- if (onFollowChange) {
176
- onFollowChange(result.isFollowing);
177
- }
178
-
179
- // Show success toast
180
- toast.success(result.isFollowing ? 'Following user!' : 'Unfollowed user');
181
- } catch (error) {
182
- console.error('Follow action failed:', error);
183
-
184
- // Show user-friendly error messages for state mismatches
185
- const errorMessage = error?.toString() || 'Unknown error';
186
- if (errorMessage.includes('State synced with backend')) {
187
- toast.info('Status updated. Please try again.');
188
- } else {
189
- toast.error(`Failed to ${followState.isFollowing ? 'unfollow' : 'follow'} user. Please try again.`);
190
- }
191
- }
192
- }, [preventParentActions, onPress, disabled, followState.isLoading, followState.isFollowing, isAuthenticated, scale, dispatch, userId, oxyServices, onFollowChange]);
193
-
194
- // Animated styles for the button
195
- const animatedButtonStyle = useAnimatedStyle(() => {
196
- const backgroundColor = interpolateColor(animationProgress.value, [0, 1], ['#d169e5', '#FFFFFF']);
197
- const borderColor = interpolateColor(animationProgress.value, [0, 1], ['#d169e5', '#d169e5']);
198
-
199
- // Add a slight scaling effect during the transition
200
- const transitionScale = 1 + 0.05 * Math.sin(animationProgress.value * Math.PI);
201
- return {
202
- backgroundColor,
203
- borderColor,
204
- borderWidth: 1,
205
- transform: [{
206
- scale: scale.value * transitionScale
207
- }]
208
- };
209
- });
210
-
211
- // Animated styles for the text
212
- const animatedTextStyle = useAnimatedStyle(() => {
213
- const color = interpolateColor(animationProgress.value, [0, 1], ['#FFFFFF', '#d169e5']);
214
- return {
215
- color
216
- };
217
- });
218
-
219
- // Get size-specific styles
220
- const getSizeStyles = () => {
221
- switch (size) {
222
- case 'small':
223
- return {
224
- button: {
225
- paddingVertical: 6,
226
- paddingHorizontal: 12
227
- },
228
- text: {
229
- fontSize: 12
230
- }
231
- };
232
- case 'large':
233
- return {
234
- button: {
235
- paddingVertical: 12,
236
- paddingHorizontal: 24
237
- },
238
- text: {
239
- fontSize: 18
240
- }
241
- };
242
- default:
243
- // medium
244
- return {
245
- button: {
246
- paddingVertical: 8,
247
- paddingHorizontal: 16
248
- },
249
- text: {
250
- fontSize: 14
251
- }
252
- };
72
+ await toggleFollow?.();
73
+ if (onFollowChange) onFollowChange(!isFollowing);
74
+ } catch (err) {
75
+ toast.error(err?.message || 'Failed to update follow status');
253
76
  }
77
+ }, [disabled, isLoading, toggleFollow, onFollowChange, isFollowing, preventParentActions]);
78
+
79
+ // Button styles
80
+ const getButtonStyle = () => {
81
+ let baseStyle = styles.buttonMedium;
82
+ if (size === 'small') baseStyle = styles.buttonSmall;
83
+ if (size === 'large') baseStyle = styles.buttonLarge;
84
+ return [baseStyle, isFollowing ? styles.following : styles.notFollowing, style];
85
+ };
86
+ const getTextStyle = () => {
87
+ let baseStyle = styles.textMedium;
88
+ if (size === 'small') baseStyle = styles.textSmall;
89
+ if (size === 'large') baseStyle = styles.textLarge;
90
+ return [baseStyle, isFollowing ? styles.textFollowing : styles.textNotFollowing, textStyle];
254
91
  };
255
- const sizeStyles = getSizeStyles();
256
92
  return /*#__PURE__*/_jsx(TouchableOpacity, {
257
- activeOpacity: 0.8,
93
+ style: getButtonStyle(),
258
94
  onPress: handlePress,
259
95
  disabled: disabled || isLoading,
260
- children: /*#__PURE__*/_jsx(Animated.View, {
261
- style: [styles.button, sizeStyles.button, animatedButtonStyle, style],
262
- children: isLoading && showLoadingState ? /*#__PURE__*/_jsx(ActivityIndicator, {
263
- size: "small",
264
- color: isFollowing ? '#d169e5' : '#FFFFFF'
265
- }) : /*#__PURE__*/_jsx(Animated.Text, {
266
- style: [styles.text, sizeStyles.text, animatedTextStyle, textStyle],
267
- children: isFollowing ? 'Following' : 'Follow'
268
- })
96
+ activeOpacity: 0.8,
97
+ children: showLoadingState && isLoading ? /*#__PURE__*/_jsx(ActivityIndicator, {
98
+ size: size === 'small' ? 'small' : 'large',
99
+ color: isFollowing ? '#fff' : '#007AFF'
100
+ }) : /*#__PURE__*/_jsx(Text, {
101
+ style: getTextStyle(),
102
+ children: isFollowing ? 'Following' : 'Follow'
269
103
  })
270
104
  });
271
105
  };
272
106
  const styles = StyleSheet.create({
273
- button: {
274
- justifyContent: 'center',
107
+ buttonSmall: {
108
+ paddingVertical: 4,
109
+ paddingHorizontal: 12,
110
+ borderRadius: 16,
111
+ minWidth: 60,
112
+ alignItems: 'center',
113
+ justifyContent: 'center'
114
+ },
115
+ buttonMedium: {
116
+ paddingVertical: 8,
117
+ paddingHorizontal: 20,
118
+ borderRadius: 20,
119
+ minWidth: 90,
120
+ alignItems: 'center',
121
+ justifyContent: 'center'
122
+ },
123
+ buttonLarge: {
124
+ paddingVertical: 12,
125
+ paddingHorizontal: 32,
126
+ borderRadius: 24,
127
+ minWidth: 120,
275
128
  alignItems: 'center',
276
- flexDirection: 'row',
277
- borderRadius: 100
129
+ justifyContent: 'center'
130
+ },
131
+ following: {
132
+ backgroundColor: '#007AFF'
133
+ },
134
+ notFollowing: {
135
+ backgroundColor: '#fff',
136
+ borderWidth: 1,
137
+ borderColor: '#007AFF'
138
+ },
139
+ textSmall: {
140
+ fontSize: 13,
141
+ fontFamily: fontFamilies.phuduMedium
142
+ },
143
+ textMedium: {
144
+ fontSize: 15,
145
+ fontFamily: fontFamilies.phuduMedium
146
+ },
147
+ textLarge: {
148
+ fontSize: 18,
149
+ fontFamily: fontFamilies.phuduMedium
150
+ },
151
+ textFollowing: {
152
+ color: '#fff'
278
153
  },
279
- text: {
280
- fontFamily: Platform.select({
281
- web: 'Phudu',
282
- default: fontFamilies.phuduSemiBold
283
- }),
284
- fontWeight: Platform.OS === 'web' ? '600' : undefined,
285
- textAlign: 'center'
154
+ textNotFollowing: {
155
+ color: '#007AFF'
286
156
  }
287
157
  });
158
+ export { FollowButton };
288
159
  export default FollowButton;
289
160
  //# sourceMappingURL=FollowButton.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","useCallback","TouchableOpacity","StyleSheet","Platform","ActivityIndicator","Animated","useSharedValue","useAnimatedStyle","withSpring","interpolateColor","Easing","withTiming","useDispatch","useSelector","useOxy","fontFamilies","toast","toggleFollowUser","setFollowingStatus","clearFollowError","fetchFollowStatus","jsx","_jsx","FollowButton","userId","initiallyFollowing","size","onFollowChange","style","textStyle","disabled","showLoadingState","preventParentActions","onPress","dispatch","oxyServices","isAuthenticated","followState","state","isFollowing","follow","followingUsers","isLoading","loadingUsers","error","errors","isStatusKnown","Object","prototype","hasOwnProperty","call","animationProgress","scale","initialState","value","duration","easing","bezier","handlePress","event","OS","preventDefault","stopPropagation","nativeEvent","damping","result","isCurrentlyFollowing","unwrap","success","console","errorMessage","toString","includes","info","animatedButtonStyle","backgroundColor","borderColor","transitionScale","Math","sin","PI","borderWidth","transform","animatedTextStyle","color","getSizeStyles","button","paddingVertical","paddingHorizontal","text","fontSize","sizeStyles","activeOpacity","children","View","styles","Text","create","justifyContent","alignItems","flexDirection","borderRadius","fontFamily","select","web","default","phuduSemiBold","fontWeight","undefined","textAlign"],"sourceRoot":"../../../../src","sources":["ui/components/FollowButton.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,WAAW,QAAQ,OAAO;AACrD,SACEC,gBAAgB,EAEhBC,UAAU,EAIVC,QAAQ,EACRC,iBAAiB,QACZ,cAAc;AACrB,OAAOC,QAAQ,IACbC,cAAc,EACdC,gBAAgB,EAChBC,UAAU,EACVC,gBAAgB,EAChBC,MAAM,EACNC,UAAU,QACL,yBAAyB;AAChC,SAASC,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SACEC,gBAAgB,EAChBC,kBAAkB,EAClBC,gBAAgB,EAChBC,iBAAiB,QACZ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA8DlB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,YAAyC,GAAGA,CAAC;EACjDC,MAAM;EACNC,kBAAkB,GAAG,KAAK;EAC1BC,IAAI,GAAG,QAAQ;EACfC,cAAc;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G7F,UAAU,CAAC+F,MAAM,CAAC;EAC/BX,MAAM,EAAE;IACNY,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,aAAa,EAAE,KAAK;IACpBC,YAAY,EAAE;EAChB,CAAC;EACDZ,IAAI,EAAE;IACJa,UAAU,EAAEnG,QAAQ,CAACoG,MAAM,CAAC;MAC1BC,GAAG,EAAE,OAAO;MACZC,OAAO,EAAE1F,YAAY,CAAC2F;IACxB,CAAC,CAAC;IACFC,UAAU,EAAExG,QAAQ,CAACyD,EAAE,KAAK,KAAK,GAAG,KAAK,GAAGgD,SAAS;IACrDC,SAAS,EAAE;EACb;AACF,CAAC,CAAC;AAEF,eAAetF,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["React","useEffect","useCallback","TouchableOpacity","Text","StyleSheet","ActivityIndicator","useSharedValue","Easing","withTiming","useOxy","fontFamilies","toast","useFollow","jsx","_jsx","FollowButton","userId","initiallyFollowing","size","onFollowChange","style","textStyle","disabled","showLoadingState","preventParentActions","oxyServices","isAuthenticated","isFollowing","isLoading","error","toggleFollow","setFollowStatus","fetchStatus","clearError","animationProgress","scale","value","duration","easing","inOut","ease","handlePress","event","preventDefault","stopPropagation","err","message","getButtonStyle","baseStyle","styles","buttonMedium","buttonSmall","buttonLarge","following","notFollowing","getTextStyle","textMedium","textSmall","textLarge","textFollowing","textNotFollowing","onPress","activeOpacity","children","color","create","paddingVertical","paddingHorizontal","borderRadius","minWidth","alignItems","justifyContent","backgroundColor","borderWidth","borderColor","fontSize","fontFamily","phuduMedium"],"sourceRoot":"../../../../src","sources":["ui/components/FollowButton.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,WAAW,QAAQ,OAAO;AACrD,SACEC,gBAAgB,EAChBC,IAAI,EACJC,UAAU,EAKVC,iBAAiB,QACZ,cAAc;AACrB,SACEC,cAAc,EAIdC,MAAM,EACNC,UAAU,QACL,yBAAyB;AAChC,SAASC,MAAM,QAAQ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AAE,EAAE;IACrBC,YAAY,EAAE,EAAE;IAChBC,QAAQ,EAAE,GAAG;IACbC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;EACDlB,SAAS,EAAE;IACTmB,eAAe,EAAE;EACnB,CAAC;EACDlB,YAAY,EAAE;IACZkB,eAAe,EAAE,MAAM;IACvBC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE;EACf,CAAC;EACDjB,SAAS,EAAE;IACTkB,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAElE,YAAY,CAACmE;EAC3B,CAAC;EACDrB,UAAU,EAAE;IACVmB,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAElE,YAAY,CAACmE;EAC3B,CAAC;EACDnB,SAAS,EAAE;IACTiB,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAElE,YAAY,CAACmE;EAC3B,CAAC;EACDlB,aAAa,EAAE;IACbK,KAAK,EAAE;EACT,CAAC;EACDJ,gBAAgB,EAAE;IAChBI,KAAK,EAAE;EACT;AACF,CAAC,CAAC;AAEF,SAASjD,YAAY;AACrB,eAAeA,YAAY","ignoreList":[]}
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+
3
+ import React, { useState } from 'react';
4
+ import { TouchableOpacity, Text, View, StyleSheet } from 'react-native';
5
+ import { fontFamilies } from '../styles/fonts';
6
+ import { useOxy } from '../context/OxyContext';
7
+ import OxyLogo from './OxyLogo';
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ /**
10
+ * A pre-styled button for OxyPay payments that opens the Payment Gateway
11
+ * - Only black or white by default, but can be customized with the color prop.
12
+ */
13
+ const OxyPayButton = ({
14
+ style,
15
+ textStyle,
16
+ text = 'Pay',
17
+ disabled = false,
18
+ amount,
19
+ currency = 'FAIR',
20
+ paymentItems,
21
+ description,
22
+ onPaymentResult,
23
+ color,
24
+ variant = 'white'
25
+ }) => {
26
+ const {
27
+ showBottomSheet
28
+ } = useOxy();
29
+ const [buttonHeight, setButtonHeight] = useState(52);
30
+ const handlePress = () => {
31
+ showBottomSheet?.({
32
+ screen: 'PaymentGateway',
33
+ props: {
34
+ amount,
35
+ currency,
36
+ paymentItems,
37
+ description,
38
+ onPaymentResult
39
+ }
40
+ });
41
+ };
42
+ // Determine background and text color
43
+ const backgroundColor = color || (variant === 'black' ? '#111' : '#fff');
44
+ const textColor = variant === 'black' || color && isColorDark(color) ? '#fff' : '#1b1f0a';
45
+ // Responsive sizing
46
+ const logoWidth = Math.round(buttonHeight * 0.5); // 50% of button height
47
+ const logoHeight = Math.round(buttonHeight * 0.25); // 25% of button height
48
+ const fontSize = Math.round(buttonHeight * 0.35); // 35% of button height
49
+ const handleLayout = e => {
50
+ const h = e.nativeEvent.layout.height;
51
+ if (h && Math.abs(h - buttonHeight) > 1) setButtonHeight(h);
52
+ };
53
+ return /*#__PURE__*/_jsx(TouchableOpacity, {
54
+ style: [styles.button, {
55
+ backgroundColor,
56
+ borderColor: textColor,
57
+ borderWidth: 1
58
+ }, disabled && styles.buttonDisabled, style],
59
+ onPress: handlePress,
60
+ disabled: disabled,
61
+ activeOpacity: 0.85,
62
+ onLayout: handleLayout,
63
+ children: /*#__PURE__*/_jsxs(View, {
64
+ style: styles.buttonContent,
65
+ children: [/*#__PURE__*/_jsx(OxyLogo, {
66
+ width: logoWidth,
67
+ height: logoHeight,
68
+ style: {
69
+ marginRight: logoWidth * 0.12,
70
+ marginTop: (fontSize - logoHeight) / 2
71
+ },
72
+ fillColor: textColor
73
+ }), /*#__PURE__*/_jsx(Text, {
74
+ style: [styles.text, {
75
+ color: textColor,
76
+ fontSize
77
+ }, textStyle],
78
+ children: text
79
+ })]
80
+ })
81
+ });
82
+ };
83
+
84
+ // Helper to determine if a color is dark (simple luminance check)
85
+ function isColorDark(hex) {
86
+ let c = hex.replace('#', '');
87
+ if (c.length === 3) c = c.split('').map(x => x + x).join('');
88
+ if (c.length !== 6) return false;
89
+ const r = parseInt(c.substr(0, 2), 16);
90
+ const g = parseInt(c.substr(2, 2), 16);
91
+ const b = parseInt(c.substr(4, 2), 16);
92
+ // Perceived luminance
93
+ return 0.299 * r + 0.587 * g + 0.114 * b < 150;
94
+ }
95
+ const styles = StyleSheet.create({
96
+ button: {
97
+ padding: 14,
98
+ borderRadius: 35,
99
+ alignItems: 'center',
100
+ justifyContent: 'center',
101
+ flexDirection: 'row',
102
+ minHeight: 52
103
+ },
104
+ buttonDisabled: {
105
+ opacity: 0.6
106
+ },
107
+ buttonContent: {
108
+ flexDirection: 'row',
109
+ alignItems: 'center',
110
+ justifyContent: 'center'
111
+ },
112
+ oxyLogo: {
113
+ // marginRight is set dynamically
114
+ },
115
+ centeredItem: {
116
+ justifyContent: 'center',
117
+ alignItems: 'center'
118
+ },
119
+ text: {
120
+ fontFamily: fontFamilies.phudu,
121
+ fontWeight: '700'
122
+ }
123
+ });
124
+ export default OxyPayButton;
125
+ //# sourceMappingURL=OxyPayButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useState","TouchableOpacity","Text","View","StyleSheet","fontFamilies","useOxy","OxyLogo","jsx","_jsx","jsxs","_jsxs","OxyPayButton","style","textStyle","text","disabled","amount","currency","paymentItems","description","onPaymentResult","color","variant","showBottomSheet","buttonHeight","setButtonHeight","handlePress","screen","props","backgroundColor","textColor","isColorDark","logoWidth","Math","round","logoHeight","fontSize","handleLayout","e","h","nativeEvent","layout","height","abs","styles","button","borderColor","borderWidth","buttonDisabled","onPress","activeOpacity","onLayout","children","buttonContent","width","marginRight","marginTop","fillColor","hex","c","replace","length","split","map","x","join","r","parseInt","substr","g","b","create","padding","borderRadius","alignItems","justifyContent","flexDirection","minHeight","opacity","oxyLogo","centeredItem","fontFamily","phudu","fontWeight"],"sourceRoot":"../../../../src","sources":["ui/components/OxyPayButton.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,gBAAgB,EAAEC,IAAI,EAAEC,IAAI,EAAEC,UAAU,QAA4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