@truworth/twc-auth 1.2.1 → 1.2.2

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.
@@ -1,19 +1,19 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { isIphoneX } from "@truworth/twc-rn-common";
3
- import { ActivityIndicator, Text, View } from "react-native";
3
+ import { ActivityIndicator, Platform, Text, View } from "react-native";
4
4
  import LinearGradient from "react-native-linear-gradient";
5
5
  import OkayIcon from '../../../assets/okay_icon.svg';
6
6
  import CrossIcon from '../../../assets/cross_icon.svg';
7
7
  const OTPStatusLabel = ({ status, timer }) => {
8
8
  switch (status) {
9
9
  case 'timer':
10
- return (_jsx(View, { style: { height: isIphoneX() ? 80 : 70, width: '100%', justifyContent: 'center' }, children: _jsx(LinearGradient, { colors: ['#b0bbbd', '#b0bbbd'], style: { flex: 1, justifyContent: 'center', alignItems: 'center' }, start: { x: 0, y: 0 }, end: { x: 1, y: 0 }, children: _jsx(Text, { style: { textAlign: 'center', fontSize: 15, color: '#FFFFFF', textTransform: 'uppercase' }, children: timer && timer > 0 ? `${timer} seconds` : 'OTP expired' }) }) }));
10
+ return (_jsx(View, { style: { height: isIphoneX() ? 80 : 70, width: '100%', justifyContent: 'center', marginBottom: Platform.OS === 'ios' ? 14 : 0 }, children: _jsx(LinearGradient, { colors: ['#b0bbbd', '#b0bbbd'], style: { flex: 1, justifyContent: 'center', alignItems: 'center' }, start: { x: 0, y: 0 }, end: { x: 1, y: 0 }, children: _jsx(Text, { style: { textAlign: 'center', fontSize: 15, color: '#FFFFFF', textTransform: 'uppercase' }, children: timer && timer > 0 ? `${timer} seconds` : 'OTP expired' }) }) }));
11
11
  case 'valid':
12
- return (_jsx(View, { style: { height: isIphoneX() ? 80 : 70, width: '100%', justifyContent: 'center' }, children: _jsx(LinearGradient, { colors: ['#44cfb9', '#1EC2C9'], style: { flex: 1, alignItems: 'center', justifyContent: 'center' }, start: { x: 0, y: 0 }, end: { x: 1, y: 0 }, children: _jsx(Text, { style: { textAlign: 'center', fontSize: 15, color: '#fff', textTransform: 'uppercase' }, children: _jsx(OkayIcon, {}) }) }) }));
12
+ return (_jsx(View, { style: { height: isIphoneX() ? 80 : 70, width: '100%', justifyContent: 'center', marginBottom: Platform.OS === 'ios' ? 14 : 0 }, children: _jsx(LinearGradient, { colors: ['#44cfb9', '#1EC2C9'], style: { flex: 1, alignItems: 'center', justifyContent: 'center' }, start: { x: 0, y: 0 }, end: { x: 1, y: 0 }, children: _jsx(Text, { style: { textAlign: 'center', fontSize: 15, color: '#fff', textTransform: 'uppercase' }, children: _jsx(OkayIcon, {}) }) }) }));
13
13
  case 'invalid':
14
- return (_jsx(View, { style: { height: isIphoneX() ? 80 : 70, width: '100%', justifyContent: 'center' }, children: _jsx(LinearGradient, { colors: ['#F3698B', '#F18A8A'], style: { flex: 1, alignItems: 'center', justifyContent: 'center' }, start: { x: 0, y: 0 }, end: { x: 1, y: 0 }, children: _jsx(Text, { style: { textAlign: 'center', fontSize: 15, color: '#fff', textTransform: 'uppercase' }, children: _jsx(CrossIcon, {}) }) }) }));
14
+ return (_jsx(View, { style: { height: isIphoneX() ? 80 : 70, width: '100%', justifyContent: 'center', marginBottom: Platform.OS === 'ios' ? 14 : 0 }, children: _jsx(LinearGradient, { colors: ['#F3698B', '#F18A8A'], style: { flex: 1, alignItems: 'center', justifyContent: 'center' }, start: { x: 0, y: 0 }, end: { x: 1, y: 0 }, children: _jsx(Text, { style: { textAlign: 'center', fontSize: 15, color: '#fff', textTransform: 'uppercase' }, children: _jsx(CrossIcon, {}) }) }) }));
15
15
  case 'loading':
16
- return (_jsx(View, { style: { height: isIphoneX() ? 80 : 70, width: '100%', justifyContent: 'center' }, children: _jsx(LinearGradient, { colors: ['#b0bbbd', '#b0bbbd'], style: { flex: 1, alignItems: 'center', justifyContent: 'center' }, start: { x: 0, y: 0 }, end: { x: 1, y: 0 }, children: _jsx(View, { style: { alignItems: 'center' }, children: _jsx(ActivityIndicator, { color: 'black' }) }) }) }));
16
+ return (_jsx(View, { style: { height: isIphoneX() ? 80 : 70, width: '100%', justifyContent: 'center', marginBottom: Platform.OS === 'ios' ? 14 : 0 }, children: _jsx(LinearGradient, { colors: ['#b0bbbd', '#b0bbbd'], style: { flex: 1, alignItems: 'center', justifyContent: 'center' }, start: { x: 0, y: 0 }, end: { x: 1, y: 0 }, children: _jsx(View, { style: { alignItems: 'center' }, children: _jsx(ActivityIndicator, { color: 'black' }) }) }) }));
17
17
  default:
18
18
  return null;
19
19
  }
@@ -9,11 +9,14 @@ const PasswordCriteria = ({ email, password, criteria, onCriteriaChange, onMaxLe
9
9
  const getCriteriaBackground = (isValid) => (isValid ? utility.success_bg : gray.gray_100);
10
10
  return (_jsx(View, { style: { flexDirection: 'row', alignItems: 'center', flexWrap: 'wrap', alignContent: 'space-between', marginTop: 8 }, children: Object.keys(passwordPolicy).map((item, index) => (loading
11
11
  ? _jsx(LoadingPlaceholder, { height: 24, width: renderLabel(item).length * 8, borderRadius: 12, containerStyle: { marginRight: 8, marginTop: 8 } }, index)
12
- : _jsx(Text, { style: {
13
- fontSize: 12, fontWeight: '500', marginRight: 8, marginTop: 8, borderRadius: 32,
14
- paddingVertical: 4, paddingHorizontal: 12,
15
- backgroundColor: getCriteriaBackground(criteria[item]),
16
- color: getCriteriaColor(criteria[item]),
17
- }, children: renderLabel(item) }, index))) }));
12
+ :
13
+ _jsx(View, { style: {
14
+ marginRight: 8, marginTop: 8, borderRadius: 32,
15
+ paddingVertical: 4, paddingHorizontal: 12,
16
+ backgroundColor: getCriteriaBackground(criteria[item]),
17
+ }, children: _jsx(Text, { style: {
18
+ fontSize: 12, fontWeight: '500',
19
+ color: getCriteriaColor(criteria[item]),
20
+ }, children: renderLabel(item) }) }, index))) }));
18
21
  };
19
22
  export { PasswordCriteria };
@@ -20,7 +20,7 @@ const OTPVerify = ({ validateOTP, timer, status, resendOTP, phone }) => {
20
20
  setOTP(otpValue);
21
21
  }
22
22
  }, [otpValue]);
23
- return (_jsxs(Layout, { style: { flex: 1, backgroundColor: '#FFFFFF' }, children: [_jsx(Header, {}), _jsxs(CustomKeyboardAvoidingView, { behavior: Platform.OS === 'ios' ? 'padding' : undefined, keyboardVerticalOffset: Platform.OS === 'ios' ? 100 : 0, children: [_jsxs(ScrollView, { style: { paddingHorizontal: 20, paddingTop: 32, flex: 1 }, children: [_jsxs(Text, { textBreakStrategy: 'simple', style: {
23
+ return (_jsxs(Layout, { style: { flex: 1, backgroundColor: '#FFFFFF' }, children: [_jsx(Header, {}), _jsxs(CustomKeyboardAvoidingView, { behavior: Platform.OS === 'ios' ? 'padding' : undefined, keyboardVerticalOffset: 0, children: [_jsxs(ScrollView, { style: { paddingHorizontal: 20, paddingTop: 32, flex: 1 }, children: [_jsxs(Text, { textBreakStrategy: 'simple', style: {
24
24
  fontSize: 20, fontWeight: '600', color: gray.gray_900,
25
25
  lineHeight: 32, marginBottom: 32,
26
26
  }, children: ["OTP sent to ", '\n', phone ? phone.replace(/\d(?=\d{4})/g, 'x') : ''] }), _jsx(View, { style: { justifyContent: 'center', flexDirection: 'row', marginBottom: 30, position: 'relative' }, children: _jsx(OTPInputView, { pinCount: 6, autoFocusOnLoad: false, onCodeChanged: text => setOTP(text), codeInputFieldStyle: {
@@ -34,7 +34,7 @@ const AuthPackageContext = React.createContext(null);
34
34
  */
35
35
  const AuthProvider = ({ children, LogoComponent, session, appConfig, onLogin, onLogout, onLaunchAuthSession, onRefreshSession }) => {
36
36
  const [isLoadingProfile, setIsLoadingProfile] = useState(false);
37
- const [member, setMember] = useState(null);
37
+ const [profile, setProfile] = useState(null);
38
38
  const [client, setClient] = useState(null);
39
39
  const [registrationMethod, setRegistrationMethod] = useState(null);
40
40
  const [token, setToken] = useState('');
@@ -61,10 +61,10 @@ const AuthProvider = ({ children, LogoComponent, session, appConfig, onLogin, on
61
61
  * fetch user profile if not already loaded.
62
62
  */
63
63
  useEffect(() => {
64
- if (token && !member) {
64
+ if (token && !profile) {
65
65
  getUserProfile();
66
66
  }
67
- }, [token, member]);
67
+ }, [token, profile]);
68
68
  /**
69
69
  * Logout user and clear authentication state.
70
70
  * Falls back to default /auth/logout request
@@ -106,7 +106,7 @@ const AuthProvider = ({ children, LogoComponent, session, appConfig, onLogin, on
106
106
  return resolve(data);
107
107
  }
108
108
  const formatted = formatUserData(data);
109
- setMember(formatted.profile);
109
+ setProfile(formatted.profile);
110
110
  setClient(formatted.client);
111
111
  resolve(data);
112
112
  }).catch((err) => {
@@ -119,7 +119,7 @@ const AuthProvider = ({ children, LogoComponent, session, appConfig, onLogin, on
119
119
  const clearSession = useCallback(() => {
120
120
  setToken('');
121
121
  setClient(null);
122
- setMember(null);
122
+ setProfile(null);
123
123
  setRegistrationMethod(null);
124
124
  }, []);
125
125
  /**
@@ -150,9 +150,10 @@ const AuthProvider = ({ children, LogoComponent, session, appConfig, onLogin, on
150
150
  setTimeout(() => setOtpValue(''), 0);
151
151
  };
152
152
  const AuthContextValues = {
153
- isLoadingProfile,
154
- member,
153
+ token,
154
+ profile,
155
155
  client,
156
+ isLoadingProfile,
156
157
  logout,
157
158
  onLaunchAuthSession,
158
159
  getUserProfile,
@@ -14,6 +14,9 @@ const useRequest = () => {
14
14
  onLogout: async () => logout(),
15
15
  }), [token, logout, refreshSession]);
16
16
  const makeRequest = async ({ url, method, body, onSuccess, onFailure, ...axiosOptions }) => {
17
+ if (!token) {
18
+ return;
19
+ }
17
20
  try {
18
21
  const response = await request({
19
22
  url,
@@ -5,6 +5,8 @@ export * from './contexts/type';
5
5
  // export hooks
6
6
  export * from './hooks/useAuthContext';
7
7
  export * from './hooks/useRequest';
8
+ // export axiosClient
9
+ export * from './api/axiosClient';
8
10
  // export navigator/router
9
11
  export * from './navigator';
10
12
  // export components
@@ -82,7 +82,7 @@ const SignUpFormComponent = ({ email, registrationMethod, userDetails, onContinu
82
82
  });
83
83
  },
84
84
  disabled: !values.firstName || !values.lastName || !values.gender || !values.dateOfBirth || !values.phone || !termsAndConditions || !isHuman
85
- }, onPressBack: onGoToLogin, children: _jsxs(Form, { form: form, className: "w-full", onSubmit: () => { }, children: [_jsxs(Row, { gutter: 18, className: "py-0 my-0", children: [_jsx(Col, { xs: 24, md: 12, children: _jsx(Form.Item, { name: "firstName", label: "First Name", className: 'mt-5', rules: [
85
+ }, onPressBack: onGoToLogin, children: _jsxs(Form, { form: form, className: "w-full", onSubmit: () => { }, children: [_jsxs(Row, { gutter: 18, className: "py-0 my-0", children: [_jsx(Col, { xs: 24, md: 12, children: _jsx(Form.Item, { label: "First Name", className: 'mt-5', rules: [
86
86
  {
87
87
  required: true,
88
88
  message: 'Please enter your first name'
@@ -98,9 +98,9 @@ const SignUpFormComponent = ({ email, registrationMethod, userDetails, onContinu
98
98
  }
99
99
  },
100
100
  },
101
- ], normalize: (value) => (value ?? '').replace(/[^a-zA-Z]/g, ''), children: _jsx(TextInput, { placeholder: "Enter your first name", ...form.register('firstName', {
102
- onChange: (e) => onFirstName(e.target.value)
103
- }) }) }) }), _jsx(Col, { xs: 24, md: 12, children: _jsx(Form.Item, { name: "lastName", label: "Last Name", className: 'mt-5', rules: [
101
+ ], normalize: (value) => (value ?? '').replace(/[^a-zA-Z]/g, ''), ...form.register('firstName', {
102
+ onChange: (e) => onFirstName(e.target.value)
103
+ }), children: _jsx(TextInput, { placeholder: "Enter your first name" }) }) }), _jsx(Col, { xs: 24, md: 12, children: _jsx(Form.Item, { label: "Last Name", className: 'mt-5', rules: [
104
104
  {
105
105
  required: true,
106
106
  message: 'Please enter your last name'
@@ -116,54 +116,47 @@ const SignUpFormComponent = ({ email, registrationMethod, userDetails, onContinu
116
116
  }
117
117
  },
118
118
  },
119
- ], normalize: (value) => (value ?? '').replace(/[^a-zA-Z]/g, ''), children: _jsx(TextInput, { placeholder: "Enter your last name", ...form.register('lastName', {
120
- onChange: (e) => onLastName(e.target.value)
121
- }) }) }) })] }), _jsxs(Row, { gutter: 18, className: "py-0 mt-4 relative", children: [_jsx(Col, { xs: 18, md: 19, children: _jsx(Typography, { type: "body", size: "large", className: "text-gray-700", children: "Your biological sex at the time of birth" }) }), _jsxs(Col, { xs: 6, md: 5, className: "flex justify-end group", children: [_jsx(Typography, { type: "body", size: "large", className: "text-primary cursor-pointer whitespace-nowrap", children: "Know More" }), _jsxs(Flex, { className: "hidden group-hover:block w-full absolute left-2 top-6 rounded-md p-4 z-10 text-gray-950 bg-white shadow-[0_0_10px_0_rgba(0,0,0,0.3)]", children: [_jsxs(Flex, { className: "p-0 mb-3 gap-3", children: [_jsx(Image, { src: `${CDN_IMAGES_URL}/registration/gender-diversity.svg`, alt: "gender diversity", width: 44, height: 44, className: "h-auto" }), _jsxs(Typography, { type: "body", size: "large", className: "text-gray-800", children: ["The ", appName, " respects Gender Diversity & Inclusion!"] })] }), _jsxs(Typography, { type: "body", size: "small", className: "text-gray-500", children: [appName, " aims to provide you with a personalized wellness experience. This requires us to incorporate certain algorithms based on protocols provided by established health & medical institutions around the world. These protocols are based on your biological sex at birth."] })] })] })] }), _jsx(Row, { className: "py-0 mb-5", children: _jsx(Col, { children: _jsx(Form.Item, { name: "gender", className: "mt-4", rules: [
119
+ ], normalize: (value) => (value ?? '').replace(/[^a-zA-Z]/g, ''), ...form.register('lastName', {
120
+ onChange: (e) => onLastName(e.target.value)
121
+ }), children: _jsx(TextInput, { placeholder: "Enter your last name" }) }) })] }), _jsxs(Row, { gutter: 18, className: "py-0 mt-4 relative", children: [_jsx(Col, { xs: 18, md: 19, children: _jsx(Typography, { type: "body", size: "large", className: "text-gray-700", children: "Your biological sex at the time of birth" }) }), _jsxs(Col, { xs: 6, md: 5, className: "flex justify-end group", children: [_jsx(Typography, { type: "body", size: "large", className: "text-primary cursor-pointer whitespace-nowrap", children: "Know More" }), _jsxs(Flex, { className: "hidden group-hover:block w-full absolute left-2 top-6 rounded-md p-4 z-10 text-gray-950 bg-white shadow-[0_0_10px_0_rgba(0,0,0,0.3)]", children: [_jsxs(Flex, { className: "p-0 mb-3 gap-3", children: [_jsx(Image, { src: `${CDN_IMAGES_URL}/registration/gender-diversity.svg`, alt: "gender diversity", width: 44, height: 44, className: "h-auto" }), _jsxs(Typography, { type: "body", size: "large", className: "text-gray-800", children: ["The ", appName, " respects Gender Diversity & Inclusion!"] })] }), _jsxs(Typography, { type: "body", size: "small", className: "text-gray-500", children: [appName, " aims to provide you with a personalized wellness experience. This requires us to incorporate certain algorithms based on protocols provided by established health & medical institutions around the world. These protocols are based on your biological sex at birth."] })] })] })] }), _jsx(Row, { className: "py-0 mb-5", children: _jsx(Col, { children: _jsx(Form.Item, { className: "mt-4", rules: [
122
122
  {
123
123
  required: true,
124
124
  message: 'Please select your biological sex'
125
125
  }
126
- ], children: _jsx(RadioGroup, { orientation: "horizontal", options: [
126
+ ], ...form.register('gender', {
127
+ onChange: (e) => setGender(e.target.value)
128
+ }), children: _jsx(RadioGroup, { orientation: "horizontal", options: [
127
129
  { label: 'Male', value: 'M' },
128
130
  { label: 'Female', value: 'F' },
129
- ], ...form.register('gender', {
130
- onChange: (e) => setGender(e.target.value)
131
- }) }) }) }) }), _jsxs(Row, { gutter: 18, className: "py-0 my-5", children: [_jsx(Col, { xs: 24, md: 24, lg: 12, children: _jsx(Form.Item, { name: "dateOfBirth", label: "Date of Birth", rules: [
131
+ ] }) }) }) }), _jsxs(Row, { gutter: 18, className: "py-0 my-5", children: [_jsx(Col, { xs: 24, md: 24, lg: 12, children: _jsx(Form.Item, { label: "Date of Birth", rules: [
132
132
  {
133
133
  required: true,
134
134
  message: 'Please select your date of birth'
135
135
  }
136
- ], children: _jsx(DatePicker, { required: true, size: "middle", format: "dd/MM/yyyy", placeholder: "DD/MM/YYYY",
136
+ ], ...form.register('dateOfBirth', {
137
+ onChange: (value, dateString) => setSelectedDOB(dateString ?? (value?.toISOString ? value.toISOString() : String(value)))
138
+ }), children: _jsx(DatePicker, { required: true, size: "middle", format: "dd/MM/yyyy", placeholder: "DD/MM/YYYY",
137
139
  /* @ts-ignore */
138
- disabledDate: disabledDate, iconPosition: "right", defaultPickerValue: dayjs('1990-01-01').toDate(), suffixIcon: _jsx(CalendarDays, { className: "-mt-2" }), ...form.register('dateOfBirth', {
139
- onChange: (value, dateString) => setSelectedDOB(dateString ?? (value?.toISOString ? value.toISOString() : String(value)))
140
- }) }) }) }), _jsx(Col, { xs: 24, md: 24, lg: 12, children: _jsx(Form.Item, { label: "Mobile Number", className: "mb-0", name: "phone", rules: [
140
+ disabledDate: disabledDate, iconPosition: "right", defaultPickerValue: dayjs('1990-01-01').toDate(), suffixIcon: _jsx(CalendarDays, { className: "-mt-2" }) }) }) }), _jsx(Col, { xs: 24, md: 24, lg: 12, children: _jsx(Form.Item, { label: "Mobile Number", className: "mb-0", rules: [
141
141
  {
142
142
  required: true,
143
143
  message: 'Please enter your mobile number'
144
144
  }
145
- ], children: _jsx(Flex, { className: "border border-gray-400 rounded-md", children: _jsx(TextInput, { type: "tel", value: values.phone, placeholder: "Mobile number", maxLength: countryCode === "91" ? 10 : 14, className: "py-4 border-0 md:text-base", addonBefore: _jsx(CountryCodeDropdown, { selectedCountry: selectedCountry, handleSelect: (country) => {
145
+ ], ...form.register("phone", {
146
+ onChange: (e) => enterMobile(e.target.value)
147
+ }), children: _jsx(Flex, { className: "border border-gray-400 rounded-md", children: _jsx(TextInput, { type: "tel", value: phone, placeholder: "Mobile number", maxLength: countryCode === "91" ? 10 : 14, className: "py-4 border-0 md:text-base", addonBefore: _jsx(CountryCodeDropdown, { selectedCountry: selectedCountry, handleSelect: (country) => {
146
148
  setCountryCode(country.phoneCode);
147
149
  setSelectedCountry(country);
148
150
  setIsPhoneValid(country.phoneCode === "91"
149
151
  ? /^[0-9]+$/.test(phone) && phone.length >= 10
150
152
  : phone.length > 5);
151
- } }), ...form.register("phone", {
152
- onChange: (e) => enterMobile(e.target.value)
153
- }) }) }) }) })] }), _jsx(Col, { children: _jsx(Form.Item, { name: "referralCode", label: "Referral Code (Optional)", className: "mt-4", children: _jsx(TextInput, { placeholder: "Referral code", ...form.register('referralCode', {
153
+ } }) }) }) }) })] }), _jsx(Col, { children: _jsx(Form.Item, { name: "referralCode", label: "Referral Code (Optional)", className: "mt-4", children: _jsx(TextInput, { placeholder: "Referral code", ...form.register('referralCode', {
154
154
  onChange: (e) => setReferralCode(e.target.value)
155
155
  }) }) }) }), isProduction && (process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY
156
156
  ? _jsx(RecaptchaComponent, { onChange: handleCaptcha })
157
- : _jsx(Typography, { type: "utility", size: "small", color: "red-600", children: "reCAPTCHA misconfigured. Set NEXT_PUBLIC_RECAPTCHA_SITE_KEY." })), _jsx(Row, { className: "py-0 my-5", children: _jsx(Col, { children: _jsx(Form.Item, { name: "termsAndConditions", rules: [
158
- {
159
- required: true,
160
- message: 'Please accept the Terms & Conditions'
161
- }
162
- ],
163
- /* @ts-ignore */
164
- valuePropName: "checked", children: _jsx(CustomCheckbox, { checked: termsAndConditions, onClick: (e) => {
165
- setTermsAndConditions(prev => !prev);
166
- }, className: "mt-4", label: _jsxs(Typography, { type: "body", size: "medium", children: ["I accept the", _jsx("a", { target: "_blank", rel: "noopener noreferrer", href: termsAndConditionsUrl, className: "px-1 text-primary", children: "Terms & Conditions" }), "listed on ", appName] }) }) }) }) })] }) }), _jsxs(Flex, { align: 'center', className: 'p-0 mt-4', children: [_jsx(Typography, { type: "body", size: "large", className: "text-gray-700", children: "Already have an account?" }), _jsx(Button, { label: "Sign-In", variant: "link", size: "medium", className: "ml-2 h-auto px-0", onClick: onGoToLogin })] }), existingAccountModal &&
157
+ : _jsx(Typography, { type: "utility", size: "small", color: "red-600", children: "reCAPTCHA misconfigured. Set NEXT_PUBLIC_RECAPTCHA_SITE_KEY." })), _jsx(Row, { className: "py-0 my-5", children: _jsx(Col, { children: _jsx(CustomCheckbox, { checked: termsAndConditions, onClick: (e) => {
158
+ setTermsAndConditions(prev => !prev);
159
+ }, className: "mt-4", label: _jsxs(Typography, { type: "body", size: "medium", children: ["I accept the", _jsx("a", { target: "_blank", rel: "noopener noreferrer", href: termsAndConditionsUrl, className: "px-1 text-primary", children: "Terms & Conditions" }), "listed on ", appName] }) }) }) })] }) }), _jsxs(Flex, { align: 'center', className: 'p-0 mt-4', children: [_jsx(Typography, { type: "body", size: "large", className: "text-gray-700", children: "Already have an account?" }), _jsx(Button, { label: "Sign-In", variant: "link", size: "medium", className: "ml-2 h-auto px-0", onClick: onGoToLogin })] }), existingAccountModal &&
167
160
  _jsx(ExistingAccountsModal, { phone: phone, countryCode: countryCode, visible: existingAccountModal, hide: () => setExistingAccountModal(false), existingAccounts: existingAccounts, getLoginTypeText: getLoginTypeText, onGoToLogin: onGoToLogin })] }));
168
161
  };
169
162
  const ExistingAccountsModal = ({ visible, hide, existingAccounts, countryCode, phone, getLoginTypeText, onGoToLogin }) => {
@@ -116,15 +116,15 @@ const ExistingAccountsModal = ({ visible, hide, existingAccounts, countryCode, p
116
116
  }
117
117
  }, FooterComponent: _jsxs(View, { style: {
118
118
  width: '100%',
119
- backgroundColor: 'white',
119
+ backgroundColor: primary.white,
120
120
  marginTop: 8,
121
121
  padding: 16,
122
- marginBottom: isIphoneX() ? 30 : 0,
122
+ paddingBottom: isIphoneX() ? 42 : 16,
123
123
  borderTopWidth: Platform.OS == 'android' ? 1 : 0,
124
124
  borderTopColor: gray.gray_300,
125
125
  shadowColor: '#DDDDDD',
126
126
  shadowOffset: { width: 0, height: -2 },
127
- shadowOpacity: 1,
127
+ shadowOpacity: 0.5,
128
128
  shadowRadius: 3,
129
129
  elevation: 3
130
130
  }, children: [_jsx(RoundedButton, { label: "Go to Login", size: "large", onPress: () => navigation.navigate('EnterEmail'), containerStyle: { marginBottom: 8 } }), _jsxs(TouchableOpacity, { activeOpacity: 0.8, onPress: () => Freshchat.showConversations(), style: {
@@ -48,7 +48,7 @@ const UserConsent = ({ routeParams, onVerifyEmail, onVerifyMobile, onBackHandler
48
48
  registrationParams: routeParams,
49
49
  source: 'web',
50
50
  onResult: onAgreeHandler
51
- }), className: "w-full lg:!w-auto" }), _jsx(Button, { label: "Not Now, I Will Register Later", variant: "link", onClick: () => setRedirectModal(true), className: "w-full mt-4 lg:!w-auto lg:!mt-0" })] })] }) })] }), subTitle: "", onPressBack: onBackHandler, children: redirectModal &&
51
+ }), className: "w-full lg:!w-auto lg:!mt-0" }), _jsx(Button, { label: "Not Now, I Will Register Later", variant: "link", onClick: () => setRedirectModal(true), className: "w-full lg:!w-auto lg:!mt-0" })] })] }) })] }), subTitle: "", onPressBack: onBackHandler, children: redirectModal &&
52
52
  _jsx(RedirectToHomeModal, { redirectModal: redirectModal }) }));
53
53
  };
54
54
  const RedirectToHomeModal = ({ redirectModal }) => {
@@ -41,6 +41,6 @@ const UserConsent = ({ navigation, route }) => {
41
41
  onResult: onAgreeHandler
42
42
  }),
43
43
  disabled: loading,
44
- }, children: _jsxs(View, { style: { marginTop: 24, paddingHorizontal: 8 }, children: [_jsxs(Text, { style: { color: gray.gray_600, fontWeight: '400', lineHeight: 24 }, children: ["I provide ", appName, ", with the consent to collect, use, store, share, and / or otherwise process my personal information including but not limited to Name, Gender (biological sex at the time of birth), Date of Birth and Email Address, Mobile Number, and other health vital & lifestyle information).", ' ', "The information is collected for the specified, explicit and legitimate purposes only \u2013 which is to assess me or my family\u2019s Health Risk, schedule Investigations, Health Check-ups, Doctor Consultations, Procedure, Treatment, provide Health & Wellness Coaching and Payments and ensure that the same is not excessive in relation to the purposes for which it is being collected, and also ensure that such personal information is retained only as long as the user is registered on the platform.", ' ', "I, also agree to receive Email / SMS / WhatsApp alerts and calls in connection with me or my family\u2019s health & wellness services.", ' ', "Please refer to the Terms & Conditions, Privacy & Data Protection Policy listed on", ' '] }), _jsx(TouchableOpacity, { style: { marginTop: 24 }, activeOpacity: 0.8, onPress: () => privacyPolicyUrl && Linking.openURL(privacyPolicyUrl), children: _jsxs(Text, { style: { fontSize: 16, fontWeight: '600', color: primary.primary_main, lineHeight: 24 }, children: [appName, "'s Privacy & Data Protection Policy"] }) })] }) }) })] }));
44
+ }, children: _jsxs(View, { style: { paddingHorizontal: 8 }, children: [_jsxs(Text, { style: { color: gray.gray_600, fontWeight: '400', lineHeight: 24 }, children: ["I provide ", appName, ", with the consent to collect, use, store, share, and / or otherwise process my personal information including but not limited to Name, Gender (biological sex at the time of birth), Date of Birth and Email Address, Mobile Number, and other health vital & lifestyle information).", ' ', "The information is collected for the specified, explicit and legitimate purposes only \u2013 which is to assess me or my family\u2019s Health Risk, schedule Investigations, Health Check-ups, Doctor Consultations, Procedure, Treatment, provide Health & Wellness Coaching and Payments and ensure that the same is not excessive in relation to the purposes for which it is being collected, and also ensure that such personal information is retained only as long as the user is registered on the platform.", ' ', "I, also agree to receive Email / SMS / WhatsApp alerts and calls in connection with me or my family\u2019s health & wellness services.", ' ', "Please refer to the Terms & Conditions, Privacy & Data Protection Policy listed on", ' '] }), _jsx(TouchableOpacity, { style: { marginTop: 16, marginBottom: -12 }, activeOpacity: 0.8, onPress: () => privacyPolicyUrl && Linking.openURL(privacyPolicyUrl), children: _jsxs(Text, { style: { fontSize: 16, fontWeight: '600', color: primary.primary_main, lineHeight: 24 }, children: [appName, "'s Privacy & Data Protection Policy"] }) })] }) }) })] }));
45
45
  };
46
46
  export default UserConsent;
@@ -27,9 +27,10 @@ interface AuthContextProps {
27
27
  onLaunchAuthSession?: () => void;
28
28
  }
29
29
  interface AuthContextValue {
30
- isLoadingProfile?: boolean;
31
- member?: MemberProfile | null;
32
- client?: ClientProfile | null;
30
+ token: string;
31
+ profile: MemberProfile | null;
32
+ client: ClientProfile | null;
33
+ isLoadingProfile: boolean;
33
34
  logout: () => Promise<any>;
34
35
  onLaunchAuthSession?: () => void;
35
36
  getUserProfile?: () => Promise<any>;
@@ -3,6 +3,7 @@ export { default as AuthContext } from './contexts/AuthContext';
3
3
  export * from './contexts/type';
4
4
  export * from './hooks/useAuthContext';
5
5
  export * from './hooks/useRequest';
6
+ export * from './api/axiosClient';
6
7
  export * from './navigator';
7
8
  export * from './screens/Login/components/LoginWebComponent';
8
9
  export * from './screens/SignUp/components/SignUpWebComponent';
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "description": "Truworth Auth Package for React Native and Web",
7
- "version": "1.2.1",
7
+ "version": "1.2.2",
8
8
  "main": "build/src/index.js",
9
9
  "types": "build/types/index.d.ts",
10
10
  "files": [