@truworth/twc-auth 3.0.6 → 3.0.7

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 (377) hide show
  1. package/package.json +1 -2
  2. package/build/assets/animation/redirect-home.json +0 -1101
  3. package/build/assets/cross_icon copy.svg +0 -5
  4. package/build/assets/cross_icon.svg +0 -5
  5. package/build/assets/email_icon.svg +0 -6
  6. package/build/assets/gender-diversity.svg +0 -22
  7. package/build/assets/loading-spinner.json +0 -1
  8. package/build/assets/logo.svg +0 -55
  9. package/build/assets/okay_icon.svg +0 -3
  10. package/build/src/api/auth.js +0 -36
  11. package/build/src/api/axiosClient/index.js +0 -5
  12. package/build/src/api/axiosClient/index.native.js +0 -5
  13. package/build/src/components/AdvancedTransitionWrapper/index.js +0 -374
  14. package/build/src/components/AdvancedTransitionWrapper/index.native.js +0 -10
  15. package/build/src/components/AdvancedTransitionWrapper/types.js +0 -1
  16. package/build/src/components/ConfirmationModal/index.js +0 -11
  17. package/build/src/components/ConfirmationModal/index.native.js +0 -15
  18. package/build/src/components/ConfirmationModal/types.js +0 -1
  19. package/build/src/components/IonIcon/index.js +0 -11
  20. package/build/src/components/IonIcon/index.native.js +0 -9
  21. package/build/src/components/IonIcon/types.js +0 -1
  22. package/build/src/components/LoadingAnimation/index.js +0 -50
  23. package/build/src/components/OTPStatusLabel/index.js +0 -10
  24. package/build/src/components/OTPStatusLabel/index.native.js +0 -21
  25. package/build/src/components/OTPStatusLabel/types.js +0 -1
  26. package/build/src/components/PasswordCriteria/hooks/usePasswordCriteria.js +0 -71
  27. package/build/src/components/PasswordCriteria/index.js +0 -47
  28. package/build/src/components/PasswordCriteria/index.native.js +0 -22
  29. package/build/src/components/PasswordCriteria/types.js +0 -1
  30. package/build/src/components/ScreenLayout/index.js +0 -12
  31. package/build/src/components/ScreenLayout/index.native.js +0 -18
  32. package/build/src/components/ScreenLayout/types.js +0 -1
  33. package/build/src/components/SupportDetails/index.js +0 -9
  34. package/build/src/components/SupportDetails/index.native.js +0 -6
  35. package/build/src/components/VerifyEmailOTP/index.js +0 -20
  36. package/build/src/components/VerifyEmailOTP/index.native.js +0 -22
  37. package/build/src/components/VerifyEmailOTP/types.js +0 -1
  38. package/build/src/components/VerifyMobileOTP/index.js +0 -25
  39. package/build/src/components/VerifyMobileOTP/index.native.js +0 -38
  40. package/build/src/components/VerifyMobileOTP/types.js +0 -1
  41. package/build/src/constants/base-url/index.js +0 -5
  42. package/build/src/constants/base-url/index.native.js +0 -1
  43. package/build/src/constants/cdn-url/index.js +0 -2
  44. package/build/src/constants/cdn-url/index.native.js +0 -5
  45. package/build/src/constants/defaultPolicy.js +0 -9
  46. package/build/src/constants/password-requirements.js +0 -7
  47. package/build/src/constants/social-login-options.js +0 -16
  48. package/build/src/contexts/AuthContext.js +0 -190
  49. package/build/src/contexts/type.js +0 -1
  50. package/build/src/enums/index.js +0 -3
  51. package/build/src/enums/loginMethod.enum.js +0 -8
  52. package/build/src/enums/registrationMethod.enum.js +0 -7
  53. package/build/src/enums/socialLogins.enum.js +0 -6
  54. package/build/src/helpers/network.js +0 -93
  55. package/build/src/helpers/show-message/index.js +0 -19
  56. package/build/src/helpers/show-message/index.native.js +0 -14
  57. package/build/src/helpers/show-message/types.js +0 -1
  58. package/build/src/helpers/types.js +0 -1
  59. package/build/src/helpers/validation.js +0 -12
  60. package/build/src/hooks/internal/useAuthPackageContext.js +0 -9
  61. package/build/src/hooks/internal/useTimer.js +0 -40
  62. package/build/src/hooks/useAuthContext.js +0 -10
  63. package/build/src/hooks/useNavigator.js +0 -83
  64. package/build/src/hooks/useRequest.js +0 -34
  65. package/build/src/index.js +0 -23
  66. package/build/src/navigator/index.js +0 -10
  67. package/build/src/navigator/index.native.js +0 -27
  68. package/build/src/screens/CountryCode/components/CountryCodeDropdown/index.js +0 -37
  69. package/build/src/screens/CountryCode/components/CountryCodeDropdown/index.native.js +0 -6
  70. package/build/src/screens/CountryCode/components/CountryCodeDropdown/types.js +0 -1
  71. package/build/src/screens/CountryCode/hooks/internal/useCountryCode.js +0 -38
  72. package/build/src/screens/CountryCode/index.js +0 -10
  73. package/build/src/screens/CountryCode/index.native.js +0 -37
  74. package/build/src/screens/CountryCode/type.js +0 -1
  75. package/build/src/screens/CreatePassword/hooks/internal/useCreatePassword.js +0 -46
  76. package/build/src/screens/CreatePassword/index.js +0 -16
  77. package/build/src/screens/CreatePassword/index.native.js +0 -32
  78. package/build/src/screens/CreatePassword/type.js +0 -1
  79. package/build/src/screens/EnterEmail/hooks/internal/useEnterEmail.js +0 -77
  80. package/build/src/screens/EnterEmail/index.js +0 -58
  81. package/build/src/screens/EnterEmail/index.native.js +0 -31
  82. package/build/src/screens/EnterEmail/types.js +0 -1
  83. package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/hooks/internal/useExistingAccountsSheet.js +0 -36
  84. package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/index.js +0 -33
  85. package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/index.native.js +0 -73
  86. package/build/src/screens/EnterMobile/components/ExistingAccountsSheet/types.js +0 -1
  87. package/build/src/screens/EnterMobile/hooks/internal/useEnterMobile.js +0 -67
  88. package/build/src/screens/EnterMobile/index.js +0 -81
  89. package/build/src/screens/EnterMobile/index.native.js +0 -56
  90. package/build/src/screens/EnterMobile/types.js +0 -1
  91. package/build/src/screens/EnterPassword/hooks/internal/useEnterPassword.js +0 -79
  92. package/build/src/screens/EnterPassword/index.js +0 -68
  93. package/build/src/screens/EnterPassword/index.native.js +0 -41
  94. package/build/src/screens/EnterPassword/types.js +0 -1
  95. package/build/src/screens/Login/components/LoginWebComponent/index.js +0 -63
  96. package/build/src/screens/Login/components/LoginWebComponent/index.native.js +0 -6
  97. package/build/src/screens/Login/index.js +0 -10
  98. package/build/src/screens/Login/index.native.js +0 -6
  99. package/build/src/screens/LoginWithEmailOTP/hooks/internal/useLoginWithEmailOTP.js +0 -85
  100. package/build/src/screens/LoginWithEmailOTP/index.js +0 -8
  101. package/build/src/screens/LoginWithEmailOTP/index.native.js +0 -10
  102. package/build/src/screens/LoginWithMobileOTP/hooks/internal/useLoginWithMobileOTP.js +0 -72
  103. package/build/src/screens/LoginWithMobileOTP/index.js +0 -8
  104. package/build/src/screens/LoginWithMobileOTP/index.native.js +0 -10
  105. package/build/src/screens/PartnerSSO/PartnerLogin/components/PartnerLoginWebComponent/index.js +0 -68
  106. package/build/src/screens/PartnerSSO/PartnerLogin/hooks/internal/usePartnerLogin.js +0 -50
  107. package/build/src/screens/PartnerSSO/PartnerLogin/index.js +0 -2
  108. package/build/src/screens/PartnerSSO/PartnerLogin/types.js +0 -1
  109. package/build/src/screens/PartnerSSO/PartnerRegistration/components/PartnerRegistrationWebComponent/index.js +0 -203
  110. package/build/src/screens/PartnerSSO/PartnerRegistration/hooks/internal/usePartnerRegistration.js +0 -90
  111. package/build/src/screens/PartnerSSO/PartnerRegistration/index.js +0 -2
  112. package/build/src/screens/PartnerSSO/PartnerRegistration/types.js +0 -1
  113. package/build/src/screens/PartnerSSO/index.js +0 -2
  114. package/build/src/screens/Profile/components/EditMobileNumber/index.js +0 -31
  115. package/build/src/screens/Profile/components/EditMobileNumber/index.native.js +0 -8
  116. package/build/src/screens/Profile/components/EditPassword/index.js +0 -29
  117. package/build/src/screens/Profile/components/EditPassword/index.native.js +0 -8
  118. package/build/src/screens/Profile/components/EditProfile/index.js +0 -89
  119. package/build/src/screens/Profile/components/EditProfile/index.native.js +0 -8
  120. package/build/src/screens/Profile/components/OtpVerificationModal/index.js +0 -61
  121. package/build/src/screens/Profile/components/OtpVerificationModal/index.native.js +0 -7
  122. package/build/src/screens/Profile/components/ProfileWebComponent/index.js +0 -80
  123. package/build/src/screens/Profile/components/ProfileWebComponent/index.native.js +0 -9
  124. package/build/src/screens/Profile/hooks/internal/useProfile.js +0 -185
  125. package/build/src/screens/Profile/index.js +0 -6
  126. package/build/src/screens/Profile/index.native.js +0 -6
  127. package/build/src/screens/Profile/types.js +0 -1
  128. package/build/src/screens/ResetPassword/hooks/internal/useResetPassword.js +0 -57
  129. package/build/src/screens/ResetPassword/index.js +0 -46
  130. package/build/src/screens/ResetPassword/index.native.js +0 -26
  131. package/build/src/screens/ResetPassword/types.js +0 -1
  132. package/build/src/screens/SSOLogin/AuthWebView/index.js +0 -9
  133. package/build/src/screens/SSOLogin/AuthWebView/index.native.js +0 -42
  134. package/build/src/screens/SSOLogin/AuthWebView/types.js +0 -1
  135. package/build/src/screens/SSOLogin/AuthenticationMethods/hooks/internal/useSSOAuthenticationMethods.js +0 -39
  136. package/build/src/screens/SSOLogin/AuthenticationMethods/index.js +0 -50
  137. package/build/src/screens/SSOLogin/AuthenticationMethods/index.native.js +0 -59
  138. package/build/src/screens/SSOLogin/AuthenticationMethods/types.js +0 -1
  139. package/build/src/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.js +0 -62
  140. package/build/src/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.native.js +0 -6
  141. package/build/src/screens/SSOLogin/SSOCallback/hooks/internal/useSSOCallback.js +0 -58
  142. package/build/src/screens/SSOLogin/SSOCallback/index.js +0 -9
  143. package/build/src/screens/SSOLogin/SSOCallback/index.native.js +0 -35
  144. package/build/src/screens/SSOLogin/SSOCallback/types.js +0 -1
  145. package/build/src/screens/SSOLogin/SearchOrganization/hooks/internal/useSSOSearchOrganization.js +0 -71
  146. package/build/src/screens/SSOLogin/SearchOrganization/index.js +0 -46
  147. package/build/src/screens/SSOLogin/SearchOrganization/index.native.js +0 -37
  148. package/build/src/screens/SSOLogin/SearchOrganization/types.js +0 -1
  149. package/build/src/screens/SignUp/components/SignUpForm/index.js +0 -215
  150. package/build/src/screens/SignUp/components/SignUpForm/index.native.js +0 -6
  151. package/build/src/screens/SignUp/components/SignUpForm/type.js +0 -1
  152. package/build/src/screens/SignUp/components/SignUpWebComponent/index.js +0 -62
  153. package/build/src/screens/SignUp/components/SignUpWebComponent/index.native.js +0 -6
  154. package/build/src/screens/SignUp/components/SignUpWebComponent/types.js +0 -1
  155. package/build/src/screens/SignUp/hooks/internal/useSignUp.js +0 -134
  156. package/build/src/screens/SignUp/index.js +0 -6
  157. package/build/src/screens/SignUp/index.native.js +0 -188
  158. package/build/src/screens/SignUp/types.js +0 -1
  159. package/build/src/screens/UserConsent/hooks/internal/useConsent.js +0 -64
  160. package/build/src/screens/UserConsent/index.js +0 -84
  161. package/build/src/screens/UserConsent/index.native.js +0 -47
  162. package/build/src/screens/UserConsent/types.js +0 -1
  163. package/build/src/screens/VerifyEmail/hooks/internal/useVerifyEmail.js +0 -69
  164. package/build/src/screens/VerifyEmail/index.js +0 -8
  165. package/build/src/screens/VerifyEmail/index.native.js +0 -14
  166. package/build/src/screens/VerifyEmail/types.js +0 -1
  167. package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/hooks/internal/useVerifyLinkPrimaryAccountEmailOTP.js +0 -73
  168. package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/index.js +0 -8
  169. package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/index.native.js +0 -14
  170. package/build/src/screens/VerifyLinkPrimaryAccountEmailOTP/types.js +0 -1
  171. package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/hooks/internal/useVerifyLinkPrimaryAccountMobileOTP.js +0 -83
  172. package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/index.js +0 -8
  173. package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/index.native.js +0 -10
  174. package/build/src/screens/VerifyLinkPrimaryAccountMobileOTP/types.js +0 -1
  175. package/build/src/screens/VerifyMobile/hooks/internal/useVerifyMobile.js +0 -74
  176. package/build/src/screens/VerifyMobile/index.js +0 -8
  177. package/build/src/screens/VerifyMobile/index.native.js +0 -9
  178. package/build/src/screens/VerifyMobile/types.js +0 -1
  179. package/build/src/screens/VerifyResetPasswordOTP/hooks/internal/useVerifyResetPasswordOTP.js +0 -74
  180. package/build/src/screens/VerifyResetPasswordOTP/index.js +0 -8
  181. package/build/src/screens/VerifyResetPasswordOTP/index.native.js +0 -14
  182. package/build/src/screens/Welcome/SocialAuth/commonSocialAuth.js +0 -127
  183. package/build/src/screens/Welcome/SocialAuth/hooks/useSocialAuth.native.js +0 -187
  184. package/build/src/screens/Welcome/SocialAuth/hooks/useSocialAuth.web.js +0 -13
  185. package/build/src/screens/Welcome/SocialAuth/hooks/web/useFacebookAuth.web.js +0 -115
  186. package/build/src/screens/Welcome/SocialAuth/hooks/web/useGoogleAuth.web.js +0 -72
  187. package/build/src/screens/Welcome/components/SocialLoginModal/index.js +0 -9
  188. package/build/src/screens/Welcome/components/SocialLoginModal/index.native.js +0 -21
  189. package/build/src/screens/Welcome/components/SocialLoginModal/types.js +0 -1
  190. package/build/src/screens/Welcome/hooks/internal/useWelcome.js +0 -26
  191. package/build/src/screens/Welcome/index.js +0 -28
  192. package/build/src/screens/Welcome/index.native.js +0 -78
  193. package/build/src/types/types.js +0 -2
  194. package/build/types/api/auth.d.ts +0 -11
  195. package/build/types/api/axiosClient/index.d.ts +0 -1
  196. package/build/types/api/axiosClient/index.native.d.ts +0 -1
  197. package/build/types/components/AdvancedTransitionWrapper/index.d.ts +0 -3
  198. package/build/types/components/AdvancedTransitionWrapper/index.native.d.ts +0 -5
  199. package/build/types/components/AdvancedTransitionWrapper/types.d.ts +0 -25
  200. package/build/types/components/ConfirmationModal/index.d.ts +0 -3
  201. package/build/types/components/ConfirmationModal/index.native.d.ts +0 -3
  202. package/build/types/components/ConfirmationModal/types.d.ts +0 -16
  203. package/build/types/components/IonIcon/index.d.ts +0 -3
  204. package/build/types/components/IonIcon/index.native.d.ts +0 -4
  205. package/build/types/components/IonIcon/types.d.ts +0 -6
  206. package/build/types/components/LoadingAnimation/index.d.ts +0 -6
  207. package/build/types/components/OTPStatusLabel/index.d.ts +0 -2
  208. package/build/types/components/OTPStatusLabel/index.native.d.ts +0 -3
  209. package/build/types/components/OTPStatusLabel/types.d.ts +0 -6
  210. package/build/types/components/PasswordCriteria/hooks/usePasswordCriteria.d.ts +0 -8
  211. package/build/types/components/PasswordCriteria/index.d.ts +0 -3
  212. package/build/types/components/PasswordCriteria/index.native.d.ts +0 -3
  213. package/build/types/components/PasswordCriteria/types.d.ts +0 -15
  214. package/build/types/components/ScreenLayout/index.d.ts +0 -3
  215. package/build/types/components/ScreenLayout/index.native.d.ts +0 -3
  216. package/build/types/components/ScreenLayout/types.d.ts +0 -13
  217. package/build/types/components/SupportDetails/index.d.ts +0 -2
  218. package/build/types/components/SupportDetails/index.native.d.ts +0 -2
  219. package/build/types/components/VerifyEmailOTP/index.d.ts +0 -3
  220. package/build/types/components/VerifyEmailOTP/index.native.d.ts +0 -3
  221. package/build/types/components/VerifyEmailOTP/types.d.ts +0 -9
  222. package/build/types/components/VerifyMobileOTP/index.d.ts +0 -3
  223. package/build/types/components/VerifyMobileOTP/index.native.d.ts +0 -3
  224. package/build/types/components/VerifyMobileOTP/types.d.ts +0 -9
  225. package/build/types/constants/base-url/index.d.ts +0 -1
  226. package/build/types/constants/base-url/index.native.d.ts +0 -1
  227. package/build/types/constants/cdn-url/index.d.ts +0 -2
  228. package/build/types/constants/cdn-url/index.native.d.ts +0 -3
  229. package/build/types/constants/defaultPolicy.d.ts +0 -9
  230. package/build/types/constants/password-requirements.d.ts +0 -4
  231. package/build/types/constants/social-login-options.d.ts +0 -3
  232. package/build/types/contexts/AuthContext.d.ts +0 -38
  233. package/build/types/contexts/type.d.ts +0 -94
  234. package/build/types/enums/index.d.ts +0 -3
  235. package/build/types/enums/loginMethod.enum.d.ts +0 -7
  236. package/build/types/enums/registrationMethod.enum.d.ts +0 -6
  237. package/build/types/enums/socialLogins.enum.d.ts +0 -5
  238. package/build/types/helpers/network.d.ts +0 -5
  239. package/build/types/helpers/show-message/index.d.ts +0 -3
  240. package/build/types/helpers/show-message/index.native.d.ts +0 -3
  241. package/build/types/helpers/show-message/types.d.ts +0 -6
  242. package/build/types/helpers/types.d.ts +0 -19
  243. package/build/types/helpers/validation.d.ts +0 -2
  244. package/build/types/hooks/internal/useAuthPackageContext.d.ts +0 -1
  245. package/build/types/hooks/internal/useTimer.d.ts +0 -3
  246. package/build/types/hooks/useAuthContext.d.ts +0 -2
  247. package/build/types/hooks/useNavigator.d.ts +0 -66
  248. package/build/types/hooks/useRequest.d.ts +0 -5
  249. package/build/types/index.d.ts +0 -15
  250. package/build/types/navigator/index.d.ts +0 -2
  251. package/build/types/navigator/index.native.d.ts +0 -82
  252. package/build/types/screens/CountryCode/components/CountryCodeDropdown/index.d.ts +0 -3
  253. package/build/types/screens/CountryCode/components/CountryCodeDropdown/index.native.d.ts +0 -2
  254. package/build/types/screens/CountryCode/components/CountryCodeDropdown/types.d.ts +0 -17
  255. package/build/types/screens/CountryCode/hooks/internal/useCountryCode.d.ts +0 -12
  256. package/build/types/screens/CountryCode/index.d.ts +0 -2
  257. package/build/types/screens/CountryCode/index.native.d.ts +0 -2
  258. package/build/types/screens/CountryCode/type.d.ts +0 -11
  259. package/build/types/screens/CreatePassword/hooks/internal/useCreatePassword.d.ts +0 -37
  260. package/build/types/screens/CreatePassword/index.d.ts +0 -3
  261. package/build/types/screens/CreatePassword/index.native.d.ts +0 -4
  262. package/build/types/screens/CreatePassword/type.d.ts +0 -43
  263. package/build/types/screens/EnterEmail/hooks/internal/useEnterEmail.d.ts +0 -19
  264. package/build/types/screens/EnterEmail/index.d.ts +0 -3
  265. package/build/types/screens/EnterEmail/index.native.d.ts +0 -4
  266. package/build/types/screens/EnterEmail/types.d.ts +0 -13
  267. package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/hooks/internal/useExistingAccountsSheet.d.ts +0 -13
  268. package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/index.d.ts +0 -3
  269. package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/index.native.d.ts +0 -3
  270. package/build/types/screens/EnterMobile/components/ExistingAccountsSheet/types.d.ts +0 -28
  271. package/build/types/screens/EnterMobile/hooks/internal/useEnterMobile.d.ts +0 -15
  272. package/build/types/screens/EnterMobile/index.d.ts +0 -4
  273. package/build/types/screens/EnterMobile/index.native.d.ts +0 -4
  274. package/build/types/screens/EnterMobile/types.d.ts +0 -44
  275. package/build/types/screens/EnterPassword/hooks/internal/useEnterPassword.d.ts +0 -25
  276. package/build/types/screens/EnterPassword/index.d.ts +0 -3
  277. package/build/types/screens/EnterPassword/index.native.d.ts +0 -4
  278. package/build/types/screens/EnterPassword/types.d.ts +0 -24
  279. package/build/types/screens/Login/components/LoginWebComponent/index.d.ts +0 -2
  280. package/build/types/screens/Login/components/LoginWebComponent/index.native.d.ts +0 -2
  281. package/build/types/screens/Login/index.d.ts +0 -2
  282. package/build/types/screens/Login/index.native.d.ts +0 -2
  283. package/build/types/screens/LoginWithEmailOTP/hooks/internal/useLoginWithEmailOTP.d.ts +0 -17
  284. package/build/types/screens/LoginWithEmailOTP/index.d.ts +0 -7
  285. package/build/types/screens/LoginWithEmailOTP/index.native.d.ts +0 -4
  286. package/build/types/screens/LoginWithMobileOTP/hooks/internal/useLoginWithMobileOTP.d.ts +0 -11
  287. package/build/types/screens/LoginWithMobileOTP/index.d.ts +0 -5
  288. package/build/types/screens/LoginWithMobileOTP/index.native.d.ts +0 -4
  289. package/build/types/screens/PartnerSSO/PartnerLogin/components/PartnerLoginWebComponent/index.d.ts +0 -25
  290. package/build/types/screens/PartnerSSO/PartnerLogin/hooks/internal/usePartnerLogin.d.ts +0 -8
  291. package/build/types/screens/PartnerSSO/PartnerLogin/index.d.ts +0 -2
  292. package/build/types/screens/PartnerSSO/PartnerLogin/types.d.ts +0 -35
  293. package/build/types/screens/PartnerSSO/PartnerRegistration/components/PartnerRegistrationWebComponent/index.d.ts +0 -24
  294. package/build/types/screens/PartnerSSO/PartnerRegistration/hooks/internal/usePartnerRegistration.d.ts +0 -8
  295. package/build/types/screens/PartnerSSO/PartnerRegistration/index.d.ts +0 -2
  296. package/build/types/screens/PartnerSSO/PartnerRegistration/types.d.ts +0 -63
  297. package/build/types/screens/PartnerSSO/index.d.ts +0 -2
  298. package/build/types/screens/Profile/components/EditMobileNumber/index.d.ts +0 -6
  299. package/build/types/screens/Profile/components/EditMobileNumber/index.native.d.ts +0 -3
  300. package/build/types/screens/Profile/components/EditPassword/index.d.ts +0 -6
  301. package/build/types/screens/Profile/components/EditPassword/index.native.d.ts +0 -3
  302. package/build/types/screens/Profile/components/EditProfile/index.d.ts +0 -6
  303. package/build/types/screens/Profile/components/EditProfile/index.native.d.ts +0 -3
  304. package/build/types/screens/Profile/components/OtpVerificationModal/index.d.ts +0 -4
  305. package/build/types/screens/Profile/components/OtpVerificationModal/index.native.d.ts +0 -3
  306. package/build/types/screens/Profile/components/ProfileWebComponent/index.d.ts +0 -4
  307. package/build/types/screens/Profile/components/ProfileWebComponent/index.native.d.ts +0 -3
  308. package/build/types/screens/Profile/hooks/internal/useProfile.d.ts +0 -26
  309. package/build/types/screens/Profile/index.d.ts +0 -7
  310. package/build/types/screens/Profile/index.native.d.ts +0 -7
  311. package/build/types/screens/Profile/types.d.ts +0 -53
  312. package/build/types/screens/ResetPassword/hooks/internal/useResetPassword.d.ts +0 -29
  313. package/build/types/screens/ResetPassword/index.d.ts +0 -3
  314. package/build/types/screens/ResetPassword/index.native.d.ts +0 -4
  315. package/build/types/screens/ResetPassword/types.d.ts +0 -11
  316. package/build/types/screens/SSOLogin/AuthWebView/index.d.ts +0 -2
  317. package/build/types/screens/SSOLogin/AuthWebView/index.native.d.ts +0 -4
  318. package/build/types/screens/SSOLogin/AuthWebView/types.d.ts +0 -8
  319. package/build/types/screens/SSOLogin/AuthenticationMethods/hooks/internal/useSSOAuthenticationMethods.d.ts +0 -9
  320. package/build/types/screens/SSOLogin/AuthenticationMethods/index.d.ts +0 -3
  321. package/build/types/screens/SSOLogin/AuthenticationMethods/index.native.d.ts +0 -4
  322. package/build/types/screens/SSOLogin/AuthenticationMethods/types.d.ts +0 -14
  323. package/build/types/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.d.ts +0 -6
  324. package/build/types/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.native.d.ts +0 -2
  325. package/build/types/screens/SSOLogin/SSOCallback/hooks/internal/useSSOCallback.d.ts +0 -15
  326. package/build/types/screens/SSOLogin/SSOCallback/index.d.ts +0 -2
  327. package/build/types/screens/SSOLogin/SSOCallback/index.native.d.ts +0 -4
  328. package/build/types/screens/SSOLogin/SSOCallback/types.d.ts +0 -14
  329. package/build/types/screens/SSOLogin/SearchOrganization/hooks/internal/useSSOSearchOrganization.d.ts +0 -18
  330. package/build/types/screens/SSOLogin/SearchOrganization/index.d.ts +0 -3
  331. package/build/types/screens/SSOLogin/SearchOrganization/index.native.d.ts +0 -4
  332. package/build/types/screens/SSOLogin/SearchOrganization/types.d.ts +0 -13
  333. package/build/types/screens/SignUp/components/SignUpForm/index.d.ts +0 -3
  334. package/build/types/screens/SignUp/components/SignUpForm/index.native.d.ts +0 -2
  335. package/build/types/screens/SignUp/components/SignUpForm/type.d.ts +0 -6
  336. package/build/types/screens/SignUp/components/SignUpWebComponent/index.d.ts +0 -2
  337. package/build/types/screens/SignUp/components/SignUpWebComponent/index.native.d.ts +0 -2
  338. package/build/types/screens/SignUp/components/SignUpWebComponent/types.d.ts +0 -9
  339. package/build/types/screens/SignUp/hooks/internal/useSignUp.d.ts +0 -48
  340. package/build/types/screens/SignUp/index.d.ts +0 -2
  341. package/build/types/screens/SignUp/index.native.d.ts +0 -4
  342. package/build/types/screens/SignUp/types.d.ts +0 -40
  343. package/build/types/screens/UserConsent/hooks/internal/useConsent.d.ts +0 -10
  344. package/build/types/screens/UserConsent/index.d.ts +0 -3
  345. package/build/types/screens/UserConsent/index.native.d.ts +0 -4
  346. package/build/types/screens/UserConsent/types.d.ts +0 -33
  347. package/build/types/screens/VerifyEmail/hooks/internal/useVerifyEmail.d.ts +0 -19
  348. package/build/types/screens/VerifyEmail/index.d.ts +0 -3
  349. package/build/types/screens/VerifyEmail/index.native.d.ts +0 -4
  350. package/build/types/screens/VerifyEmail/types.d.ts +0 -8
  351. package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/hooks/internal/useVerifyLinkPrimaryAccountEmailOTP.d.ts +0 -15
  352. package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/index.d.ts +0 -3
  353. package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/index.native.d.ts +0 -4
  354. package/build/types/screens/VerifyLinkPrimaryAccountEmailOTP/types.d.ts +0 -14
  355. package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/hooks/internal/useVerifyLinkPrimaryAccountMobileOTP.d.ts +0 -17
  356. package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/index.d.ts +0 -3
  357. package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/index.native.d.ts +0 -4
  358. package/build/types/screens/VerifyLinkPrimaryAccountMobileOTP/types.d.ts +0 -5
  359. package/build/types/screens/VerifyMobile/hooks/internal/useVerifyMobile.d.ts +0 -14
  360. package/build/types/screens/VerifyMobile/index.d.ts +0 -3
  361. package/build/types/screens/VerifyMobile/index.native.d.ts +0 -4
  362. package/build/types/screens/VerifyMobile/types.d.ts +0 -5
  363. package/build/types/screens/VerifyResetPasswordOTP/hooks/internal/useVerifyResetPasswordOTP.d.ts +0 -19
  364. package/build/types/screens/VerifyResetPasswordOTP/index.d.ts +0 -7
  365. package/build/types/screens/VerifyResetPasswordOTP/index.native.d.ts +0 -4
  366. package/build/types/screens/Welcome/SocialAuth/commonSocialAuth.d.ts +0 -50
  367. package/build/types/screens/Welcome/SocialAuth/hooks/useSocialAuth.native.d.ts +0 -7
  368. package/build/types/screens/Welcome/SocialAuth/hooks/useSocialAuth.web.d.ts +0 -7
  369. package/build/types/screens/Welcome/SocialAuth/hooks/web/useFacebookAuth.web.d.ts +0 -5
  370. package/build/types/screens/Welcome/SocialAuth/hooks/web/useGoogleAuth.web.d.ts +0 -4
  371. package/build/types/screens/Welcome/components/SocialLoginModal/index.d.ts +0 -3
  372. package/build/types/screens/Welcome/components/SocialLoginModal/index.native.d.ts +0 -3
  373. package/build/types/screens/Welcome/components/SocialLoginModal/types.d.ts +0 -8
  374. package/build/types/screens/Welcome/hooks/internal/useWelcome.d.ts +0 -22
  375. package/build/types/screens/Welcome/index.d.ts +0 -4
  376. package/build/types/screens/Welcome/index.native.d.ts +0 -4
  377. package/build/types/types/types.d.ts +0 -115
@@ -1,50 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Button, Flex, Typography } from "@truworth/twc-web-design";
3
- import { useSSOAuthenticationMethods } from "./hooks/internal/useSSOAuthenticationMethods";
4
- import { useAuthPackageContext } from "../../../hooks/internal/useAuthPackageContext";
5
- import { ScreenLayout } from "../../../components/ScreenLayout";
6
- import { CDN_IMAGES_URL } from "../../../constants/cdn-url";
7
- import { showMessage } from "../../../helpers/show-message";
8
- import React from "react";
9
- import { KeyRound, MailIcon, Smartphone } from "lucide-react";
10
- const SSOAuthenticationMethods = ({ client, onPressBack, handleMobileLogin }) => {
11
- const { loading, initiateSSOLogin } = useSSOAuthenticationMethods();
12
- const { LogoComponent } = useAuthPackageContext();
13
- const renderLogo = () => {
14
- if (!LogoComponent) {
15
- return (_jsx("img", { width: 160, height: 35, className: 'md:mt-0 mt-6 md:h-[40px] h-[30px]', src: `${CDN_IMAGES_URL ?? ''}/new-twc_logo.svg` }));
16
- }
17
- // If it's already a React element, return it as is
18
- if (React.isValidElement(LogoComponent)) {
19
- return LogoComponent;
20
- }
21
- // If it's a function component, render it
22
- if (typeof LogoComponent === 'function') {
23
- const Component = LogoComponent;
24
- return _jsx(Component, {});
25
- }
26
- // Fallback to default logo
27
- return (_jsx("img", { width: 160, height: 35, className: 'md:mt-0 mt-6 md:h-[40px] h-[30px]', src: `${CDN_IMAGES_URL ?? ''}/new-twc_logo.svg` }));
28
- };
29
- const onSSOLoginInitiated = (result) => {
30
- try {
31
- localStorage.setItem('clientId', String(result.clientId));
32
- localStorage.setItem('authMethod', result.authMethod);
33
- const u = new URL(result.authenticationUrl);
34
- window.location.href = u.toString();
35
- }
36
- catch (error) {
37
- showMessage({ message: 'Failed to initialize SSO login. Please try again.' });
38
- return;
39
- }
40
- };
41
- return (_jsx(ScreenLayout, { onPressBack: onPressBack, title: _jsxs(Flex, { direction: "column", children: [client?.image ?
42
- _jsx("img", { src: client?.image, width: 175, height: 117, alt: `${client?.name ?? 'Client'} logo` })
43
- : renderLogo(), _jsx(Typography, { type: "heading", size: "h5", className: "my-6", children: "Select how to sign-in" }), client?.ssoEnabled &&
44
- _jsxs(_Fragment, { children: [_jsx(Button, { label: "Login with SSO", isFullWidth: true, variant: "primary", leftIcon: _jsx(KeyRound, {}), onClick: () => initiateSSOLogin({
45
- clientId: client.id,
46
- onSSOLoginInitiated
47
- }), loading: loading }), _jsx(Typography, { type: "body", size: "large", className: "mt-6 text-gray-600", children: "Recommended for quick access" }), _jsxs(Flex, { align: "center", className: "my-4", children: [_jsx(Flex, { className: "flex-1 border-t border-gray-300" }), _jsx(Typography, { type: 'body', size: 'small', className: "text-gray-500 px-4", children: "OR" }), _jsx(Flex, { className: "flex-1 border-t border-gray-300" })] })] }), _jsx(Button, { label: "Login with Email & Password", isFullWidth: true, variant: "secondary", leftIcon: _jsx(MailIcon, {}), onClick: onPressBack }), client?.mobileLoginEnabled &&
48
- _jsx(Button, { label: "Login with Mobile Number", isFullWidth: true, className: "mt-6", leftIcon: _jsx(Smartphone, {}), variant: "text", onClick: handleMobileLogin })] }) }));
49
- };
50
- export default SSOAuthenticationMethods;
@@ -1,59 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import React, { useEffect, useState } from 'react';
3
- import { Text } from '@ui-kitten/components';
4
- import { Image, View } from 'react-native';
5
- import { Colors, RoundedButton } from '@truworth/twc-rn-common';
6
- import { useNavigation } from '@react-navigation/native';
7
- import { useSSOAuthenticationMethods } from './hooks/internal/useSSOAuthenticationMethods';
8
- import { useAuthPackageContext } from '../../../hooks/internal/useAuthPackageContext';
9
- import { ScreenLayout } from '../../../components/ScreenLayout';
10
- import FastImage from 'react-native-fast-image';
11
- import Logo from '../../../../assets/logo.svg';
12
- const { primary, gray } = Colors;
13
- const SSOAuthenticationMethods = ({ route }) => {
14
- const { client } = route.params;
15
- const [aspectRatio, setAspectRatio] = useState(1);
16
- const navigation = useNavigation();
17
- const { loading, initiateSSOLogin } = useSSOAuthenticationMethods();
18
- const { LogoComponent } = useAuthPackageContext();
19
- useEffect(() => {
20
- if (client.image) {
21
- Image.getSize(client.image, (width, height) => {
22
- setAspectRatio(width / height);
23
- }, (error) => {
24
- console.warn('Failed to load client image:', error);
25
- // Optionally show a user message or use a fallback
26
- });
27
- }
28
- }, [client]);
29
- const renderLogo = () => {
30
- if (!LogoComponent) {
31
- return (_jsx(View, { style: { marginTop: 70, alignSelf: 'center' }, children: _jsx(Logo, {}) }));
32
- }
33
- // If it's already a React element, return it as is
34
- if (React.isValidElement(LogoComponent)) {
35
- return LogoComponent;
36
- }
37
- // If it's a function component, render it
38
- if (typeof LogoComponent === 'function') {
39
- const Component = LogoComponent;
40
- return _jsx(Component, {});
41
- }
42
- // Fallback to default logo
43
- return (_jsx(View, { style: { marginTop: 70, alignSelf: 'center' }, children: _jsx(Logo, {}) }));
44
- };
45
- const onSSOLoginInitiated = (result) => {
46
- navigation.navigate('SSOAuthWebView', {
47
- clientId: result.clientId,
48
- authenticationUrl: result.authenticationUrl,
49
- redirectUri: result.redirectUri,
50
- authMethod: result.authMethod,
51
- });
52
- };
53
- return (_jsx(ScreenLayout, { title: "", containerStyle: { flex: 1, backgroundColor: primary.white }, children: _jsxs(View, { style: { flex: 1, justifyContent: 'center' }, children: [client.image ?
54
- _jsx(FastImage, { source: { uri: client.image }, resizeMode: 'contain', style: { width: 180, aspectRatio: aspectRatio, alignSelf: 'center', marginTop: -150 } })
55
- : renderLogo(), _jsx(Text, { style: { textAlign: 'center', fontSize: 24, fontWeight: '600', color: gray.gray_700, marginTop: 30 }, children: "Select how to sign-in" }), client?.ssoEnabled &&
56
- _jsxs(_Fragment, { children: [_jsx(RoundedButton, { loading: loading, type: 'primary', label: 'Login with SSO', size: 'large', containerStyle: { marginTop: 40 }, onPress: () => initiateSSOLogin({ clientId: client.id, onSSOLoginInitiated }), leftIcon: 'key-outline' }), _jsx(Text, { style: { textAlign: 'center', fontSize: 14, color: gray.gray_700, marginTop: 20 }, children: "Recommended for quick access" }), _jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', marginTop: 30, marginHorizontal: 30 }, children: [_jsx(View, { style: { flex: 1, height: 1, backgroundColor: gray.gray_200 } }), _jsx(View, { children: _jsx(Text, { style: { width: 50, textAlign: 'center', color: gray.gray_500, fontSize: 16 }, children: "OR" }) }), _jsx(View, { style: { flex: 1, height: 1, backgroundColor: gray.gray_200 } })] })] }), _jsx(RoundedButton, { type: 'secondary', label: 'Login with Email & Password', size: 'large', containerStyle: { marginTop: 30 }, onPress: () => navigation.navigate('EnterEmail'), leftIcon: 'mail-outline' }), client?.mobileLoginEnabled &&
57
- _jsx(RoundedButton, { type: 'text', label: 'Login with Mobile Number', size: 'large', containerStyle: { marginHorizontal: 16, marginTop: 30 }, onPress: () => navigation.navigate('EnterMobile'), leftIcon: 'phone-portrait-outline' })] }) }));
58
- };
59
- export default SSOAuthenticationMethods;
@@ -1,62 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { useEffect, useState } from 'react';
3
- import { Flex, Typography } from '@truworth/twc-web-design';
4
- import { useSSOCallback } from '../../hooks/internal/useSSOCallback';
5
- import { useNavigator } from '../../../../../hooks/useNavigator';
6
- import { LoadingAnimation } from '../../../../../components/LoadingAnimation';
7
- import { RegistrationMethod } from '../../../../../enums';
8
- const SSOCallbackComponents = ({ authMethodOverride } = {}) => {
9
- const navigator = useNavigator();
10
- const [clientId, setClientId] = useState('');
11
- const [code, setCode] = useState('');
12
- const [authMethod, setAuthMethod] = useState(authMethodOverride ?? null);
13
- const [isReady, setIsReady] = useState(false);
14
- // Resolve code from query params; clientId from localStorage (only needed for OIDC)
15
- useEffect(() => {
16
- const query = navigator.query;
17
- const codeFromQuery = query.code;
18
- if (typeof window !== 'undefined') {
19
- try {
20
- // clientId only needed for OIDC, not SAML
21
- const storedClientId = localStorage.getItem('clientId') || '';
22
- const storedAuthMethod = localStorage.getItem('authMethod') || 'oidc';
23
- setClientId(storedClientId);
24
- if (!authMethodOverride) {
25
- setAuthMethod(storedAuthMethod);
26
- }
27
- setCode(typeof codeFromQuery === 'string' ? codeFromQuery : '');
28
- setIsReady(true);
29
- }
30
- catch (error) {
31
- console.log('Failed to read from localStorage:', error);
32
- setCode(typeof codeFromQuery === 'string' ? codeFromQuery : '');
33
- setIsReady(true);
34
- }
35
- }
36
- }, [navigator.query, authMethodOverride]);
37
- const { result, error } = useSSOCallback({
38
- clientId,
39
- code,
40
- authMethod: authMethod ?? 'oidc',
41
- isReady,
42
- });
43
- useEffect(() => {
44
- if (result?.registrationToken) {
45
- navigator.pushAbsolute('/registration', {
46
- query: {
47
- registrationMethod: RegistrationMethod.SSO,
48
- ...result,
49
- }
50
- });
51
- }
52
- }, [result, navigator]);
53
- useEffect(() => {
54
- if (error) {
55
- setTimeout(() => {
56
- navigator.back();
57
- }, 1500);
58
- }
59
- }, [error, navigator]);
60
- return (_jsx(Flex, { justify: 'center', align: 'center', className: 'h-[100vh]', children: _jsxs("div", { children: [_jsx(LoadingAnimation, { height: 230, width: 250 }), _jsx(Typography, { size: 'h6', type: 'heading', color: 'gray-400', children: "Authenticating and Redirecting ..." })] }) }));
61
- };
62
- export { SSOCallbackComponents };
@@ -1,6 +0,0 @@
1
- const SSOCallbackComponents = () => {
2
- if (__DEV__)
3
- console.warn("[@truworth/twc-auth] we use only SSOCallbackComponents for login");
4
- return null;
5
- };
6
- export { SSOCallbackComponents };
@@ -1,58 +0,0 @@
1
- import { useCallback, useEffect, useState } from "react";
2
- import { axiosClient } from "../../../../../api/axiosClient";
3
- import { showMessage } from "../../../../../helpers/show-message";
4
- import { useAuthPackageContext } from "../../../../../hooks/internal/useAuthPackageContext";
5
- import { RegistrationMethod } from "../../../../../enums";
6
- /**
7
- * @internal
8
- * Hook for managing SSOCallback screen state and auth context integration.
9
- * This hook is not exposed to package consumers.
10
- *
11
- * Supports both OIDC and SAML flows:
12
- * - OIDC: Calls /callback endpoint with authorization code
13
- * - SAML: Calls /saml-sso-complete endpoint with exchange code
14
- */
15
- const useSSOCallback = ({ clientId, code, authMethod, isReady = true }) => {
16
- const [error, setError] = useState(null);
17
- const [result, setResult] = useState(null);
18
- const [hasProcessed, setHasProcessed] = useState(false);
19
- const { onLogin, onRegistrationMethodChange, onTokenChange } = useAuthPackageContext();
20
- const processSSOCallback = useCallback((codeToProcess) => {
21
- setError(null);
22
- // SAML: Use simplified endpoint that doesn't require clientId
23
- // OIDC: Use legacy endpoint with clientId
24
- const endpoint = authMethod === 'saml'
25
- ? `/auth/saml/complete`
26
- : `/auth/login-sso/${clientId}/callback`;
27
- axiosClient({
28
- url: endpoint,
29
- method: 'POST',
30
- data: { code: codeToProcess },
31
- }).then((res) => {
32
- if (res?.data?.registrationToken) {
33
- onRegistrationMethodChange(RegistrationMethod.SSO);
34
- setResult(res.data);
35
- }
36
- else {
37
- onTokenChange(res?.data?.token);
38
- return onLogin({ token: res?.data?.token, member: res?.data?.member });
39
- }
40
- }).catch((error) => {
41
- const errorMessage = error?.response?.data?.errors?.[0]?.message || 'Something went wrong';
42
- setError(errorMessage);
43
- return showMessage({ message: errorMessage });
44
- });
45
- }, [clientId, authMethod, onLogin, onRegistrationMethodChange, onTokenChange]);
46
- useEffect(() => {
47
- if (!isReady || !code || hasProcessed)
48
- return;
49
- // SAML only needs code; OIDC needs both code and clientId
50
- const canProcess = authMethod === 'saml' || clientId;
51
- if (canProcess) {
52
- setHasProcessed(true);
53
- processSSOCallback(code);
54
- }
55
- }, [isReady, code, clientId, authMethod, hasProcessed, processSSOCallback]);
56
- return { result, error };
57
- };
58
- export { useSSOCallback };
@@ -1,9 +0,0 @@
1
- const SSOCallback = () => {
2
- if (process.env.NODE_ENV !== 'production') {
3
- if (typeof window !== 'undefined') {
4
- console.warn("[@truworth/twc-auth] We use only SSOCallback for app screen");
5
- }
6
- }
7
- return null;
8
- };
9
- export default SSOCallback;
@@ -1,35 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect } from 'react';
3
- import { BackHandler, View } from 'react-native';
4
- import { Layout, Text } from '@ui-kitten/components';
5
- import { Colors } from '@truworth/twc-rn-common';
6
- import { useSSOCallback } from './hooks/internal/useSSOCallback';
7
- import loadingSpinner from '../../../../assets/loading-spinner.json';
8
- import Lottie from 'lottie-react-native';
9
- const { gray } = Colors;
10
- const SSOCallback = ({ navigation, route }) => {
11
- const { clientId, code, authMethod } = route.params;
12
- const { result, error } = useSSOCallback({ clientId, code, authMethod });
13
- useEffect(() => {
14
- if (result?.registrationToken) {
15
- navigation.replace('SignUp', { ...result });
16
- }
17
- }, [result, navigation]);
18
- useEffect(() => {
19
- if (error) {
20
- navigation.goBack();
21
- }
22
- }, [error, navigation]);
23
- useEffect(() => {
24
- const backAction = () => {
25
- if (!result && !error) {
26
- return true;
27
- }
28
- return false;
29
- };
30
- const backHandler = BackHandler.addEventListener("hardwareBackPress", backAction);
31
- return () => backHandler.remove();
32
- }, [result, error]);
33
- return (_jsx(Layout, { style: { flex: 1 }, children: _jsx(View, { style: { flex: 1, justifyContent: 'center' }, children: _jsxs(View, { style: { marginTop: -200 }, children: [_jsx(Lottie, { source: loadingSpinner, autoPlay: true, loop: true, style: { width: 200, alignSelf: 'center' } }), _jsx(Text, { style: { textAlign: 'center', fontSize: 18, color: gray.gray_700, fontWeight: '600' }, children: "Authenticating & Redirecting..." })] }) }) }));
34
- };
35
- export default SSOCallback;
@@ -1 +0,0 @@
1
- export {};
@@ -1,71 +0,0 @@
1
- import { useCallback, useEffect, useRef, useState } from "react";
2
- import { axiosClient } from "../../../../../api/axiosClient";
3
- import { showMessage } from "../../../../../helpers/show-message";
4
- /**
5
- * @internal
6
- * Hook for managing SSOSearchOrganization screen state and auth context integration.
7
- * This hook is not exposed to package consumers.
8
- */
9
- const useSSOSearchOrganization = () => {
10
- const [search, setSearch] = useState('');
11
- const [noSearchResult, setNoSearchResult] = useState(false);
12
- const [searchLoading, setSearchLoading] = useState(false);
13
- const [selectedClient, setSelectedClient] = useState(undefined);
14
- const [clientList, setClientList] = useState([]);
15
- const latestQueryRef = useRef('');
16
- const handleSearch = useCallback(() => {
17
- const query = search.trim();
18
- if (query.length > 2) {
19
- latestQueryRef.current = query;
20
- setNoSearchResult(false);
21
- setSearchLoading(true);
22
- axiosClient({
23
- url: `/auth/login-sso/search-clients`,
24
- method: 'POST',
25
- data: { query },
26
- }).then((res) => {
27
- if (latestQueryRef.current !== query)
28
- return;
29
- if (!res.data.length) {
30
- setNoSearchResult(true);
31
- return;
32
- }
33
- setClientList(res.data);
34
- }).catch((error) => {
35
- if (latestQueryRef.current !== query)
36
- return;
37
- showMessage({ message: error?.response?.data?.errors?.[0]?.message || 'Something went wrong' });
38
- }).finally(() => {
39
- if (latestQueryRef.current !== query)
40
- return;
41
- setSearchLoading(false);
42
- });
43
- }
44
- else {
45
- setClientList([]);
46
- setNoSearchResult(false);
47
- setSearchLoading(false);
48
- }
49
- }, [search]);
50
- const handleSelect = (client) => {
51
- setSelectedClient(client);
52
- setClientList([]);
53
- };
54
- useEffect(() => {
55
- setClientList([]);
56
- const timerId = setTimeout(handleSearch, 1000);
57
- return () => clearTimeout(timerId);
58
- }, [handleSearch]);
59
- return {
60
- search,
61
- clientList,
62
- searchLoading,
63
- noSearchResult,
64
- selectedClient,
65
- setSearch,
66
- handleSelect,
67
- setNoSearchResult,
68
- setSelectedClient,
69
- };
70
- };
71
- export { useSSOSearchOrganization };
@@ -1,46 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import { AutoCompleteField, Flex, Typography } from "@truworth/twc-web-design";
4
- import { ChevronDown, Search } from "lucide-react";
5
- import { useSSOSearchOrganization } from "./hooks/internal/useSSOSearchOrganization";
6
- import { ScreenLayout } from "../../../components/ScreenLayout";
7
- import _ from "lodash";
8
- const SSOSearchOrganization = ({ onPressBack, onContinue }) => {
9
- const [inputActive, setInputActive] = useState(false);
10
- const { search, clientList, selectedClient, searchLoading, noSearchResult, setSearch, setSelectedClient, setNoSearchResult, handleSelect, } = useSSOSearchOrganization();
11
- return (_jsx(ScreenLayout, { title: "Search Organization", onPressBack: onPressBack, buttonProps: {
12
- label: "Continue",
13
- variant: "primary",
14
- disabled: _.isEmpty(selectedClient),
15
- onClick: () => {
16
- if (!_.isEmpty(selectedClient)) {
17
- onContinue(selectedClient);
18
- setSelectedClient(undefined);
19
- return;
20
- }
21
- },
22
- }, children: _jsx(AutoCompleteField, { type: "text", loading: searchLoading, onSelect: (e, option) => {
23
- if (!option)
24
- return;
25
- const typedOption = option;
26
- const client = typedOption.client;
27
- if (client)
28
- handleSelect(client);
29
- }, className: "my-4", onFocus: () => { setInputActive(true); }, onSearch: (value) => setSearch(value.trimStart()), placeholder: "Enter at least 3 characters to search...", debounceTimer: 300, value: selectedClient ? selectedClient.name : search, onChange: () => {
30
- setNoSearchResult(false);
31
- setSelectedClient(undefined);
32
- }, leftIcon: false, rightIcon: inputActive && !selectedClient
33
- ? _jsx(Search, { size: 20, className: "text-gray-600 flex" })
34
- : _jsx(ChevronDown, { size: 20, className: "text-gray-600 flex" }), notFoundContent: noSearchResult ?
35
- _jsx(Flex, { padding: "sm", className: "rounded-lg", children: _jsx(Typography, { type: "body", size: "large", className: "text-gray-900", children: `No result found for "${search}"` }) })
36
- : null, options: clientList.map((item) => {
37
- return {
38
- key: item.id,
39
- value: item.name,
40
- image: item.image,
41
- client: item,
42
- label: (_jsxs(Flex, { align: "center", className: "gap-2", children: [_jsx("img", { src: item.image, width: 32, height: 32, className: "h-auto" }), _jsxs(Typography, { type: "body", size: "medium", children: [" ", item.name] })] })),
43
- };
44
- }) }) }));
45
- };
46
- export default SSOSearchOrganization;
@@ -1,37 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Text } from '@ui-kitten/components';
3
- import { ActivityIndicator, FlatList, TouchableOpacity, View } from 'react-native';
4
- import { AvatarWithInitials, Colors, SearchField } from '@truworth/twc-rn-common';
5
- import { useSSOSearchOrganization } from './hooks/internal/useSSOSearchOrganization';
6
- import { ScreenLayout } from '../../../components/ScreenLayout';
7
- const { primary, gray, utility, shades_tints } = Colors;
8
- const SSOSearchOrganization = ({ navigation }) => {
9
- const { search, setSearch, clientList, searchLoading, noSearchResult, setNoSearchResult } = useSSOSearchOrganization();
10
- return (_jsxs(ScreenLayout, { headerTitle: "Search Organization", containerStyle: {
11
- flex: 1, backgroundColor: utility.bg,
12
- paddingHorizontal: 0, paddingVertical: 0,
13
- paddingTop: 8
14
- }, title: "", children: [_jsx(SearchField, { value: search, placeholder: 'Enter at least 3 characters to search...', onChangeValue: (query) => setSearch(query.trimStart()), clearText: () => {
15
- setNoSearchResult(false);
16
- setSearch('');
17
- }, returnKeyType: 'search', autoFocus: true, accessoryRight: searchLoading ? _jsx(ActivityIndicator, { style: { marginRight: 8 } }) : null, showClearIcon: !searchLoading, containerStyle: { marginVertical: 8, marginHorizontal: 16 }, autoComplete: 'off' }), _jsx(FlatList, { data: clientList, contentContainerStyle: { paddingBottom: 32 }, renderItem: ({ item }) => (_jsxs(TouchableOpacity, { onPress: () => navigation.navigate('SSOAuthenticationMethods', { client: item }), activeOpacity: 0.8, style: {
18
- flexDirection: 'row',
19
- alignItems: 'center',
20
- backgroundColor: '#fff',
21
- padding: 16,
22
- marginTop: 8,
23
- borderRadius: 12,
24
- shadowOffset: { width: 0, height: 2 },
25
- shadowOpacity: 0.25,
26
- shadowRadius: 12,
27
- shadowColor: '#A6A6A6',
28
- elevation: 11,
29
- marginHorizontal: 10,
30
- }, children: [_jsx(AvatarWithInitials, { image: item.image, name: item.name ?? '', size: 'medium', containerStyle: {
31
- backgroundColor: item.image ? primary.white : shades_tints.p_light_800,
32
- height: 55, width: 55, borderRadius: 100,
33
- }, imageProps: { resizeMode: 'contain' }, titleStyle: { fontSize: 12, fontWeight: '500', color: shades_tints.p_dark_500 } }), _jsx(View, { style: { flex: 1, marginLeft: 8 }, children: _jsx(Text, { style: { fontSize: 14, fontWeight: '600', color: gray.gray_900 }, children: item.name }) })] })), ListEmptyComponent: noSearchResult ?
34
- _jsx(View, { style: { padding: 16 }, children: _jsx(Text, { style: { fontSize: 14, fontWeight: '900', color: gray.gray_900 }, children: `No result found for "${search}"` }) })
35
- : null })] }));
36
- };
37
- export default SSOSearchOrganization;