@truworth/twc-auth 1.1.0 → 1.2.1

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 (202) hide show
  1. package/README.md +239 -306
  2. package/build/assets/animation/redirect-home.json +1101 -0
  3. package/build/assets/cross_icon copy.svg +5 -0
  4. package/build/assets/cross_icon.svg +5 -0
  5. package/build/assets/gender-diversity.svg +22 -0
  6. package/build/assets/logo.svg +55 -0
  7. package/build/assets/okay_icon copy.svg +3 -0
  8. package/build/assets/okay_icon.svg +3 -0
  9. package/build/src/api/axiosClient/index.js +5 -0
  10. package/build/src/api/axiosClient/index.native.js +5 -0
  11. package/build/src/components/AdvancedTransitionWrapper/index.js +380 -0
  12. package/build/src/components/AdvancedTransitionWrapper/index.native.js +10 -0
  13. package/build/src/components/AdvancedTransitionWrapper/types.js +1 -0
  14. package/build/src/components/ConfirmationModal/index.js +11 -0
  15. package/build/src/components/ConfirmationModal/index.native.js +15 -0
  16. package/build/src/components/ConfirmationModal/types.js +1 -0
  17. package/build/src/components/EmailOTPVerify/index.js +20 -0
  18. package/build/src/components/EmailOTPVerify/index.native.js +26 -0
  19. package/build/src/components/EmailOTPVerify/type.js +1 -0
  20. package/build/src/components/IonIcon/index.js +11 -0
  21. package/build/src/components/IonIcon/index.native.js +9 -0
  22. package/build/src/components/IonIcon/types.js +1 -0
  23. package/build/src/components/OTPStatusLabel/index.js +10 -0
  24. package/build/src/components/OTPStatusLabel/index.native.js +21 -0
  25. package/build/src/components/OTPStatusLabel/types.js +1 -0
  26. package/build/src/components/PasswordCriteria/hooks/usePasswordCriteria.js +78 -0
  27. package/build/src/components/PasswordCriteria/index.js +47 -0
  28. package/build/src/components/PasswordCriteria/index.native.js +19 -0
  29. package/build/src/components/PasswordCriteria/types.js +1 -0
  30. package/build/src/components/ScreenLayout/index.js +12 -0
  31. package/build/src/components/ScreenLayout/index.native.js +18 -0
  32. package/build/src/components/ScreenLayout/types.js +1 -0
  33. package/build/src/components/SupportDetails/index.js +9 -0
  34. package/build/src/components/SupportDetails/index.native.js +6 -0
  35. package/build/src/components/VerifyOTP/index.js +23 -0
  36. package/build/src/components/VerifyOTP/index.native.js +38 -0
  37. package/build/src/components/VerifyOTP/types.js +1 -0
  38. package/build/src/constants/cdn-url/index.js +1 -0
  39. package/build/src/constants/cdn-url/index.native.js +5 -0
  40. package/build/src/contexts/AuthContext.js +184 -0
  41. package/build/src/contexts/type.js +1 -0
  42. package/build/src/helpers/Network.js +93 -0
  43. package/build/src/helpers/Validation.js +12 -0
  44. package/build/src/helpers/show-message/index.js +19 -0
  45. package/build/src/helpers/show-message/index.native.js +14 -0
  46. package/build/src/helpers/show-message/types.js +1 -0
  47. package/build/src/helpers/types.js +1 -0
  48. package/build/src/hooks/internal/useAuthPackageContext.js +9 -0
  49. package/build/src/hooks/internal/useTimer.js +40 -0
  50. package/build/src/hooks/useAuthContext.js +10 -0
  51. package/build/src/hooks/useRequest.js +38 -0
  52. package/build/src/index.js +12 -0
  53. package/build/src/navigator/index.js +10 -0
  54. package/build/src/navigator/index.native.js +16 -0
  55. package/build/src/screens/CountryCode/components/CountryCodeDropdown/index.js +38 -0
  56. package/build/src/screens/CountryCode/components/CountryCodeDropdown/index.native.js +6 -0
  57. package/build/src/screens/CountryCode/components/CountryCodeDropdown/types.js +1 -0
  58. package/build/src/screens/CountryCode/hooks/internal/useCountryCode.js +38 -0
  59. package/build/src/screens/CountryCode/index.js +10 -0
  60. package/build/src/screens/CountryCode/index.native.js +37 -0
  61. package/build/src/screens/CountryCode/type.js +1 -0
  62. package/build/src/screens/CreatePassword/hooks/internal/useCreatePassword.js +52 -0
  63. package/build/src/screens/CreatePassword/index.js +43 -0
  64. package/build/src/screens/CreatePassword/index.native.js +32 -0
  65. package/build/src/screens/CreatePassword/type.js +1 -0
  66. package/build/src/screens/EnterEmail/hooks/internal/useEnterEmail.js +86 -0
  67. package/build/src/screens/EnterEmail/index.js +30 -0
  68. package/build/src/screens/EnterEmail/index.native.js +34 -0
  69. package/build/src/screens/EnterPassword/hooks/internal/useEnterPassword.js +47 -0
  70. package/build/src/screens/EnterPassword/index.js +22 -0
  71. package/build/src/screens/EnterPassword/index.native.js +23 -0
  72. package/build/src/screens/EnterPassword/types.js +1 -0
  73. package/build/src/screens/Login/components/LoginWebComponent/index.js +44 -0
  74. package/build/src/screens/Login/components/LoginWebComponent/index.native.js +6 -0
  75. package/build/src/screens/Login/index.js +10 -0
  76. package/build/src/screens/Login/index.native.js +6 -0
  77. package/build/src/screens/SignUp/components/SignUpForm/index.js +181 -0
  78. package/build/src/screens/SignUp/components/SignUpForm/index.native.js +6 -0
  79. package/build/src/screens/SignUp/components/SignUpForm/type.js +1 -0
  80. package/build/src/screens/SignUp/components/SignUpWebComponent/index.js +82 -0
  81. package/build/src/screens/SignUp/components/SignUpWebComponent/index.native.js +6 -0
  82. package/build/src/screens/SignUp/components/SignUpWebComponent/types.js +1 -0
  83. package/build/src/screens/SignUp/hooks/internal/useSignUp.js +138 -0
  84. package/build/src/screens/SignUp/index.js +6 -0
  85. package/build/src/screens/SignUp/index.native.js +185 -0
  86. package/build/src/screens/SignUp/types.js +1 -0
  87. package/build/src/screens/UserConsent/hooks/internal/useConsent.js +48 -0
  88. package/build/src/screens/UserConsent/index.js +69 -0
  89. package/build/src/screens/UserConsent/index.native.js +46 -0
  90. package/build/src/screens/UserConsent/types.js +1 -0
  91. package/build/src/screens/VerifyEmail/hooks/internal/useVerifyEmail.js +69 -0
  92. package/build/src/screens/VerifyEmail/index.js +8 -0
  93. package/build/src/screens/VerifyEmail/index.native.js +14 -0
  94. package/build/src/screens/VerifyEmail/types.js +1 -0
  95. package/build/src/screens/VerifyMobile/hooks/internal/useVerifyMobile.js +73 -0
  96. package/build/src/screens/VerifyMobile/index.js +8 -0
  97. package/build/src/screens/VerifyMobile/index.native.js +9 -0
  98. package/build/src/screens/VerifyMobile/types.js +1 -0
  99. package/build/src/screens/Welcome/hooks/internal/useWelcome.js +21 -0
  100. package/build/src/screens/Welcome/index.js +28 -0
  101. package/build/src/screens/Welcome/index.native.js +41 -0
  102. package/build/src/types/types.js +1 -0
  103. package/build/types/api/axiosClient/index.d.ts +1 -0
  104. package/build/types/api/axiosClient/index.native.d.ts +1 -0
  105. package/build/types/components/AdvancedTransitionWrapper/index.d.ts +3 -0
  106. package/build/types/components/AdvancedTransitionWrapper/index.native.d.ts +5 -0
  107. package/build/types/components/AdvancedTransitionWrapper/types.d.ts +25 -0
  108. package/build/types/components/ConfirmationModal/index.d.ts +3 -0
  109. package/build/types/components/ConfirmationModal/index.native.d.ts +3 -0
  110. package/build/types/components/ConfirmationModal/types.d.ts +13 -0
  111. package/build/types/components/EmailOTPVerify/index.d.ts +3 -0
  112. package/build/types/components/EmailOTPVerify/index.native.d.ts +3 -0
  113. package/build/types/components/EmailOTPVerify/type.d.ts +9 -0
  114. package/build/types/components/IonIcon/index.d.ts +3 -0
  115. package/build/types/components/IonIcon/index.native.d.ts +4 -0
  116. package/build/types/components/IonIcon/types.d.ts +6 -0
  117. package/build/types/components/OTPStatusLabel/index.d.ts +2 -0
  118. package/build/types/components/OTPStatusLabel/index.native.d.ts +3 -0
  119. package/build/types/components/OTPStatusLabel/types.d.ts +6 -0
  120. package/build/types/components/PasswordCriteria/hooks/usePasswordCriteria.d.ts +13 -0
  121. package/build/types/components/PasswordCriteria/index.d.ts +3 -0
  122. package/build/types/components/PasswordCriteria/index.native.d.ts +3 -0
  123. package/build/types/components/PasswordCriteria/types.d.ts +15 -0
  124. package/build/types/components/ScreenLayout/index.d.ts +3 -0
  125. package/build/types/components/ScreenLayout/index.native.d.ts +3 -0
  126. package/build/types/components/ScreenLayout/types.d.ts +12 -0
  127. package/build/types/components/SupportDetails/index.d.ts +2 -0
  128. package/build/types/components/SupportDetails/index.native.d.ts +2 -0
  129. package/build/types/components/VerifyOTP/index.d.ts +3 -0
  130. package/build/types/components/VerifyOTP/index.native.d.ts +3 -0
  131. package/build/types/components/VerifyOTP/types.d.ts +10 -0
  132. package/build/types/constants/cdn-url/index.d.ts +1 -0
  133. package/build/types/constants/cdn-url/index.native.d.ts +3 -0
  134. package/build/types/contexts/AuthContext.d.ts +36 -0
  135. package/build/types/contexts/type.d.ts +58 -0
  136. package/build/types/helpers/Network.d.ts +5 -0
  137. package/build/types/helpers/Validation.d.ts +2 -0
  138. package/build/types/helpers/show-message/index.d.ts +3 -0
  139. package/build/types/helpers/show-message/index.native.d.ts +3 -0
  140. package/build/types/helpers/show-message/types.d.ts +2 -0
  141. package/build/types/helpers/types.d.ts +13 -0
  142. package/build/types/hooks/internal/useAuthPackageContext.d.ts +1 -0
  143. package/build/types/hooks/internal/useTimer.d.ts +3 -0
  144. package/build/types/hooks/useAuthContext.d.ts +2 -0
  145. package/build/types/hooks/useRequest.d.ts +5 -0
  146. package/build/types/index.d.ts +8 -0
  147. package/build/types/navigator/index.d.ts +2 -0
  148. package/build/types/navigator/index.native.d.ts +36 -0
  149. package/build/types/screens/CountryCode/components/CountryCodeDropdown/index.d.ts +3 -0
  150. package/build/types/screens/CountryCode/components/CountryCodeDropdown/index.native.d.ts +2 -0
  151. package/build/types/screens/CountryCode/components/CountryCodeDropdown/types.d.ts +17 -0
  152. package/build/types/screens/CountryCode/hooks/internal/useCountryCode.d.ts +12 -0
  153. package/build/types/screens/CountryCode/index.d.ts +2 -0
  154. package/build/types/screens/CountryCode/index.native.d.ts +2 -0
  155. package/build/types/screens/CountryCode/type.d.ts +11 -0
  156. package/build/types/screens/CreatePassword/hooks/internal/useCreatePassword.d.ts +26 -0
  157. package/build/types/screens/CreatePassword/index.d.ts +3 -0
  158. package/build/types/screens/CreatePassword/index.native.d.ts +4 -0
  159. package/build/types/screens/CreatePassword/type.d.ts +43 -0
  160. package/build/types/screens/EnterEmail/hooks/internal/useEnterEmail.d.ts +24 -0
  161. package/build/types/screens/EnterEmail/index.d.ts +7 -0
  162. package/build/types/screens/EnterEmail/index.native.d.ts +4 -0
  163. package/build/types/screens/EnterPassword/hooks/internal/useEnterPassword.d.ts +20 -0
  164. package/build/types/screens/EnterPassword/index.d.ts +3 -0
  165. package/build/types/screens/EnterPassword/index.native.d.ts +4 -0
  166. package/build/types/screens/EnterPassword/types.d.ts +5 -0
  167. package/build/types/screens/Login/components/LoginWebComponent/index.d.ts +2 -0
  168. package/build/types/screens/Login/components/LoginWebComponent/index.native.d.ts +2 -0
  169. package/build/types/screens/Login/index.d.ts +2 -0
  170. package/build/types/screens/Login/index.native.d.ts +2 -0
  171. package/build/types/screens/SignUp/components/SignUpForm/index.d.ts +3 -0
  172. package/build/types/screens/SignUp/components/SignUpForm/index.native.d.ts +2 -0
  173. package/build/types/screens/SignUp/components/SignUpForm/type.d.ts +9 -0
  174. package/build/types/screens/SignUp/components/SignUpWebComponent/index.d.ts +2 -0
  175. package/build/types/screens/SignUp/components/SignUpWebComponent/index.native.d.ts +2 -0
  176. package/build/types/screens/SignUp/components/SignUpWebComponent/types.d.ts +24 -0
  177. package/build/types/screens/SignUp/hooks/internal/useSignUp.d.ts +50 -0
  178. package/build/types/screens/SignUp/index.d.ts +2 -0
  179. package/build/types/screens/SignUp/index.native.d.ts +4 -0
  180. package/build/types/screens/SignUp/types.d.ts +18 -0
  181. package/build/types/screens/UserConsent/hooks/internal/useConsent.d.ts +10 -0
  182. package/build/types/screens/UserConsent/index.d.ts +3 -0
  183. package/build/types/screens/UserConsent/index.native.d.ts +4 -0
  184. package/build/types/screens/UserConsent/types.d.ts +27 -0
  185. package/build/types/screens/VerifyEmail/hooks/internal/useVerifyEmail.d.ts +19 -0
  186. package/build/types/screens/VerifyEmail/index.d.ts +3 -0
  187. package/build/types/screens/VerifyEmail/index.native.d.ts +4 -0
  188. package/build/types/screens/VerifyEmail/types.d.ts +8 -0
  189. package/build/types/screens/VerifyMobile/hooks/internal/useVerifyMobile.d.ts +14 -0
  190. package/build/types/screens/VerifyMobile/index.d.ts +3 -0
  191. package/build/types/screens/VerifyMobile/index.native.d.ts +4 -0
  192. package/build/types/screens/VerifyMobile/types.d.ts +5 -0
  193. package/build/types/screens/Welcome/hooks/internal/useWelcome.d.ts +14 -0
  194. package/build/types/screens/Welcome/index.d.ts +4 -0
  195. package/build/types/screens/Welcome/index.native.d.ts +4 -0
  196. package/build/types/types/types.d.ts +90 -0
  197. package/get-metro-config.js +40 -0
  198. package/get-next-config.js +26 -0
  199. package/package.json +86 -38
  200. package/dist/index.esm.js +0 -2028
  201. package/dist/index.umd.js +0 -70
  202. package/dist/vite.svg +0 -1
@@ -0,0 +1,73 @@
1
+ import { useCallback, useEffect, useState } from "react";
2
+ import { showMessage } from "../../../../helpers/show-message";
3
+ import { useInterval } from "../../../../hooks/internal/useTimer";
4
+ import { axiosClient } from "../../../../api/axiosClient";
5
+ import { useAuthPackageContext } from "../../../../hooks/internal/useAuthPackageContext";
6
+ const initialTimer = 180;
7
+ /**
8
+ * @internal
9
+ * Hook for managing VerifyMobile screen state and auth context integration.
10
+ * This hook is not exposed to package consumers.
11
+ */
12
+ const useVerifyMobile = ({ sessionToken }) => {
13
+ const [sessionTokenState, setSessionToken] = useState(sessionToken || '');
14
+ const [timer, setTimer] = useState(initialTimer);
15
+ const [status, setStatus] = useState('timer');
16
+ const { onLogin } = useAuthPackageContext();
17
+ useEffect(() => {
18
+ resendOTP();
19
+ }, []);
20
+ useInterval(() => {
21
+ if (!timer) {
22
+ return;
23
+ }
24
+ setTimer(timer - 1);
25
+ }, 1000);
26
+ const resendOTP = useCallback(() => {
27
+ setStatus('loading');
28
+ axiosClient({
29
+ url: '/auth/registration/mobile/send-otp',
30
+ method: 'POST',
31
+ data: { sessionToken: sessionTokenState },
32
+ }).then((res) => {
33
+ setSessionToken(res.data.sessionToken);
34
+ setStatus('timer');
35
+ setTimer(initialTimer);
36
+ }).catch((err) => {
37
+ console.log(err);
38
+ const msg = err?.response?.data?.errors?.[0]?.message ?? 'Unable to send OTP. Please try again.';
39
+ showMessage(msg);
40
+ setStatus('timer');
41
+ });
42
+ }, [sessionTokenState]);
43
+ const validateOTP = useCallback((otp) => {
44
+ setStatus('loading');
45
+ axiosClient({
46
+ url: '/auth/registration/mobile/verify-otp',
47
+ method: 'POST',
48
+ data: { otp, sessionToken: sessionTokenState },
49
+ }).then((res) => {
50
+ setStatus('valid');
51
+ const { token, member } = res.data;
52
+ onLogin({ token, member });
53
+ }).catch((err) => {
54
+ if (err?.response?.status === 400) {
55
+ setStatus('invalid');
56
+ setTimeout(() => setStatus('timer'), 5000);
57
+ showMessage(err?.response?.data?.errors?.[0]?.message ?? 'Invalid OTP. Please try again.');
58
+ }
59
+ else {
60
+ const msg = err?.response?.data?.errors?.[0]?.message ?? 'Verification failed. Please try again.';
61
+ showMessage(msg);
62
+ setStatus('timer');
63
+ }
64
+ });
65
+ }, [sessionTokenState]);
66
+ return {
67
+ timer,
68
+ status,
69
+ resendOTP,
70
+ validateOTP
71
+ };
72
+ };
73
+ export { useVerifyMobile };
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { OTPVerify } from "../../components/VerifyOTP";
3
+ import { useVerifyMobile } from "./hooks/internal/useVerifyMobile";
4
+ const VerifyMobile = ({ sessionToken, phone }) => {
5
+ const { timer, status, validateOTP, resendOTP, } = useVerifyMobile({ sessionToken });
6
+ return (_jsx(OTPVerify, { timer: timer, phone: phone, status: status, validateOTP: validateOTP, resendOTP: resendOTP }));
7
+ };
8
+ export default VerifyMobile;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { OTPVerify } from '../../components/VerifyOTP';
3
+ import { useVerifyMobile } from './hooks/internal/useVerifyMobile';
4
+ const VerifyMobile = ({ route }) => {
5
+ const { sessionToken, phone } = route.params || {};
6
+ const { timer, status, validateOTP, resendOTP, } = useVerifyMobile({ sessionToken });
7
+ return (_jsx(OTPVerify, { timer: timer, phone: phone, status: status, validateOTP: validateOTP, resendOTP: resendOTP }));
8
+ };
9
+ export default VerifyMobile;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ import { useState } from "react";
2
+ import { useAuthContext } from "../../../../hooks/useAuthContext";
3
+ import { useAuthPackageContext } from "../../../../hooks/internal/useAuthPackageContext";
4
+ /**
5
+ * @internal
6
+ * Hook for managing Welcome screen state and auth context integration.
7
+ * This hook is not exposed to package consumers.
8
+ */
9
+ const useWelcome = () => {
10
+ const [loading, setLoading] = useState(false);
11
+ const [showSocialLoginModal, setShowSocialLoginModal] = useState(false);
12
+ const { LogoComponent, onLaunchAuthSession } = useAuthPackageContext();
13
+ return {
14
+ loading,
15
+ setLoading,
16
+ showSocialLoginModal, setShowSocialLoginModal,
17
+ LogoComponent,
18
+ onLaunchAuthSession
19
+ };
20
+ };
21
+ export { useWelcome };
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import Image from "next/image";
4
+ import { CDN_IMAGES_URL, IonIcon } from "@truworth/twc-web-common";
5
+ import { Button, Flex, Typography } from "@truworth/twc-web-design";
6
+ import { AdvancedTransitionWrapper } from "../../components/AdvancedTransitionWrapper";
7
+ import { useWelcome } from "./hooks/internal/useWelcome";
8
+ const Welcome = ({ onClickEnterEmail }) => {
9
+ const { LogoComponent } = useWelcome();
10
+ const renderLogo = () => {
11
+ 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` }));
13
+ }
14
+ // If it's already a React element, return it as is
15
+ if (React.isValidElement(LogoComponent)) {
16
+ return LogoComponent;
17
+ }
18
+ // If it's a function component, render it
19
+ if (typeof LogoComponent === 'function') {
20
+ const Component = LogoComponent;
21
+ return _jsx(Component, {});
22
+ }
23
+ // 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` }));
25
+ };
26
+ 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
+ };
28
+ export default Welcome;
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useCallback } from 'react';
3
+ import { useFocusEffect } from '@react-navigation/native';
4
+ import { View, Text, BackHandler, ScrollView } from 'react-native';
5
+ import { Colors, LoadingModal, RoundedButton } from '@truworth/twc-rn-common';
6
+ import { Layout } from '@ui-kitten/components';
7
+ import { useWelcome } from './hooks/internal/useWelcome';
8
+ import Logo from '../../../assets/logo.svg';
9
+ const { gray } = Colors;
10
+ const Welcome = ({ navigation }) => {
11
+ const { loading, LogoComponent, onLaunchAuthSession } = useWelcome();
12
+ useFocusEffect(useCallback(() => {
13
+ onLaunchAuthSession?.();
14
+ const backHandler = BackHandler.addEventListener('hardwareBackPress', () => true);
15
+ return () => backHandler.remove();
16
+ }, []));
17
+ const renderLogo = () => {
18
+ if (!LogoComponent) {
19
+ return (_jsx(View, { style: { marginTop: 70, alignSelf: 'center' }, children: _jsx(Logo, {}) }));
20
+ }
21
+ // If it's already a React element, return it as is
22
+ if (React.isValidElement(LogoComponent)) {
23
+ return LogoComponent;
24
+ }
25
+ // If it's a function component, render it
26
+ if (typeof LogoComponent === 'function') {
27
+ const Component = LogoComponent;
28
+ return _jsx(Component, {});
29
+ }
30
+ // Fallback to default logo
31
+ return (_jsx(View, { style: { marginTop: 70, alignSelf: 'center' }, children: _jsx(Logo, {}) }));
32
+ };
33
+ return (_jsxs(Layout, { style: { flex: 1, backgroundColor: '#FFFFFF' }, children: [_jsx(ScrollView, { showsVerticalScrollIndicator: false, children: _jsxs(View, { style: { padding: 16 }, children: [renderLogo(), _jsx(Text, { style: {
34
+ fontSize: 32, fontWeight: '600', color: gray.gray_900,
35
+ marginTop: 56, textAlign: 'center', lineHeight: 48,
36
+ }, children: "Welcome!" }), _jsx(Text, { style: {
37
+ fontSize: 16, fontWeight: '500', color: gray.gray_400,
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 })] }));
40
+ };
41
+ export default Welcome;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const axiosClient: import("axios").AxiosInstance;
@@ -0,0 +1 @@
1
+ export declare const axiosClient: import("axios").AxiosInstance;
@@ -0,0 +1,3 @@
1
+ import type { AdvancedTransitionWrapperProps } from './types';
2
+ declare const AdvancedTransitionWrapper: ({ children, isVisible, direction, type, duration, delay, className, staggerChildren, staggerDelay, exitBeforeEnter, bounce, damping, mass, velocity, depth, perspective, intensity, customEnterVariants, customExitVariants, }: AdvancedTransitionWrapperProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { AdvancedTransitionWrapper };
@@ -0,0 +1,5 @@
1
+ import type { ReactNode } from 'react';
2
+ declare const AdvancedTransitionWrapper: ({ children }: {
3
+ children?: ReactNode;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export { AdvancedTransitionWrapper };
@@ -0,0 +1,25 @@
1
+ import type { ReactNode } from "react";
2
+ type AdvancedTransitionDirection = 'up' | 'down' | 'left' | 'right';
3
+ type AdvancedTransitionType = 'slide' | 'fade' | 'scale' | 'rotate' | 'flip' | 'elastic' | 'spring' | 'glide' | 'zoom' | 'blur';
4
+ interface AdvancedTransitionWrapperProps {
5
+ children: ReactNode;
6
+ isVisible?: boolean;
7
+ direction?: AdvancedTransitionDirection;
8
+ type?: AdvancedTransitionType;
9
+ duration?: number;
10
+ delay?: number;
11
+ className?: string;
12
+ staggerChildren?: boolean;
13
+ staggerDelay?: number;
14
+ exitBeforeEnter?: boolean;
15
+ bounce?: number;
16
+ damping?: number;
17
+ mass?: number;
18
+ velocity?: number;
19
+ depth?: number;
20
+ perspective?: number;
21
+ intensity?: number;
22
+ customEnterVariants?: any;
23
+ customExitVariants?: any;
24
+ }
25
+ export type { AdvancedTransitionDirection, AdvancedTransitionType, AdvancedTransitionWrapperProps };
@@ -0,0 +1,3 @@
1
+ import type { ConfirmationModalProps } from './types';
2
+ declare const ConfirmationModal: ({ title, visible, onClose, onProceed, onDismiss, primaryLabel, secondaryLabel, iconName, iconColor, description }: ConfirmationModalProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { ConfirmationModal };
@@ -0,0 +1,3 @@
1
+ import type { ConfirmationModalProps } from './types';
2
+ declare const ConfirmationModal: ({ title, visible, onClose, onProceed, onDismiss, primaryLabel, secondaryLabel, iconName, iconColor, description }: ConfirmationModalProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { ConfirmationModal };
@@ -0,0 +1,13 @@
1
+ type ConfirmationModalProps = {
2
+ title: string;
3
+ visible: boolean;
4
+ primaryLabel: string;
5
+ secondaryLabel?: string;
6
+ iconName?: string;
7
+ iconColor?: string;
8
+ onClose: () => void;
9
+ onProceed?: () => void;
10
+ onDismiss?: () => void;
11
+ description?: string;
12
+ };
13
+ export type { ConfirmationModalProps };
@@ -0,0 +1,3 @@
1
+ import type { EmailOTPVerifyProps } from "./type";
2
+ declare const EmailOTPVerify: ({ validateOTP, resendOTP, resendOTPCounter, email, status }: EmailOTPVerifyProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { EmailOTPVerify };
@@ -0,0 +1,3 @@
1
+ import type { EmailOTPVerifyProps } from "./type";
2
+ declare const EmailOTPVerify: ({ status, validateOTP, resendOTP, resendOTPCounter, email }: EmailOTPVerifyProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { EmailOTPVerify };
@@ -0,0 +1,9 @@
1
+ import type { OTPStatus } from "../OTPStatusLabel/types";
2
+ type EmailOTPVerifyProps = {
3
+ validateOTP: (otp: string) => void | Promise<void>;
4
+ resendOTP: () => void | Promise<void>;
5
+ resendOTPCounter: number;
6
+ email?: string;
7
+ status: OTPStatus | string;
8
+ };
9
+ export type { EmailOTPVerifyProps };
@@ -0,0 +1,3 @@
1
+ import type { IconProps } from './types';
2
+ declare const IonIcon: ({ name, size, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { IonIcon };
@@ -0,0 +1,4 @@
1
+ import type React from 'react';
2
+ import type { IconProps } from './types';
3
+ declare const IonIcon: (_props: IconProps) => React.ReactElement | null;
4
+ export { IonIcon };
@@ -0,0 +1,6 @@
1
+ import type React from 'react';
2
+ type IconProps = React.HTMLAttributes<HTMLElement> & {
3
+ name: string;
4
+ size?: string;
5
+ };
6
+ export type { IconProps };
@@ -0,0 +1,2 @@
1
+ declare const OTPStatusLabel: () => null;
2
+ export { OTPStatusLabel };
@@ -0,0 +1,3 @@
1
+ import type { OTPStatusLabelProps } from "./types";
2
+ declare const OTPStatusLabel: ({ status, timer }: OTPStatusLabelProps) => import("react/jsx-runtime").JSX.Element | null;
3
+ export { OTPStatusLabel };
@@ -0,0 +1,6 @@
1
+ type OTPStatus = 'timer' | 'valid' | 'invalid' | 'loading';
2
+ interface OTPStatusLabelProps {
3
+ status: OTPStatus | string;
4
+ timer?: number;
5
+ }
6
+ export type { OTPStatusLabelProps, OTPStatus };
@@ -0,0 +1,13 @@
1
+ import type { UsePasswordCriteriaProps } from "../types";
2
+ declare const usePasswordCriteria: ({ email, password, onCriteriaChange, onMaxLengthChange }: UsePasswordCriteriaProps) => {
3
+ loading: boolean;
4
+ passwordPolicy: {
5
+ minLength: number;
6
+ numbers: boolean;
7
+ uppercase: boolean;
8
+ lowercase: boolean;
9
+ specialCharacters: boolean;
10
+ };
11
+ renderLabel: (criteria: string) => string;
12
+ };
13
+ export { usePasswordCriteria };
@@ -0,0 +1,3 @@
1
+ import type { PasswordCriteriaProps } from "./types";
2
+ declare const PasswordCriteria: ({ email, password, criteria, onCriteriaChange, onMaxLengthChange }: PasswordCriteriaProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { PasswordCriteria };
@@ -0,0 +1,3 @@
1
+ import type { PasswordCriteriaProps } from './types';
2
+ declare const PasswordCriteria: ({ email, password, criteria, onCriteriaChange, onMaxLengthChange }: PasswordCriteriaProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { PasswordCriteria };
@@ -0,0 +1,15 @@
1
+ import type { Dispatch, SetStateAction } from 'react';
2
+ interface PasswordCriteriaProps {
3
+ email: string;
4
+ password: string;
5
+ criteria: Record<string, boolean>;
6
+ onCriteriaChange: Dispatch<SetStateAction<Record<string, boolean>>>;
7
+ onMaxLengthChange: Dispatch<SetStateAction<number>>;
8
+ }
9
+ interface UsePasswordCriteriaProps {
10
+ email: string;
11
+ password: string;
12
+ onCriteriaChange: Dispatch<SetStateAction<Record<string, boolean>>>;
13
+ onMaxLengthChange: Dispatch<SetStateAction<number>>;
14
+ }
15
+ export type { PasswordCriteriaProps, UsePasswordCriteriaProps };
@@ -0,0 +1,3 @@
1
+ import type { ScreenLayoutProps } from "./types";
2
+ declare const ScreenLayout: ({ children, title, subTitle, buttonProps, onPressBack }: ScreenLayoutProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { ScreenLayout };
@@ -0,0 +1,3 @@
1
+ import type { ScreenLayoutProps } from './types';
2
+ declare const ScreenLayout: ({ children, title, subTitle, hideHeader, buttonProps, containerStyle, accessoryRight }: ScreenLayoutProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { ScreenLayout };
@@ -0,0 +1,12 @@
1
+ import type { ViewStyle } from "react-native";
2
+ interface ScreenLayoutProps {
3
+ title: React.ReactNode;
4
+ subTitle?: React.ReactNode;
5
+ children?: React.ReactNode;
6
+ buttonProps?: any;
7
+ hideHeader?: boolean;
8
+ containerStyle?: ViewStyle;
9
+ accessoryRight?: React.ReactElement;
10
+ onPressBack?: () => void;
11
+ }
12
+ export type { ScreenLayoutProps };
@@ -0,0 +1,2 @@
1
+ declare const SupportDetails: () => import("react/jsx-runtime").JSX.Element;
2
+ export { SupportDetails };
@@ -0,0 +1,2 @@
1
+ declare const SupportDetails: () => null;
2
+ export { SupportDetails };
@@ -0,0 +1,3 @@
1
+ import type { OTPVerifyProps } from "./types";
2
+ declare const OTPVerify: ({ validateOTP, timer, resendOTP, phone, status, resendTextClassName }: OTPVerifyProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { OTPVerify };
@@ -0,0 +1,3 @@
1
+ import type { OTPVerifyProps } from './types';
2
+ declare const OTPVerify: ({ validateOTP, timer, status, resendOTP, phone }: OTPVerifyProps) => import("react/jsx-runtime").JSX.Element;
3
+ export { OTPVerify };
@@ -0,0 +1,10 @@
1
+ import type { OTPStatus } from "../OTPStatusLabel/types";
2
+ interface OTPVerifyProps {
3
+ validateOTP: (otp: string) => void;
4
+ timer: number;
5
+ status: OTPStatus | string;
6
+ resendOTP: () => void;
7
+ phone?: string;
8
+ resendTextClassName?: string;
9
+ }
10
+ export type { OTPVerifyProps };
@@ -0,0 +1 @@
1
+ export { MEMBER_IMAGES_URL } from "@truworth/twc-web-common";
@@ -0,0 +1,3 @@
1
+ declare const CdnImageUrl: () => string | null;
2
+ export { CdnImageUrl };
3
+ export default CdnImageUrl;
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import type { AuthContextProps, AuthContextValue, AuthPackageContextValue } from './type';
3
+ /**
4
+ * Public Auth Authentication Context
5
+ *
6
+ * Exposed to consumers of the Auth package.
7
+ * Provides access to user profile, client info, logout, and helper utilities.
8
+ */
9
+ declare const AuthContext: React.Context<AuthContextValue | null>;
10
+ /**
11
+ * Package Auth Authentication Context
12
+ *
13
+ * Not meant for public use. Contains lower-level auth state such as
14
+ * token, login/logout functions, and refresh session.
15
+ */
16
+ declare const AuthPackageContext: React.Context<AuthPackageContextValue | null>;
17
+ /**
18
+ * AuthProvider
19
+ *
20
+ * Provides authentication state and actions to children.
21
+ * Wraps both AuthContext (public) and AuthPackageContext (internal).
22
+ *
23
+ * @param children - React children to be rendered inside the provider
24
+ * @param LogoComponent - Optional component for branding/logo in auth flows
25
+ * @param session - Initial session containing token & sessionTimeout (if available)
26
+ * @param supportEmail - Optional support email for auth flows
27
+ * @param appConfig - Optional app config for auth flows
28
+ * @param onLogin - Optional callback after successful login
29
+ * @param onLogout - Optional callback after successful logout
30
+ * @param onLaunchAuthSession - Optional callback after successfully launching the auth session. For example, it can be used to set the Firebase notification token or request Android permissions.
31
+ * @param onRefreshSession - Optional handler for refreshing user session
32
+ */
33
+ declare const AuthProvider: ({ children, LogoComponent, session, appConfig, onLogin, onLogout, onLaunchAuthSession, onRefreshSession }: AuthContextProps) => import("react/jsx-runtime").JSX.Element;
34
+ export { AuthProvider };
35
+ export default AuthContext;
36
+ export { AuthPackageContext };
@@ -0,0 +1,58 @@
1
+ import type React from 'react';
2
+ import type { ClientProfile, MemberProfile, Profile, Partner, RegistrationMethod } from '../types/types';
3
+ interface LoginResponse {
4
+ token: string;
5
+ member?: MemberProfile;
6
+ }
7
+ interface RefreshSessionResponse {
8
+ token: string;
9
+ }
10
+ interface AppConfig {
11
+ appName?: string;
12
+ supportEmail?: string;
13
+ privacyPolicyUrl?: string;
14
+ termsAndConditionsUrl?: string;
15
+ }
16
+ interface AuthContextProps {
17
+ children: React.ReactNode;
18
+ LogoComponent?: React.ComponentType | React.ReactElement;
19
+ session: {
20
+ token: string;
21
+ sessionTimeout?: boolean;
22
+ };
23
+ appConfig?: AppConfig;
24
+ onLogin: (result: LoginResponse) => void;
25
+ onLogout: () => Promise<any>;
26
+ onRefreshSession?: (result: RefreshSessionResponse) => Promise<void>;
27
+ onLaunchAuthSession?: () => void;
28
+ }
29
+ interface AuthContextValue {
30
+ isLoadingProfile?: boolean;
31
+ member?: MemberProfile | null;
32
+ client?: ClientProfile | null;
33
+ logout: () => Promise<any>;
34
+ onLaunchAuthSession?: () => void;
35
+ getUserProfile?: () => Promise<any>;
36
+ onOtpReceived?: (otp: string) => void;
37
+ }
38
+ interface AuthPackageContextValue {
39
+ token: string;
40
+ LogoComponent?: React.ComponentType | React.ReactElement;
41
+ appConfig: AppConfig;
42
+ onTokenChange: (token: string) => void;
43
+ onLogin: (result: LoginResponse) => void;
44
+ logout: () => void;
45
+ refreshSession?: (result: RefreshSessionResponse) => Promise<void>;
46
+ onLaunchAuthSession?: () => void;
47
+ registrationMethod: RegistrationMethod;
48
+ onRegistrationMethodChange: (method: RegistrationMethod) => void;
49
+ otpValue?: string;
50
+ }
51
+ interface AuthConfigResponse {
52
+ profile: Profile;
53
+ config: any;
54
+ screenRecording: boolean;
55
+ isInternational: boolean;
56
+ defaultCircle: any;
57
+ }
58
+ export type { LoginResponse, AuthContextProps, AuthContextValue, MemberProfile, ClientProfile, AuthConfigResponse, Profile, Partner, AuthPackageContextValue, RefreshSessionResponse };
@@ -0,0 +1,5 @@
1
+ import type { NetworkProps } from './types';
2
+ import type { BaseRequestOptions } from '../types/types';
3
+ export declare const createHttpClient: ({ token, onRefreshSession, onLogout }: NetworkProps) => {
4
+ request: ({ url, method, data, ...axiosOptions }: BaseRequestOptions) => Promise<unknown>;
5
+ };
@@ -0,0 +1,2 @@
1
+ export declare const validatePhoneNo: (text: string) => boolean;
2
+ export declare const validateEmojiRegex: (text: string) => string;
@@ -0,0 +1,3 @@
1
+ import type { MessageHandler } from "./types";
2
+ declare const showMessage: MessageHandler;
3
+ export { showMessage };
@@ -0,0 +1,3 @@
1
+ import type { MessageHandler } from "./types";
2
+ declare const showMessage: MessageHandler;
3
+ export { showMessage };
@@ -0,0 +1,2 @@
1
+ type MessageHandler = (message: string | Error | object, leftIcon?: string) => void;
2
+ export type { MessageHandler };
@@ -0,0 +1,13 @@
1
+ import type { RefreshSessionResponse } from "../contexts/type";
2
+ import type { AxiosRequestConfig } from "axios";
3
+ interface RequestOptionsProps extends AxiosRequestConfig {
4
+ token?: string;
5
+ logout: () => Promise<any>;
6
+ refreshSession: (result: RefreshSessionResponse) => Promise<any>;
7
+ }
8
+ interface NetworkProps {
9
+ token: string;
10
+ onRefreshSession?: (token: string) => Promise<any>;
11
+ onLogout?: () => Promise<any>;
12
+ }
13
+ export type { RequestOptionsProps, NetworkProps };
@@ -0,0 +1 @@
1
+ export declare const useAuthPackageContext: () => import("../..").AuthPackageContextValue;
@@ -0,0 +1,3 @@
1
+ declare const useTimer: (duration: number) => number;
2
+ declare const useInterval: (callback: Function, delay: (number | null)) => void;
3
+ export { useTimer, useInterval };
@@ -0,0 +1,2 @@
1
+ declare const useAuthContext: () => import("..").AuthContextValue;
2
+ export { useAuthContext };
@@ -0,0 +1,5 @@
1
+ import type { UseRequestOptions } from '../types/types';
2
+ declare const useRequest: () => {
3
+ makeRequest: ({ url, method, body, onSuccess, onFailure, ...axiosOptions }: UseRequestOptions) => Promise<any>;
4
+ };
5
+ export { useRequest };
@@ -0,0 +1,8 @@
1
+ export * from './contexts/AuthContext';
2
+ export { default as AuthContext } from './contexts/AuthContext';
3
+ export * from './contexts/type';
4
+ export * from './hooks/useAuthContext';
5
+ export * from './hooks/useRequest';
6
+ export * from './navigator';
7
+ export * from './screens/Login/components/LoginWebComponent';
8
+ export * from './screens/SignUp/components/SignUpWebComponent';
@@ -0,0 +1,2 @@
1
+ declare const AuthNavigator: () => null;
2
+ export { AuthNavigator };