@truworth/twc-auth 1.2.2 → 1.2.4

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 (140) hide show
  1. package/build/assets/loading-spinner.json +1 -0
  2. package/build/src/api/auth.js +36 -0
  3. package/build/src/components/PasswordCriteria/hooks/usePasswordCriteria.js +1 -8
  4. package/build/src/components/PasswordCriteria/index.native.js +3 -3
  5. package/build/src/components/ScreenLayout/index.native.js +2 -2
  6. package/build/src/components/{EmailOTPVerify → VerifyEmailOTP}/index.js +2 -2
  7. package/build/src/components/VerifyEmailOTP/index.native.js +22 -0
  8. package/build/src/components/{VerifyOTP → VerifyMobileOTP}/index.js +2 -2
  9. package/build/src/components/{VerifyOTP → VerifyMobileOTP}/index.native.js +2 -2
  10. package/build/src/constants/defaultPolicy.js +9 -0
  11. package/build/src/contexts/AuthContext.js +1 -1
  12. package/build/src/enums/index.js +2 -0
  13. package/build/src/enums/loginMethod.enum.js +8 -0
  14. package/build/src/enums/registrationMethod.enum.js +7 -0
  15. package/build/src/helpers/Network.js +1 -1
  16. package/build/src/helpers/show-message/index.js +2 -2
  17. package/build/src/helpers/show-message/index.native.js +1 -1
  18. package/build/src/hooks/useRequest.js +1 -1
  19. package/build/src/index.js +3 -2
  20. package/build/src/navigator/index.native.js +8 -1
  21. package/build/src/screens/CreatePassword/hooks/internal/useCreatePassword.js +2 -15
  22. package/build/src/screens/EnterEmail/hooks/internal/useEnterEmail.js +22 -40
  23. package/build/src/screens/EnterEmail/index.js +7 -9
  24. package/build/src/screens/EnterEmail/index.native.js +11 -11
  25. package/build/src/screens/EnterEmail/types.js +1 -0
  26. package/build/src/screens/EnterPassword/index.js +25 -9
  27. package/build/src/screens/EnterPassword/index.native.js +28 -16
  28. package/build/src/screens/Login/components/LoginWebComponent/index.js +21 -4
  29. package/build/src/screens/LoginWithEmailOTP/hooks/internal/useLoginWithEmailOTP.js +72 -0
  30. package/build/src/screens/LoginWithEmailOTP/index.js +8 -0
  31. package/build/src/screens/LoginWithEmailOTP/index.native.js +10 -0
  32. package/build/src/screens/ResetPassword/hooks/internal/useResetPassword.js +55 -0
  33. package/build/src/screens/ResetPassword/index.js +46 -0
  34. package/build/src/screens/ResetPassword/index.native.js +26 -0
  35. package/build/src/screens/ResetPassword/types.js +1 -0
  36. package/build/src/screens/SSOLogin/AuthWebView/index.js +9 -0
  37. package/build/src/screens/SSOLogin/AuthWebView/index.native.js +27 -0
  38. package/build/src/screens/SSOLogin/AuthWebView/types.js +1 -0
  39. package/build/src/screens/SSOLogin/AuthenticationMethods/hooks/internal/useSSOAuthenticationMethods.js +38 -0
  40. package/build/src/screens/SSOLogin/AuthenticationMethods/index.js +48 -0
  41. package/build/src/screens/SSOLogin/AuthenticationMethods/index.native.js +58 -0
  42. package/build/src/screens/SSOLogin/AuthenticationMethods/types.js +1 -0
  43. package/build/src/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.js +59 -0
  44. package/build/src/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.native.js +6 -0
  45. package/build/src/screens/SSOLogin/SSOCallback/hooks/internal/useSSOCallback.js +42 -0
  46. package/build/src/screens/SSOLogin/SSOCallback/index.js +9 -0
  47. package/build/src/screens/SSOLogin/SSOCallback/index.native.js +35 -0
  48. package/build/src/screens/SSOLogin/SSOCallback/types.js +1 -0
  49. package/build/src/screens/SSOLogin/SearchOrganization/hooks/internal/useSSOSearchOrganization.js +71 -0
  50. package/build/src/screens/SSOLogin/SearchOrganization/index.js +46 -0
  51. package/build/src/screens/SSOLogin/SearchOrganization/index.native.js +37 -0
  52. package/build/src/screens/SSOLogin/SearchOrganization/types.js +1 -0
  53. package/build/src/screens/SignUp/components/SignUpForm/index.js +92 -66
  54. package/build/src/screens/SignUp/components/SignUpWebComponent/index.js +22 -53
  55. package/build/src/screens/SignUp/hooks/internal/useSignUp.js +77 -81
  56. package/build/src/screens/SignUp/index.native.js +76 -77
  57. package/build/src/screens/UserConsent/hooks/internal/useConsent.js +11 -4
  58. package/build/src/screens/UserConsent/index.js +38 -18
  59. package/build/src/screens/UserConsent/index.native.js +1 -1
  60. package/build/src/screens/VerifyEmail/hooks/internal/useVerifyEmail.js +3 -3
  61. package/build/src/screens/VerifyEmail/index.js +2 -2
  62. package/build/src/screens/VerifyEmail/index.native.js +2 -2
  63. package/build/src/screens/VerifyMobile/hooks/internal/useVerifyMobile.js +7 -7
  64. package/build/src/screens/VerifyMobile/index.js +2 -2
  65. package/build/src/screens/VerifyMobile/index.native.js +2 -2
  66. package/build/src/screens/VerifyResetPasswordOTP/hooks/internal/useVerifyResetPasswordOTP.js +74 -0
  67. package/build/src/screens/VerifyResetPasswordOTP/index.js +8 -0
  68. package/build/src/screens/VerifyResetPasswordOTP/index.native.js +14 -0
  69. package/build/src/screens/Welcome/index.js +2 -3
  70. package/build/src/screens/Welcome/index.native.js +1 -1
  71. package/build/src/types/types.js +2 -1
  72. package/build/types/api/auth.d.ts +11 -0
  73. package/build/types/components/PasswordCriteria/hooks/usePasswordCriteria.d.ts +2 -7
  74. package/build/types/components/ScreenLayout/index.native.d.ts +1 -1
  75. package/build/types/components/ScreenLayout/types.d.ts +1 -0
  76. package/build/types/components/VerifyEmailOTP/index.d.ts +3 -0
  77. package/build/types/components/VerifyEmailOTP/index.native.d.ts +3 -0
  78. package/build/types/components/{EmailOTPVerify/type.d.ts → VerifyEmailOTP/types.d.ts} +2 -2
  79. package/build/types/components/VerifyMobileOTP/index.d.ts +3 -0
  80. package/build/types/components/VerifyMobileOTP/index.native.d.ts +3 -0
  81. package/build/types/constants/defaultPolicy.d.ts +9 -0
  82. package/build/types/enums/index.d.ts +2 -0
  83. package/build/types/enums/loginMethod.enum.d.ts +7 -0
  84. package/build/types/enums/registrationMethod.enum.d.ts +6 -0
  85. package/build/types/helpers/show-message/index.d.ts +2 -2
  86. package/build/types/helpers/show-message/index.native.d.ts +2 -2
  87. package/build/types/helpers/show-message/types.d.ts +6 -2
  88. package/build/types/index.d.ts +3 -2
  89. package/build/types/navigator/index.native.d.ts +24 -1
  90. package/build/types/screens/EnterEmail/hooks/internal/useEnterEmail.d.ts +3 -4
  91. package/build/types/screens/EnterEmail/index.d.ts +2 -6
  92. package/build/types/screens/EnterEmail/types.d.ts +8 -0
  93. package/build/types/screens/EnterPassword/index.d.ts +1 -1
  94. package/build/types/screens/EnterPassword/index.native.d.ts +1 -1
  95. package/build/types/screens/EnterPassword/types.d.ts +17 -1
  96. package/build/types/screens/LoginWithEmailOTP/hooks/internal/useLoginWithEmailOTP.d.ts +14 -0
  97. package/build/types/screens/LoginWithEmailOTP/index.d.ts +4 -0
  98. package/build/types/screens/LoginWithEmailOTP/index.native.d.ts +4 -0
  99. package/build/types/screens/ResetPassword/hooks/internal/useResetPassword.d.ts +28 -0
  100. package/build/types/screens/ResetPassword/index.d.ts +3 -0
  101. package/build/types/screens/ResetPassword/index.native.d.ts +4 -0
  102. package/build/types/screens/ResetPassword/types.d.ts +11 -0
  103. package/build/types/screens/SSOLogin/AuthWebView/index.d.ts +2 -0
  104. package/build/types/screens/SSOLogin/AuthWebView/index.native.d.ts +4 -0
  105. package/build/types/screens/SSOLogin/AuthWebView/types.d.ts +8 -0
  106. package/build/types/screens/SSOLogin/AuthenticationMethods/hooks/internal/useSSOAuthenticationMethods.d.ts +9 -0
  107. package/build/types/screens/SSOLogin/AuthenticationMethods/index.d.ts +3 -0
  108. package/build/types/screens/SSOLogin/AuthenticationMethods/index.native.d.ts +4 -0
  109. package/build/types/screens/SSOLogin/AuthenticationMethods/types.d.ts +11 -0
  110. package/build/types/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.d.ts +2 -0
  111. package/build/types/screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index.native.d.ts +2 -0
  112. package/build/types/screens/SSOLogin/SSOCallback/hooks/internal/useSSOCallback.d.ts +11 -0
  113. package/build/types/screens/SSOLogin/SSOCallback/index.d.ts +2 -0
  114. package/build/types/screens/SSOLogin/SSOCallback/index.native.d.ts +4 -0
  115. package/build/types/screens/SSOLogin/SSOCallback/types.d.ts +11 -0
  116. package/build/types/screens/SSOLogin/SearchOrganization/hooks/internal/useSSOSearchOrganization.d.ts +18 -0
  117. package/build/types/screens/SSOLogin/SearchOrganization/index.d.ts +3 -0
  118. package/build/types/screens/SSOLogin/SearchOrganization/index.native.d.ts +4 -0
  119. package/build/types/screens/SSOLogin/SearchOrganization/types.d.ts +13 -0
  120. package/build/types/screens/SignUp/components/SignUpForm/index.d.ts +1 -1
  121. package/build/types/screens/SignUp/components/SignUpForm/type.d.ts +1 -4
  122. package/build/types/screens/SignUp/components/SignUpWebComponent/types.d.ts +1 -16
  123. package/build/types/screens/SignUp/hooks/internal/useSignUp.d.ts +16 -18
  124. package/build/types/screens/SignUp/types.d.ts +29 -7
  125. package/build/types/screens/UserConsent/hooks/internal/useConsent.d.ts +1 -1
  126. package/build/types/screens/UserConsent/index.d.ts +1 -1
  127. package/build/types/screens/UserConsent/types.d.ts +19 -13
  128. package/build/types/screens/VerifyResetPasswordOTP/hooks/internal/useVerifyResetPasswordOTP.d.ts +19 -0
  129. package/build/types/screens/VerifyResetPasswordOTP/index.d.ts +7 -0
  130. package/build/types/screens/VerifyResetPasswordOTP/index.native.d.ts +4 -0
  131. package/build/types/types/types.d.ts +24 -2
  132. package/package.json +7 -5
  133. package/build/src/components/EmailOTPVerify/index.native.js +0 -26
  134. package/build/types/components/EmailOTPVerify/index.d.ts +0 -3
  135. package/build/types/components/EmailOTPVerify/index.native.d.ts +0 -3
  136. package/build/types/components/VerifyOTP/index.d.ts +0 -3
  137. package/build/types/components/VerifyOTP/index.native.d.ts +0 -3
  138. /package/build/src/components/{VerifyOTP → VerifyEmailOTP}/types.js +0 -0
  139. /package/build/src/components/{EmailOTPVerify/type.js → VerifyMobileOTP/types.js} +0 -0
  140. /package/build/types/components/{VerifyOTP → VerifyMobileOTP}/types.d.ts +0 -0
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useVerifyEmail } from "./hooks/internal/useVerifyEmail";
3
- import { EmailOTPVerify } from "../../components/EmailOTPVerify";
3
+ import { VerifyEmailOTP } from "../../components/VerifyEmailOTP";
4
4
  const VerifyEmail = ({ email, sessionToken, onVerifiedOTP }) => {
5
5
  const { status, resendOTPCounter, validateOTP, resendOTP, } = useVerifyEmail({ sessionToken });
6
- return (_jsx(EmailOTPVerify, { email: email, status: status, resendOTPCounter: resendOTPCounter, validateOTP: (otp) => validateOTP?.({ otp, onVerifiedOTP }), resendOTP: resendOTP }));
6
+ return (_jsx(VerifyEmailOTP, { email: email, status: status, resendOTPCounter: resendOTPCounter, validateOTP: (otp) => validateOTP?.({ otp, onVerifiedOTP }), resendOTP: resendOTP }));
7
7
  };
8
8
  export default VerifyEmail;
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { EmailOTPVerify } from "../../components/EmailOTPVerify";
2
+ import { VerifyEmailOTP } from "../../components/VerifyEmailOTP";
3
3
  import { useVerifyEmail } from "./hooks/internal/useVerifyEmail";
4
4
  const VerifyEmail = ({ navigation, route }) => {
5
5
  const { phone, sessionToken, email } = route.params || {};
6
6
  const { status, resendOTPCounter, validateOTP, resendOTP, } = useVerifyEmail({ sessionToken });
7
- return (_jsx(EmailOTPVerify, { email: email, status: status, resendOTPCounter: resendOTPCounter, validateOTP: (otp) => validateOTP?.({
7
+ return (_jsx(VerifyEmailOTP, { email: email, status: status, resendOTPCounter: resendOTPCounter, validateOTP: (otp) => validateOTP?.({
8
8
  otp,
9
9
  onVerifiedOTP: ({ sessionToken }) => {
10
10
  navigation.navigate('VerifyMobile', { phone, sessionToken });
@@ -30,13 +30,13 @@ const useVerifyMobile = ({ sessionToken }) => {
30
30
  method: 'POST',
31
31
  data: { sessionToken: sessionTokenState },
32
32
  }).then((res) => {
33
- setSessionToken(res.data.sessionToken);
34
33
  setStatus('timer');
35
34
  setTimer(initialTimer);
35
+ setSessionToken(res.data.sessionToken);
36
36
  }).catch((err) => {
37
37
  console.log(err);
38
- const msg = err?.response?.data?.errors?.[0]?.message ?? 'Unable to send OTP. Please try again.';
39
- showMessage(msg);
38
+ const message = err?.response?.data?.errors?.[0]?.message ?? 'Unable to send OTP. Please try again.';
39
+ showMessage({ message });
40
40
  setStatus('timer');
41
41
  });
42
42
  }, [sessionTokenState]);
@@ -47,18 +47,18 @@ const useVerifyMobile = ({ sessionToken }) => {
47
47
  method: 'POST',
48
48
  data: { otp, sessionToken: sessionTokenState },
49
49
  }).then((res) => {
50
- setStatus('valid');
51
50
  const { token, member } = res.data;
52
51
  onLogin({ token, member });
52
+ setStatus('valid');
53
53
  }).catch((err) => {
54
54
  if (err?.response?.status === 400) {
55
55
  setStatus('invalid');
56
56
  setTimeout(() => setStatus('timer'), 5000);
57
- showMessage(err?.response?.data?.errors?.[0]?.message ?? 'Invalid OTP. Please try again.');
57
+ showMessage({ message: err?.response?.data?.errors?.[0]?.message ?? 'Invalid OTP. Please try again.' });
58
58
  }
59
59
  else {
60
- const msg = err?.response?.data?.errors?.[0]?.message ?? 'Verification failed. Please try again.';
61
- showMessage(msg);
60
+ const message = err?.response?.data?.errors?.[0]?.message ?? 'Verification failed. Please try again.';
61
+ showMessage({ message });
62
62
  setStatus('timer');
63
63
  }
64
64
  });
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { OTPVerify } from "../../components/VerifyOTP";
2
+ import { VerifyMobileOTP } from "../../components/VerifyMobileOTP";
3
3
  import { useVerifyMobile } from "./hooks/internal/useVerifyMobile";
4
4
  const VerifyMobile = ({ sessionToken, phone }) => {
5
5
  const { timer, status, validateOTP, resendOTP, } = useVerifyMobile({ sessionToken });
6
- return (_jsx(OTPVerify, { timer: timer, phone: phone, status: status, validateOTP: validateOTP, resendOTP: resendOTP }));
6
+ return (_jsx(VerifyMobileOTP, { timer: timer, phone: phone, status: status, validateOTP: validateOTP, resendOTP: resendOTP }));
7
7
  };
8
8
  export default VerifyMobile;
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { OTPVerify } from '../../components/VerifyOTP';
2
+ import { VerifyMobileOTP } from '../../components/VerifyMobileOTP';
3
3
  import { useVerifyMobile } from './hooks/internal/useVerifyMobile';
4
4
  const VerifyMobile = ({ route }) => {
5
5
  const { sessionToken, phone } = route.params || {};
6
6
  const { timer, status, validateOTP, resendOTP, } = useVerifyMobile({ sessionToken });
7
- return (_jsx(OTPVerify, { timer: timer, phone: phone, status: status, validateOTP: validateOTP, resendOTP: resendOTP }));
7
+ return (_jsx(VerifyMobileOTP, { timer: timer, phone: phone, status: status, validateOTP: validateOTP, resendOTP: resendOTP }));
8
8
  };
9
9
  export default VerifyMobile;
@@ -0,0 +1,74 @@
1
+ import { useCallback, useEffect, useState, useRef } from "react";
2
+ import { showMessage } from "../../../../helpers/show-message";
3
+ import { axiosClient } from "../../../../api/axiosClient";
4
+ /**
5
+ * @internal
6
+ * Hook for managing VerifyResetPasswordOTP screen state and auth context integration.
7
+ * This hook is not exposed to package consumers.
8
+ */
9
+ const useVerifyResetPasswordOTP = ({ email }) => {
10
+ const [resendOTPCounter, setResendOTPCounter] = useState(0);
11
+ const [status, setStatus] = useState("idle");
12
+ const resetStatusTimeoutRef = useRef();
13
+ const sessionTokenRef = useRef('');
14
+ const scheduleStatusReset = (delay) => {
15
+ if (resetStatusTimeoutRef.current) {
16
+ clearTimeout(resetStatusTimeoutRef.current);
17
+ }
18
+ resetStatusTimeoutRef.current = setTimeout(() => setStatus('idle'), delay);
19
+ };
20
+ const sendOtp = useCallback(() => {
21
+ setStatus('loading');
22
+ axiosClient({
23
+ url: '/auth/reset-password/send-otp',
24
+ method: 'POST',
25
+ data: { email },
26
+ }).then((res) => {
27
+ setResendOTPCounter(prevCounter => prevCounter + 1);
28
+ sessionTokenRef.current = res.data.sessionToken;
29
+ }).catch((error) => {
30
+ console.error('Failed to send OTP:', error);
31
+ const message = error?.response?.data?.errors?.[0]?.message || "Failed to send OTP. Please try again.";
32
+ showMessage({ message });
33
+ }).finally(() => setStatus("idle"));
34
+ }, [email]);
35
+ const verifyOtp = useCallback(({ otp, onVerifiedOTP }) => {
36
+ setStatus('loading');
37
+ axiosClient({
38
+ url: "/auth/reset-password/verify-otp",
39
+ method: "POST",
40
+ data: { sessionToken: sessionTokenRef.current, otp },
41
+ }).then((res) => {
42
+ setStatus('valid');
43
+ onVerifiedOTP({ sessionToken: res.data.sessionToken });
44
+ scheduleStatusReset(0);
45
+ }).catch((error) => {
46
+ const message = error?.response?.data?.errors?.[0]?.message ||
47
+ (error?.response?.status === 400
48
+ ? "Invalid OTP. Please try again."
49
+ : "Verification failed. Please try again.");
50
+ showMessage({ message });
51
+ setStatus(error?.response?.status === 400 ? "invalid" : "idle");
52
+ if (error?.response?.status === 400) {
53
+ scheduleStatusReset(5000);
54
+ }
55
+ });
56
+ }, []);
57
+ useEffect(() => () => {
58
+ if (resetStatusTimeoutRef.current) {
59
+ clearTimeout(resetStatusTimeoutRef.current);
60
+ }
61
+ }, []);
62
+ useEffect(() => {
63
+ if (email) {
64
+ sendOtp();
65
+ }
66
+ }, [email, sendOtp]);
67
+ return {
68
+ status,
69
+ resendOTPCounter,
70
+ sendOtp,
71
+ verifyOtp,
72
+ };
73
+ };
74
+ export { useVerifyResetPasswordOTP };
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useVerifyResetPasswordOTP } from "./hooks/internal/useVerifyResetPasswordOTP";
3
+ import { VerifyEmailOTP } from "../../components/VerifyEmailOTP";
4
+ const VerifyResetPasswordOTP = ({ email, onVerifiedOTP }) => {
5
+ const { status, resendOTPCounter, sendOtp, verifyOtp, } = useVerifyResetPasswordOTP({ email });
6
+ return (_jsx(VerifyEmailOTP, { email: email, validateOTP: (otp) => verifyOtp({ otp, onVerifiedOTP }), resendOTP: sendOtp, status: status, resendOTPCounter: resendOTPCounter }));
7
+ };
8
+ export default VerifyResetPasswordOTP;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useVerifyResetPasswordOTP } from './hooks/internal/useVerifyResetPasswordOTP';
3
+ import { VerifyEmailOTP } from '../../components/VerifyEmailOTP';
4
+ const VerifyResetPasswordOTP = ({ navigation, route }) => {
5
+ const { email } = route.params;
6
+ const { status, resendOTPCounter, sendOtp, verifyOtp, } = useVerifyResetPasswordOTP({ email });
7
+ return (_jsx(VerifyEmailOTP, { email: email, validateOTP: (otp) => {
8
+ verifyOtp({
9
+ otp,
10
+ onVerifiedOTP: ({ sessionToken }) => navigation.navigate('ResetPassword', { sessionToken, email })
11
+ });
12
+ }, resendOTP: sendOtp, status: status, resendOTPCounter: resendOTPCounter }));
13
+ };
14
+ export default VerifyResetPasswordOTP;
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from "react";
3
- import Image from "next/image";
4
3
  import { CDN_IMAGES_URL, IonIcon } from "@truworth/twc-web-common";
5
4
  import { Button, Flex, Typography } from "@truworth/twc-web-design";
6
5
  import { AdvancedTransitionWrapper } from "../../components/AdvancedTransitionWrapper";
@@ -9,7 +8,7 @@ const Welcome = ({ onClickEnterEmail }) => {
9
8
  const { LogoComponent } = useWelcome();
10
9
  const renderLogo = () => {
11
10
  if (!LogoComponent) {
12
- return (_jsx(Image, { alt: "Truworth Wellness logo", width: 160, height: 35, className: 'md:mt-0 mt-6 md:h-[40px] h-[30px]', src: `${CDN_IMAGES_URL}/new-twc_logo.svg` }));
11
+ 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` }));
13
12
  }
14
13
  // If it's already a React element, return it as is
15
14
  if (React.isValidElement(LogoComponent)) {
@@ -21,7 +20,7 @@ const Welcome = ({ onClickEnterEmail }) => {
21
20
  return _jsx(Component, {});
22
21
  }
23
22
  // Fallback to default logo
24
- return (_jsx(Image, { alt: "Truworth Wellness logo", width: 160, height: 35, className: 'md:mt-0 mt-6 md:h-[40px] h-[30px]', src: `${CDN_IMAGES_URL}/new-twc_logo.svg` }));
23
+ 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` }));
25
24
  };
26
25
  return (_jsx(AdvancedTransitionWrapper, { type: 'slide', duration: 0.3, children: _jsxs(Flex, { justify: 'center', align: "center", direction: 'column', className: 'h-screen w-[80%] mx-auto gap-6', children: [renderLogo(), _jsxs(Flex, { justify: "center", align: "center", direction: "column", className: 'gap-2', children: [_jsx(Typography, { type: 'heading', size: 'h5', className: 'text-center text-[#1A1A1A] font-semibold', children: "Welcome!" }), _jsx(Typography, { type: 'utility', size: 'large', color: "gray-400", className: 'text-center font-semibold', children: "Select an option to proceed" })] }), _jsx(Button, { label: "Enter Your Email", variant: "secondary", onClick: onClickEnterEmail, leftIcon: _jsx(IonIcon, { name: "mail", style: { fontSize: 20 } }), isFullWidth: true })] }) }));
27
26
  };
@@ -36,6 +36,6 @@ const Welcome = ({ navigation }) => {
36
36
  }, children: "Welcome!" }), _jsx(Text, { style: {
37
37
  fontSize: 16, fontWeight: '500', color: gray.gray_400,
38
38
  marginTop: 4, lineHeight: 24, textAlign: 'center',
39
- }, children: "Select an option to proceed" }), _jsx(View, { style: { marginTop: 48 }, children: _jsx(RoundedButton, { type: "secondary", label: "Enter Your Email", leftIcon: "mail", size: "large", onPress: () => navigation.navigate('EnterEmail') }) })] }) }), _jsx(LoadingModal, { loading: loading })] }));
39
+ }, children: "Select an option to proceed" }), _jsxs(View, { style: { marginTop: 48 }, children: [_jsx(RoundedButton, { type: "secondary", label: "Enter Your Email", leftIcon: "mail", size: "large", onPress: () => navigation.navigate('EnterEmail') }), _jsx(RoundedButton, { type: "outline", label: "Search Your Organization", leftIcon: "key", containerStyle: { marginTop: 24 }, size: "large", onPress: () => navigation.navigate('SSOSearchOrganization') })] })] }) }), _jsx(LoadingModal, { loading: loading })] }));
40
40
  };
41
41
  export default Welcome;
@@ -1 +1,2 @@
1
- export {};
1
+ import { RegistrationMethod as RegistrationMethodEnum } from '../enums';
2
+ ;
@@ -0,0 +1,11 @@
1
+ /** Check if mobile exists */
2
+ declare const checkMobileExists: (phone: string) => Promise<{
3
+ mobileExist: boolean;
4
+ linkedAccounts?: any[];
5
+ }>;
6
+ /** Check if email exists */
7
+ declare const checkEmailExists: (email: string) => Promise<{
8
+ emailExist: boolean;
9
+ loginType?: number;
10
+ }>;
11
+ export { checkMobileExists, checkEmailExists };
@@ -1,13 +1,8 @@
1
1
  import type { UsePasswordCriteriaProps } from "../types";
2
+ import type { PasswordPolicy } from "../../../types/types";
2
3
  declare const usePasswordCriteria: ({ email, password, onCriteriaChange, onMaxLengthChange }: UsePasswordCriteriaProps) => {
3
4
  loading: boolean;
4
- passwordPolicy: {
5
- minLength: number;
6
- numbers: boolean;
7
- uppercase: boolean;
8
- lowercase: boolean;
9
- specialCharacters: boolean;
10
- };
5
+ passwordPolicy: PasswordPolicy;
11
6
  renderLabel: (criteria: string) => string;
12
7
  };
13
8
  export { usePasswordCriteria };
@@ -1,3 +1,3 @@
1
1
  import type { ScreenLayoutProps } from './types';
2
- declare const ScreenLayout: ({ children, title, subTitle, hideHeader, buttonProps, containerStyle, accessoryRight }: ScreenLayoutProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const ScreenLayout: ({ children, headerTitle, title, subTitle, hideHeader, buttonProps, containerStyle, accessoryRight }: ScreenLayoutProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export { ScreenLayout };
@@ -1,5 +1,6 @@
1
1
  import type { ViewStyle } from "react-native";
2
2
  interface ScreenLayoutProps {
3
+ headerTitle?: string;
3
4
  title: React.ReactNode;
4
5
  subTitle?: React.ReactNode;
5
6
  children?: React.ReactNode;
@@ -0,0 +1,3 @@
1
+ import type { VerifyEmailOTPProps } from "./types";
2
+ declare const VerifyEmailOTP: ({ validateOTP, resendOTP, resendOTPCounter, email, status }: VerifyEmailOTPProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { VerifyEmailOTP };
@@ -0,0 +1,3 @@
1
+ import type { VerifyEmailOTPProps } from "./types";
2
+ declare const VerifyEmailOTP: ({ email, status, validateOTP, resendOTP, resendOTPCounter }: VerifyEmailOTPProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { VerifyEmailOTP };
@@ -1,9 +1,9 @@
1
1
  import type { OTPStatus } from "../OTPStatusLabel/types";
2
- type EmailOTPVerifyProps = {
2
+ type VerifyEmailOTPProps = {
3
3
  validateOTP: (otp: string) => void | Promise<void>;
4
4
  resendOTP: () => void | Promise<void>;
5
5
  resendOTPCounter: number;
6
6
  email?: string;
7
7
  status: OTPStatus | string;
8
8
  };
9
- export type { EmailOTPVerifyProps };
9
+ export type { VerifyEmailOTPProps };
@@ -0,0 +1,3 @@
1
+ import type { OTPVerifyProps } from "./types";
2
+ declare const VerifyMobileOTP: ({ validateOTP, timer, resendOTP, phone, status, resendTextClassName }: OTPVerifyProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { VerifyMobileOTP };
@@ -0,0 +1,3 @@
1
+ import type { OTPVerifyProps } from './types';
2
+ declare const VerifyMobileOTP: ({ validateOTP, timer, status, resendOTP, phone }: OTPVerifyProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { VerifyMobileOTP };
@@ -0,0 +1,9 @@
1
+ declare const defaultPolicy: {
2
+ minLength: number;
3
+ maxLength: number;
4
+ numbers: boolean;
5
+ uppercase: boolean;
6
+ lowercase: boolean;
7
+ specialCharacters: boolean;
8
+ };
9
+ export { defaultPolicy };
@@ -0,0 +1,2 @@
1
+ export * from './registrationMethod.enum';
2
+ export * from './loginMethod.enum';
@@ -0,0 +1,7 @@
1
+ export declare enum LoginMethodCode {
2
+ EmailPassword = 1,
3
+ Facebook = 2,
4
+ Google = 3,
5
+ Apple = 4,
6
+ SSO = 5
7
+ }
@@ -0,0 +1,6 @@
1
+ export declare enum RegistrationMethod {
2
+ EMAIL = "email",
3
+ SSO = "sso",
4
+ MOBILE = "mobile",
5
+ SOCIAL = "social"
6
+ }
@@ -1,3 +1,3 @@
1
- import type { MessageHandler } from "./types";
2
- declare const showMessage: MessageHandler;
1
+ import type { MessageHandlerProps } from "./types";
2
+ declare const showMessage: ({ message, type }: MessageHandlerProps) => void;
3
3
  export { showMessage };
@@ -1,3 +1,3 @@
1
- import type { MessageHandler } from "./types";
2
- declare const showMessage: MessageHandler;
1
+ import type { MessageHandlerProps } from "./types";
2
+ declare const showMessage: ({ message, leftIcon }: MessageHandlerProps) => void;
3
3
  export { showMessage };
@@ -1,2 +1,6 @@
1
- type MessageHandler = (message: string | Error | object, leftIcon?: string) => void;
2
- export type { MessageHandler };
1
+ interface MessageHandlerProps {
2
+ message: string | Error | object;
3
+ type?: 'error' | 'info' | 'message' | 'success' | 'warning';
4
+ leftIcon?: string;
5
+ }
6
+ export type { MessageHandlerProps };
@@ -5,5 +5,6 @@ export * from './hooks/useAuthContext';
5
5
  export * from './hooks/useRequest';
6
6
  export * from './api/axiosClient';
7
7
  export * from './navigator';
8
- export * from './screens/Login/components/LoginWebComponent';
9
- export * from './screens/SignUp/components/SignUpWebComponent';
8
+ export * from './screens/Login/components/LoginWebComponent/index';
9
+ export * from './screens/SignUp/components/SignUpWebComponent/index';
10
+ export * from './screens/SSOLogin/SSOCallback/components/SSOCallbackComponent/index';
@@ -1,5 +1,5 @@
1
1
  import { type NativeStackScreenProps } from '@react-navigation/native-stack';
2
- import type { PersonalDetails } from '../types/types';
2
+ import type { Client, PersonalDetails } from '../types/types';
3
3
  declare const AuthNavigator: () => import("react/jsx-runtime").JSX.Element;
4
4
  export { AuthNavigator };
5
5
  export type AuthStackParamList = {
@@ -32,5 +32,28 @@ export type AuthStackParamList = {
32
32
  sessionToken: string;
33
33
  phone: string;
34
34
  };
35
+ LoginWithEmailOTP: {
36
+ email: string;
37
+ };
38
+ ResetPassword: {
39
+ sessionToken: string;
40
+ email: string;
41
+ };
42
+ VerifyResetPasswordOTP: {
43
+ email: string;
44
+ };
45
+ SSOSearchOrganization: undefined;
46
+ SSOAuthenticationMethods: {
47
+ client: Client;
48
+ };
49
+ SSOCallback: {
50
+ code?: string;
51
+ clientId: number;
52
+ };
53
+ SSOAuthWebView: {
54
+ clientId: number;
55
+ authenticationUrl: string;
56
+ redirectUri: string;
57
+ };
35
58
  };
36
59
  export type AuthScreensProps<T extends keyof AuthStackParamList> = NativeStackScreenProps<AuthStackParamList, T>;
@@ -8,12 +8,11 @@ declare const useEnterEmail: () => {
8
8
  isInvalidEmail: boolean;
9
9
  loading: boolean;
10
10
  enterEmail: (text: string) => void;
11
- handleValidateEmail: ({ onResult }: {
12
- onResult: (params: {
13
- email: string;
11
+ handleValidateEmail: ({ onContinue }: {
12
+ onContinue: (params: {
14
13
  emailExist: boolean;
15
14
  }) => void;
16
- }) => void;
15
+ }) => Promise<void>;
17
16
  clearText: () => void;
18
17
  loginConflictModalVisible: boolean;
19
18
  setLoginConflictModalVisible: import("react").Dispatch<import("react").SetStateAction<boolean>>;
@@ -1,7 +1,3 @@
1
- declare const EnterEmail: ({ onResult }: {
2
- onResult: (params: {
3
- email: string;
4
- emailExist: boolean;
5
- }) => void;
6
- }) => import("react/jsx-runtime").JSX.Element;
1
+ import type { EnterEmailProps } from './types';
2
+ declare const EnterEmail: ({ onContinue, onPressSignInWithSSO }: EnterEmailProps) => import("react/jsx-runtime").JSX.Element;
7
3
  export default EnterEmail;
@@ -0,0 +1,8 @@
1
+ interface EnterEmailProps {
2
+ onContinue: (params: {
3
+ email: string;
4
+ emailExist: boolean;
5
+ }) => void;
6
+ onPressSignInWithSSO: () => void;
7
+ }
8
+ export type { EnterEmailProps };
@@ -1,3 +1,3 @@
1
1
  import type { EnterPasswordProps } from './types';
2
- declare const EnterPassword: ({ email, onPressBack }: EnterPasswordProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const EnterPassword: ({ email, onPressBack, onVerifiedResetPasswordOTP }: EnterPasswordProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default EnterPassword;
@@ -1,4 +1,4 @@
1
1
  import type { AuthScreensProps } from '../../navigator/index.native';
2
2
  type ScreenProps = AuthScreensProps<'EnterPassword'>;
3
- declare const EnterPassword: ({ route }: ScreenProps) => import("react/jsx-runtime").JSX.Element;
3
+ declare const EnterPassword: ({ navigation, route }: ScreenProps) => import("react/jsx-runtime").JSX.Element;
4
4
  export default EnterPassword;
@@ -1,5 +1,21 @@
1
1
  interface EnterPasswordProps {
2
2
  email: string;
3
3
  onPressBack: () => void;
4
+ onVerifiedResetPasswordOTP: ({ sessionToken }: {
5
+ sessionToken: string;
6
+ }) => void;
4
7
  }
5
- export type { EnterPasswordProps };
8
+ interface VerifyResetPasswordOTPModalProps {
9
+ show: boolean;
10
+ hide: () => void;
11
+ email: string;
12
+ onVerifiedOTP: ({ sessionToken }: {
13
+ sessionToken: string;
14
+ }) => void;
15
+ }
16
+ interface LoginWithEmailOTPModalProps {
17
+ show: boolean;
18
+ hide: () => void;
19
+ email: string;
20
+ }
21
+ export type { EnterPasswordProps, VerifyResetPasswordOTPModalProps, LoginWithEmailOTPModalProps };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @internal
3
+ * Hook for handling Email OTP Login flow.
4
+ */
5
+ declare const useLoginWithEmailOTP: ({ email, source }: {
6
+ email: string;
7
+ source: string;
8
+ }) => {
9
+ sendOtp: () => void;
10
+ verifyOtp: (otp: string) => Promise<void>;
11
+ resendOTPCounter: number;
12
+ status: "loading" | "idle" | "valid" | "invalid";
13
+ };
14
+ export { useLoginWithEmailOTP };
@@ -0,0 +1,4 @@
1
+ declare const LoginWithEmailOTP: ({ email }: {
2
+ email: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
4
+ export default LoginWithEmailOTP;
@@ -0,0 +1,4 @@
1
+ import type { AuthScreensProps } from './../../navigator/index.native';
2
+ type ScreenProps = AuthScreensProps<'LoginWithEmailOTP'>;
3
+ declare const LoginWithEmailOTP: ({ route }: ScreenProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default LoginWithEmailOTP;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @internal
3
+ * Hook for managing ResetPassword screen state and auth context integration.
4
+ * This hook is not exposed to package consumers.
5
+ */
6
+ declare const useResetPassword: ({ sessionToken }: {
7
+ sessionToken: string;
8
+ }) => {
9
+ loading: boolean;
10
+ password: string;
11
+ setPassword: import("react").Dispatch<import("react").SetStateAction<string>>;
12
+ confirmPassword: string;
13
+ setConfirmPassword: import("react").Dispatch<import("react").SetStateAction<string>>;
14
+ passwordVisible: boolean;
15
+ setPasswordVisible: import("react").Dispatch<import("react").SetStateAction<boolean>>;
16
+ confirmPasswordVisible: boolean;
17
+ setConfirmPasswordVisible: import("react").Dispatch<import("react").SetStateAction<boolean>>;
18
+ maxLength: number;
19
+ setMaxLength: import("react").Dispatch<import("react").SetStateAction<number>>;
20
+ criteria: Record<string, boolean>;
21
+ setCriteria: import("react").Dispatch<import("react").SetStateAction<Record<string, boolean>>>;
22
+ handlePassword: (text: string) => void;
23
+ handleContinue: ({ onResult }: {
24
+ onResult: () => void;
25
+ }) => void;
26
+ handleConfirmPassword: (text: string) => void;
27
+ };
28
+ export { useResetPassword };
@@ -0,0 +1,3 @@
1
+ import type { ResetPasswordProps } from "./types";
2
+ declare const ResetPassword: ({ email, sessionToken, onPressBack, onContinue }: ResetPasswordProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default ResetPassword;
@@ -0,0 +1,4 @@
1
+ import type { AuthScreensProps } from '../../navigator/index.native';
2
+ type ScreenProps = AuthScreensProps<'ResetPassword'>;
3
+ declare const ResetPassword: ({ navigation, route }: ScreenProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default ResetPassword;
@@ -0,0 +1,11 @@
1
+ interface ResetPasswordProps {
2
+ email: string;
3
+ sessionToken: string;
4
+ onPressBack?: () => void;
5
+ onContinue: () => void;
6
+ }
7
+ interface ResetPasswordFormData {
8
+ password: string;
9
+ confirmPassword: string;
10
+ }
11
+ export type { ResetPasswordProps, ResetPasswordFormData };
@@ -0,0 +1,2 @@
1
+ declare const SSOAuthWebView: () => null;
2
+ export default SSOAuthWebView;
@@ -0,0 +1,4 @@
1
+ import type { AuthScreensProps } from '../../../navigator/index.native';
2
+ type ScreenProps = AuthScreensProps<'SSOAuthWebView'>;
3
+ declare const SSOAuthWebView: ({ navigation, route }: ScreenProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default SSOAuthWebView;
@@ -0,0 +1,8 @@
1
+ interface NavigationStateProps {
2
+ url: string;
3
+ title: string;
4
+ loading: boolean;
5
+ canGoBack: boolean;
6
+ canGoForward: boolean;
7
+ }
8
+ export type { NavigationStateProps };
@@ -0,0 +1,9 @@
1
+ import type { SSOInitiationData } from "../../types";
2
+ declare const useSSOAuthenticationMethods: () => {
3
+ loading: boolean;
4
+ initiateSSOLogin: ({ clientId, onSSOLoginInitiated }: {
5
+ clientId: number;
6
+ onSSOLoginInitiated: (data: SSOInitiationData) => void;
7
+ }) => void;
8
+ };
9
+ export { useSSOAuthenticationMethods };
@@ -0,0 +1,3 @@
1
+ import type { SSOAuthenticationMethodsProps } from "./types";
2
+ declare const SSOAuthenticationMethods: ({ client, onPressBack }: SSOAuthenticationMethodsProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default SSOAuthenticationMethods;
@@ -0,0 +1,4 @@
1
+ import type { AuthScreensProps } from '../../../navigator/index.native';
2
+ type ScreenProps = AuthScreensProps<'SSOAuthenticationMethods'>;
3
+ declare const SSOAuthenticationMethods: ({ route }: ScreenProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default SSOAuthenticationMethods;
@@ -0,0 +1,11 @@
1
+ import type { Client } from "../../../types/types";
2
+ interface SSOInitiationData {
3
+ clientId: number;
4
+ authenticationUrl: string;
5
+ redirectUri: string;
6
+ }
7
+ interface SSOAuthenticationMethodsProps {
8
+ client: Client;
9
+ onPressBack: () => void;
10
+ }
11
+ export type { SSOAuthenticationMethodsProps, SSOInitiationData };