@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
@@ -0,0 +1,71 @@
1
+ import { useCallback, useEffect, useRef, useState } from "react";
2
+ import { axiosClient } from "../../../../../api/axiosClient";
3
+ import { showMessage } from "../../../../../helpers/show-message";
4
+ /**
5
+ * @internal
6
+ * Hook for managing SSOSearchOrganization screen state and auth context integration.
7
+ * This hook is not exposed to package consumers.
8
+ */
9
+ const useSSOSearchOrganization = () => {
10
+ const [search, setSearch] = useState('');
11
+ const [noSearchResult, setNoSearchResult] = useState(false);
12
+ const [searchLoading, setSearchLoading] = useState(false);
13
+ const [selectedClient, setSelectedClient] = useState(undefined);
14
+ const [clientList, setClientList] = useState([]);
15
+ const latestQueryRef = useRef('');
16
+ const handleSearch = useCallback(() => {
17
+ const query = search.trim();
18
+ if (query.length > 2) {
19
+ latestQueryRef.current = query;
20
+ setNoSearchResult(false);
21
+ setSearchLoading(true);
22
+ axiosClient({
23
+ url: `/auth/login-sso/search-clients`,
24
+ method: 'POST',
25
+ data: { query },
26
+ }).then((res) => {
27
+ if (latestQueryRef.current !== query)
28
+ return;
29
+ if (!res.data.length) {
30
+ setNoSearchResult(true);
31
+ return;
32
+ }
33
+ setClientList(res.data);
34
+ }).catch((error) => {
35
+ if (latestQueryRef.current !== query)
36
+ return;
37
+ showMessage({ message: error?.response?.data?.errors?.[0]?.message || 'Something went wrong' });
38
+ }).finally(() => {
39
+ if (latestQueryRef.current !== query)
40
+ return;
41
+ setSearchLoading(false);
42
+ });
43
+ }
44
+ else {
45
+ setClientList([]);
46
+ setNoSearchResult(false);
47
+ setSearchLoading(false);
48
+ }
49
+ }, [search]);
50
+ const handleSelect = (client) => {
51
+ setSelectedClient(client);
52
+ setClientList([]);
53
+ };
54
+ useEffect(() => {
55
+ setClientList([]);
56
+ const timerId = setTimeout(handleSearch, 1000);
57
+ return () => clearTimeout(timerId);
58
+ }, [handleSearch]);
59
+ return {
60
+ search,
61
+ clientList,
62
+ searchLoading,
63
+ noSearchResult,
64
+ selectedClient,
65
+ setSearch,
66
+ handleSelect,
67
+ setNoSearchResult,
68
+ setSelectedClient,
69
+ };
70
+ };
71
+ export { useSSOSearchOrganization };
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { AutoCompleteField, Flex, Typography } from "@truworth/twc-web-design";
4
+ import { ChevronDown, Search } from "lucide-react";
5
+ import { useSSOSearchOrganization } from "./hooks/internal/useSSOSearchOrganization";
6
+ import { ScreenLayout } from "../../../components/ScreenLayout";
7
+ import _ from "lodash";
8
+ const SSOSearchOrganization = ({ onPressBack, onContinue }) => {
9
+ const [inputActive, setInputActive] = useState(false);
10
+ const { search, clientList, selectedClient, searchLoading, noSearchResult, setSearch, setSelectedClient, setNoSearchResult, handleSelect, } = useSSOSearchOrganization();
11
+ return (_jsx(ScreenLayout, { title: "Search Organization", onPressBack: onPressBack, buttonProps: {
12
+ label: "Continue",
13
+ variant: "primary",
14
+ disabled: _.isEmpty(selectedClient),
15
+ onClick: () => {
16
+ if (!_.isEmpty(selectedClient)) {
17
+ onContinue(selectedClient);
18
+ setSelectedClient(undefined);
19
+ return;
20
+ }
21
+ },
22
+ }, children: _jsx(AutoCompleteField, { type: "text", loading: searchLoading, onSelect: (e, option) => {
23
+ if (!option)
24
+ return;
25
+ const typedOption = option;
26
+ const client = typedOption.client;
27
+ if (client)
28
+ handleSelect(client);
29
+ }, className: "my-4", onFocus: () => { setInputActive(true); }, onSearch: (value) => setSearch(value.trimStart()), placeholder: "Enter at least 3 characters to search...", debounceTimer: 300, value: selectedClient ? selectedClient.name : search, onChange: () => {
30
+ setNoSearchResult(false);
31
+ setSelectedClient(undefined);
32
+ }, leftIcon: false, rightIcon: inputActive && !selectedClient
33
+ ? _jsx(Search, { size: 20, className: "text-gray-600 flex" })
34
+ : _jsx(ChevronDown, { size: 20, className: "text-gray-600 flex" }), notFoundContent: noSearchResult ?
35
+ _jsx(Flex, { padding: "sm", className: "rounded-lg", children: _jsx(Typography, { type: "body", size: "large", className: "text-gray-900", children: `No result found for "${search}"` }) })
36
+ : null, options: clientList.map((item) => {
37
+ return {
38
+ key: item.id,
39
+ value: item.name,
40
+ image: item.image,
41
+ client: item,
42
+ label: (_jsxs(Flex, { align: "center", className: "gap-2", children: [_jsx("img", { src: item.image, width: 32, height: 32, className: "h-auto" }), _jsxs(Typography, { type: "body", size: "medium", children: [" ", item.name] })] })),
43
+ };
44
+ }) }) }));
45
+ };
46
+ export default SSOSearchOrganization;
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Text } from '@ui-kitten/components';
3
+ import { ActivityIndicator, FlatList, TouchableOpacity, View } from 'react-native';
4
+ import { AvatarWithInitials, Colors, SearchField } from '@truworth/twc-rn-common';
5
+ import { useSSOSearchOrganization } from './hooks/internal/useSSOSearchOrganization';
6
+ import { ScreenLayout } from '../../../components/ScreenLayout';
7
+ const { primary, gray, utility, shades_tints } = Colors;
8
+ const SSOSearchOrganization = ({ navigation }) => {
9
+ const { search, setSearch, clientList, searchLoading, noSearchResult, setNoSearchResult } = useSSOSearchOrganization();
10
+ return (_jsxs(ScreenLayout, { headerTitle: "Search Organization", containerStyle: {
11
+ flex: 1, backgroundColor: utility.bg,
12
+ paddingHorizontal: 0, paddingVertical: 0,
13
+ paddingTop: 8
14
+ }, title: "", children: [_jsx(SearchField, { value: search, placeholder: 'Enter at least 3 characters to search...', onChangeValue: (query) => setSearch(query.trimStart()), clearText: () => {
15
+ setNoSearchResult(false);
16
+ setSearch('');
17
+ }, returnKeyType: 'search', autoFocus: true, accessoryRight: searchLoading ? _jsx(ActivityIndicator, { style: { marginRight: 8 } }) : null, showClearIcon: !searchLoading, containerStyle: { marginVertical: 8, marginHorizontal: 16 }, autoComplete: 'off' }), _jsx(FlatList, { data: clientList, contentContainerStyle: { paddingBottom: 32 }, renderItem: ({ item }) => (_jsxs(TouchableOpacity, { onPress: () => navigation.navigate('SSOAuthenticationMethods', { client: item }), activeOpacity: 0.8, style: {
18
+ flexDirection: 'row',
19
+ alignItems: 'center',
20
+ backgroundColor: '#fff',
21
+ padding: 16,
22
+ marginTop: 8,
23
+ borderRadius: 12,
24
+ shadowOffset: { width: 0, height: 2 },
25
+ shadowOpacity: 0.25,
26
+ shadowRadius: 12,
27
+ shadowColor: '#A6A6A6',
28
+ elevation: 11,
29
+ marginHorizontal: 10,
30
+ }, children: [_jsx(AvatarWithInitials, { image: item.image, name: item.name ?? '', size: 'medium', containerStyle: {
31
+ backgroundColor: item.image ? primary.white : shades_tints.p_light_800,
32
+ height: 55, width: 55, borderRadius: 100,
33
+ }, imageProps: { resizeMode: 'contain' }, titleStyle: { fontSize: 12, fontWeight: '500', color: shades_tints.p_dark_500 } }), _jsx(View, { style: { flex: 1, marginLeft: 8 }, children: _jsx(Text, { style: { fontSize: 14, fontWeight: '600', color: gray.gray_900 }, children: item.name }) })] })), ListEmptyComponent: noSearchResult ?
34
+ _jsx(View, { style: { padding: 16 }, children: _jsx(Text, { style: { fontSize: 14, fontWeight: '900', color: gray.gray_900 }, children: `No result found for "${search}"` }) })
35
+ : null })] }));
36
+ };
37
+ export default SSOSearchOrganization;
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import Image from "next/image";
3
2
  import React, { useEffect, useState } from "react";
4
3
  import { CDN_IMAGES_URL } from "@truworth/twc-web-common";
5
4
  import { Button, Col, CustomCheckbox, DatePicker, Flex, Form, RadioGroup, ResponsiveModal, Row, TextInput, Typography, useForm, validationPatterns } from "@truworth/twc-web-design";
@@ -8,37 +7,64 @@ import { SupportDetails } from "../../../../components/SupportDetails";
8
7
  import { ScreenLayout } from "../../../../components/ScreenLayout";
9
8
  import { CountryCodeDropdown } from "../../../CountryCode/components/CountryCodeDropdown";
10
9
  import { useSignUp } from "../../hooks/internal/useSignUp";
10
+ import { useRouter } from "next/router";
11
11
  import ReCAPTCHA from 'react-google-recaptcha';
12
12
  import moment from "moment";
13
13
  import dayjs from 'dayjs';
14
+ import { RegistrationMethod } from "../../../../enums";
15
+ const getQueryParam = (param) => {
16
+ if (Array.isArray(param))
17
+ return param[0];
18
+ return param;
19
+ };
14
20
  const isProduction = process.env.NODE_ENV === 'production';
15
- const SignUpFormComponent = ({ email, registrationMethod, userDetails, onContinue, onGoToLogin }) => {
21
+ const SignUpFormComponent = ({ userDetails, onContinue }) => {
16
22
  const [isHuman, setIsHuman] = useState(isProduction ? false : true);
17
23
  const [termsAndConditions, setTermsAndConditions] = useState(false);
18
- const [selectedCountry, setSelectedCountry] = useState({
19
- countryCode: "in",
20
- phoneCode: "91",
21
- name: "INDIA",
22
- });
24
+ const [selectedCountry, setSelectedCountry] = useState({ countryCode: "in", phoneCode: "91", name: "INDIA" });
25
+ const router = useRouter();
23
26
  const form = useForm({
24
27
  liveValidation: true,
25
28
  defaultValues: {
26
29
  firstName: userDetails.firstName ?? "",
27
30
  lastName: userDetails.lastName ?? "",
28
31
  dateOfBirth: userDetails.selectedDOB,
32
+ email: userDetails.email ?? "",
29
33
  phone: userDetails.phone ?? "",
30
34
  gender: userDetails.gender ?? "",
31
35
  referralCode: userDetails.referralCode ?? "",
32
36
  }
33
37
  });
34
38
  const values = form.watch();
35
- const { loading, setGender, setSelectedDOB, phone, setPhone, setEmail, setReferralCode, setCountryCode, countryCode, setIsPhoneValid, existingAccounts, existingAccountModal, setExistingAccountModal, onFirstName, onLastName, handleSubmit, getLoginTypeText, appName, termsAndConditionsUrl, } = useSignUp();
39
+ const { loading, setGender, setSelectedDOB, phone, setPhone, email, setEmail, setReferralCode, setCountryCode, countryCode, linkedAccounts, registrationMethod, onRegistrationMethodChange, linkedAccountsSheet, showLinkedAccountsSheet, handleFirstNameChange, handleLastNameChange, handleEmailChange, handleMobileChange, handleSubmit, getLoginTypeText, appName, termsAndConditionsUrl } = useSignUp();
40
+ useEffect(() => {
41
+ if (!registrationMethod) {
42
+ const registrationMethodFromQuery = router.query.registrationMethod;
43
+ if (typeof registrationMethodFromQuery === 'string') {
44
+ const method = registrationMethodFromQuery.toLowerCase();
45
+ onRegistrationMethodChange(method);
46
+ }
47
+ }
48
+ ;
49
+ }, [registrationMethod]);
50
+ useEffect(() => {
51
+ if (router.query.registrationToken) {
52
+ form.reset({
53
+ firstName: getQueryParam(router.query.firstName) ?? userDetails.firstName,
54
+ lastName: getQueryParam(router.query.lastName) ?? userDetails.lastName,
55
+ });
56
+ }
57
+ }, []);
36
58
  useEffect(() => {
37
- if (values.phone) {
38
- setPhone(values.phone);
39
- setEmail(email);
59
+ if (values.phone || values.email) {
60
+ if (registrationMethod === RegistrationMethod.MOBILE) {
61
+ setEmail(values.email);
62
+ }
63
+ else {
64
+ setPhone(values.phone);
65
+ }
40
66
  }
41
- }, [values.phone]);
67
+ }, [values.phone, values.email, registrationMethod]);
42
68
  const disabledDate = (current) => {
43
69
  const currentDate = dayjs(current);
44
70
  if (!currentDate.isValid()) {
@@ -51,38 +77,36 @@ const SignUpFormComponent = ({ email, registrationMethod, userDetails, onContinu
51
77
  const handleCaptcha = (value) => {
52
78
  setIsHuman(Boolean(value));
53
79
  };
54
- const enterMobile = (text) => {
55
- const digits = String(text).replace(/\D/g, '');
56
- setPhone(digits);
57
- if (countryCode === "91") {
58
- setIsPhoneValid(/^\d{10}$/.test(digits));
59
- }
60
- else {
61
- setIsPhoneValid(digits.length > 5);
62
- }
80
+ const onGoToLogin = () => {
81
+ router.push('/login');
82
+ };
83
+ const onProceed = () => {
84
+ const params = {
85
+ firstName: values.firstName,
86
+ lastName: values.lastName,
87
+ gender: values.gender,
88
+ selectedDOB: values.dateOfBirth,
89
+ referralCode: values.referralCode,
90
+ email: email.length > 0 ? email : getQueryParam(router.query.email) || '',
91
+ phone: phone.length > 0 ? phone : getQueryParam(router.query.phone) || '',
92
+ countryCode,
93
+ };
94
+ onContinue(params);
63
95
  };
96
+ const isMobileRegistration = registrationMethod === RegistrationMethod.MOBILE;
97
+ const isDisabled = !values.firstName
98
+ || !values.lastName
99
+ || !values.gender
100
+ || !values.dateOfBirth
101
+ || (!isMobileRegistration && !values.phone)
102
+ || !termsAndConditions
103
+ || !isHuman;
64
104
  return (_jsxs(_Fragment, { children: [_jsx(ScreenLayout, { title: "Looks like you're new here!", subTitle: "Tell us more about you so we can set up your account.", buttonProps: {
65
105
  loading,
66
106
  label: 'Continue',
67
- onClick: () => {
68
- handleSubmit({
69
- onResult: () => {
70
- onContinue({
71
- firstName: values.firstName,
72
- lastName: values.lastName,
73
- gender: values.gender,
74
- selectedDOB: values.dateOfBirth,
75
- referralCode: values.referralCode,
76
- email: email,
77
- phone,
78
- countryCode,
79
- registrationMethod,
80
- });
81
- }
82
- });
83
- },
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, { label: "First Name", className: 'mt-5', rules: [
107
+ onClick: () => { handleSubmit({ onProceed }); },
108
+ isDisabled
109
+ }, onPressBack: onGoToLogin, children: _jsxs(Form, { form: form, className: "w-full", 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
110
  {
87
111
  required: true,
88
112
  message: 'Please enter your first name'
@@ -99,7 +123,7 @@ const SignUpFormComponent = ({ email, registrationMethod, userDetails, onContinu
99
123
  },
100
124
  },
101
125
  ], normalize: (value) => (value ?? '').replace(/[^a-zA-Z]/g, ''), ...form.register('firstName', {
102
- onChange: (e) => onFirstName(e.target.value)
126
+ onChange: (e) => handleFirstNameChange(e.target.value)
103
127
  }), 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
128
  {
105
129
  required: true,
@@ -117,8 +141,8 @@ const SignUpFormComponent = ({ email, registrationMethod, userDetails, onContinu
117
141
  },
118
142
  },
119
143
  ], 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: [
144
+ onChange: (e) => handleLastNameChange(e.target.value)
145
+ }), 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("img", { 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
146
  {
123
147
  required: true,
124
148
  message: 'Please select your biological sex'
@@ -128,7 +152,7 @@ const SignUpFormComponent = ({ email, registrationMethod, userDetails, onContinu
128
152
  }), children: _jsx(RadioGroup, { orientation: "horizontal", options: [
129
153
  { label: 'Male', value: 'M' },
130
154
  { label: 'Female', value: 'F' },
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: [
155
+ ] }) }) }) }), _jsxs(Row, { gutter: 18, className: "py-0 my-5", children: [_jsx(Col, { xs: 24, md: 24, lg: !isMobileRegistration ? 12 : 24, children: _jsx(Form.Item, { label: "Date of Birth", rules: [
132
156
  {
133
157
  required: true,
134
158
  message: 'Please select your date of birth'
@@ -137,38 +161,40 @@ const SignUpFormComponent = ({ email, registrationMethod, userDetails, onContinu
137
161
  onChange: (value, dateString) => setSelectedDOB(dateString ?? (value?.toISOString ? value.toISOString() : String(value)))
138
162
  }), children: _jsx(DatePicker, { required: true, size: "middle", format: "dd/MM/yyyy", placeholder: "DD/MM/YYYY",
139
163
  /* @ts-ignore */
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
- {
142
- required: true,
143
- message: 'Please enter your mobile number'
144
- }
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) => {
148
- setCountryCode(country.phoneCode);
149
- setSelectedCountry(country);
150
- setIsPhoneValid(country.phoneCode === "91"
151
- ? /^[0-9]+$/.test(phone) && phone.length >= 10
152
- : phone.length > 5);
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', {
164
+ disabledDate: disabledDate, iconPosition: "right", defaultPickerValue: dayjs('1990-01-01').toDate(), suffixIcon: _jsx(CalendarDays, { className: "-mt-2" }) }) }) }), !isMobileRegistration &&
165
+ _jsx(Col, { xs: 24, md: 24, lg: 12, children: _jsx(Form.Item, { label: "Mobile Number", className: "mb-0", rules: [
166
+ {
167
+ required: true,
168
+ message: 'Please enter your mobile number'
169
+ }
170
+ ], ...form.register("phone", {
171
+ onChange: (e) => handleMobileChange(e.target.value)
172
+ }), 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) => {
173
+ setCountryCode(country.phoneCode);
174
+ setSelectedCountry(country);
175
+ } }) }) }) }) })] }), isMobileRegistration &&
176
+ _jsx(Col, { children: _jsx(Form.Item, { label: "Enter Your Email (Optional)", className: "mt-4", ...form.register('email', {
177
+ onChange: (e) => handleEmailChange(e.target.value)
178
+ }), children: _jsx(TextInput, { value: email, placeholder: "Enter Your Email (Optional)" }) }) }), _jsx(Col, { children: _jsx(Form.Item, { name: "referralCode", label: "Referral Code (Optional)", className: "mt-6", children: _jsx(TextInput, { placeholder: "Referral code", ...form.register('referralCode', {
154
179
  onChange: (e) => setReferralCode(e.target.value)
155
180
  }) }) }) }), isProduction && (process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY
156
181
  ? _jsx(RecaptchaComponent, { onChange: handleCaptcha })
157
182
  : _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
183
  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 &&
160
- _jsx(ExistingAccountsModal, { phone: phone, countryCode: countryCode, visible: existingAccountModal, hide: () => setExistingAccountModal(false), existingAccounts: existingAccounts, getLoginTypeText: getLoginTypeText, onGoToLogin: onGoToLogin })] }));
184
+ }, 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 })] }), linkedAccountsSheet &&
185
+ _jsx(LinkedAccountsSheet, { phone: phone, countryCode: countryCode, visible: linkedAccountsSheet, hide: () => showLinkedAccountsSheet(false), linkedAccounts: linkedAccounts, getLoginTypeText: getLoginTypeText })] }));
161
186
  };
162
- const ExistingAccountsModal = ({ visible, hide, existingAccounts, countryCode, phone, getLoginTypeText, onGoToLogin }) => {
163
- return (_jsxs(ResponsiveModal, { open: visible, onClose: hide, onOpenChange: hide, title: _jsxs(_Fragment, { children: [_jsx(Typography, { type: "heading", size: "h6", children: "Mobile Number Already Linked" }), _jsxs(Typography, { type: "utility", size: "medium", color: "gray-600", className: "mt-2 mb-3", children: ["The mobile number +", countryCode, " ", String(phone).replace(/\d(?=\d{2})/g, 'X'), " is linked to the following ", existingAccounts.length === 1 ? 'account' : `${existingAccounts.length} accounts`, "."] }), _jsx("hr", {})] }), centered: true, showCloseButton: false, className: "px-0", footer: _jsxs(Flex, { direction: "column", children: [_jsx(Button, { isFullWidth: true, variant: "primary", label: "Go to Login", onClick: () => {
164
- onGoToLogin();
187
+ const LinkedAccountsSheet = ({ visible, hide, linkedAccounts, countryCode, phone, getLoginTypeText }) => {
188
+ const router = useRouter();
189
+ return (_jsxs(ResponsiveModal, { open: visible, onClose: hide, onOpenChange: hide, title: _jsxs(_Fragment, { children: [_jsx(Typography, { type: "heading", size: "h6", children: "Mobile Number Already Linked" }), _jsxs(Typography, { type: "utility", size: "medium", color: "gray-600", className: "mt-2 mb-3", children: ["The mobile number +", countryCode, " ", String(phone).replace(/\d(?=\d{2})/g, 'X'), " is linked to the following ", linkedAccounts.length === 1 ? 'account' : `${linkedAccounts.length} accounts`, "."] }), _jsx("hr", {})] }), centered: true, showCloseButton: false, className: "px-0", footer: _jsxs(Flex, { direction: "column", children: [_jsx(Button, { isFullWidth: true, variant: "primary", label: "Go to Login", onClick: () => {
190
+ router.push('/login');
165
191
  hide();
166
- }, className: "!ml-0 mb-[-4px]" }), _jsx(SupportDetails, {})] }), children: [_jsx(Typography, { type: "utility", size: "medium", children: "Please login through any of the below account or contact our support team for assistance" }), existingAccounts.map((item) => {
167
- const key = item.id ?? item.email ?? `${item.loginType}-${item.createdOn}`;
192
+ }, className: "!ml-0 mb-[-4px]" }), _jsx(SupportDetails, {})] }), children: [_jsx(Typography, { type: "utility", size: "medium", children: "Please login through any of the below account or contact our support team for assistance" }), linkedAccounts.map((item) => {
193
+ const key = item.memberId ?? item.email ?? `${item.loginType}-${item.createdOn}`;
168
194
  return (_jsxs(Flex, { direction: "column", className: "border border-gray-300 p-4 rounded-md mt-3", children: [_jsxs(Flex, { direction: "column", className: "border-b-2 pb-2", children: [_jsx(Typography, { type: "utility", size: "large", children: item.name }), _jsx(Typography, { type: "utility", size: "medium", color: "primary", children: item.email })] }), _jsxs(Flex, { justify: "between", className: "mt-3", children: [_jsx(Typography, { type: "utility", size: "medium", color: "gray-700", children: "Login Type" }), _jsx(Typography, { type: "utility", size: "medium", color: "gray-800", children: getLoginTypeText(item.loginType) })] }), _jsxs(Flex, { justify: "between", className: "mt-3", children: [_jsx(Typography, { type: "utility", size: "medium", color: "gray-700", children: "Registration Date" }), _jsx(Typography, { type: "utility", size: "medium", color: "gray-800", children: moment(item.createdOn).format('DD/MM/YYYY') })] })] }, key));
169
195
  })] }));
170
196
  };
171
197
  const RecaptchaComponent = React.memo(({ onChange }) => {
172
- return (_jsx(Row, { gutter: 10, children: _jsx(Col, { span: 24, children: _jsx(ReCAPTCHA, { className: "g-recaptcha", sitekey: process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY || '', onChange: (token) => onChange(token ?? ''), onExpired: () => onChange(''), onErrored: () => onChange(''), size: "normal" }) }) }));
198
+ return (_jsx(Row, { gutter: 10, children: _jsx(Col, { span: 24, children: _jsx(ReCAPTCHA, { className: "g-recaptcha mt-4", sitekey: process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY || '', onChange: (token) => onChange(token ?? ''), onExpired: () => onChange(''), onErrored: () => onChange(''), size: "normal" }) }) }));
173
199
  });
174
200
  export { SignUpFormComponent };
@@ -1,82 +1,51 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Flex, ResponsiveModal } from "@truworth/twc-web-design";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Flex } from "@truworth/twc-web-design";
3
3
  import { useRouter } from "next/router";
4
4
  import { useEffect, useState } from "react";
5
5
  import { AdvancedTransitionWrapper } from "../../../../components/AdvancedTransitionWrapper";
6
- import { useAuthPackageContext } from "../../../../hooks/internal/useAuthPackageContext";
7
6
  import { SignUpFormComponent } from "../SignUpForm";
8
7
  import CreatePassword from "../../../CreatePassword";
9
8
  import UserConsent from "../../../UserConsent";
10
- import VerifyMobile from "../../../VerifyMobile";
11
- import VerifyEmail from "../../../VerifyEmail";
12
9
  const SignUpWebComponent = () => {
13
10
  const router = useRouter();
14
- const [email, setEmail] = useState('');
15
11
  const [signUpStep, setSignUpStep] = useState('registration');
16
12
  const [userDetails, setUserDetails] = useState({});
17
- const [registrationParams, setRegistrationParams] = useState({});
18
- const [showVerifyMobileModal, setShowVerifyMobileModal] = useState(false);
19
- const [showVerifyEmailModal, setShowVerifyEmailModal] = useState(false);
20
- const { onRegistrationMethodChange, registrationMethod } = useAuthPackageContext();
13
+ const [registrationToken, setRegistrationToken] = useState('');
21
14
  useEffect(() => {
22
- const rawEmail = router.query.email;
23
- const rawMethod = router.query.registrationMethod;
24
- const emailFromQuery = Array.isArray(rawEmail) ? rawEmail[0] : rawEmail;
25
- const registrationMethodFromQuery = Array.isArray(rawMethod) ? rawMethod[0] : rawMethod;
26
- const isValidEmail = (val) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val);
27
- if (typeof emailFromQuery === 'string') {
28
- if (isValidEmail(emailFromQuery)) {
29
- setEmail(emailFromQuery);
30
- }
31
- else {
32
- console.warn('Ignoring invalid email in query:', emailFromQuery);
33
- }
15
+ const rawRegistrationToken = router.query.registrationToken;
16
+ if (typeof rawRegistrationToken === 'string') {
17
+ setRegistrationToken(rawRegistrationToken);
34
18
  }
35
- if (typeof registrationMethodFromQuery === 'string') {
36
- const method = registrationMethodFromQuery.toLowerCase();
37
- if (method === 'email' || method === 'mobile') {
38
- onRegistrationMethodChange(method);
39
- }
40
- }
41
- }, [router.query.email, router.query.registrationMethod, onRegistrationMethodChange]);
42
- const onGoToLogin = () => {
43
- router.push('/login');
44
- };
19
+ }, [router.query.registrationToken]);
45
20
  const renderStep = () => {
46
21
  switch (signUpStep) {
47
22
  case 'registration':
48
- return (_jsx(SignUpFormComponent, { email: email, userDetails: userDetails, registrationMethod: registrationMethod, onContinue: (userDetails) => {
49
- setUserDetails(userDetails);
23
+ return (_jsx(SignUpFormComponent, { userDetails: userDetails, onContinue: (userDetails) => {
24
+ if (registrationToken) {
25
+ setUserDetails({ ...userDetails, registrationToken });
26
+ setSignUpStep('user-consent');
27
+ return;
28
+ }
29
+ setUserDetails({ ...userDetails });
50
30
  setSignUpStep('create-password');
51
- }, onGoToLogin: onGoToLogin }));
31
+ } }));
52
32
  case 'create-password':
53
33
  return userDetails && (_jsx(CreatePassword, { userDetails: userDetails, handleBack: () => setSignUpStep('registration'), onContinue: (password, confirmPassword) => {
54
34
  setUserDetails({ ...userDetails, password, confirmPassword });
55
35
  setSignUpStep('user-consent');
56
36
  } }));
57
37
  case 'user-consent':
58
- return (_jsx(UserConsent, { routeParams: userDetails, onBackHandler: () => setSignUpStep('create-password'), onVerifyEmail: ({ email, phone, sessionToken }) => {
59
- setRegistrationParams({ email, phone, sessionToken });
60
- setShowVerifyEmailModal(true);
61
- }, onVerifyMobile: ({ phone, sessionToken }) => {
62
- setRegistrationParams({ phone, sessionToken });
63
- setShowVerifyMobileModal(true);
38
+ return (_jsx(UserConsent, { userDetails: userDetails, handleBack: () => {
39
+ if (registrationToken) {
40
+ setSignUpStep('registration');
41
+ return;
42
+ }
43
+ setSignUpStep('create-password');
64
44
  } }));
65
45
  default:
66
46
  return null;
67
47
  }
68
48
  };
69
- return (_jsxs(_Fragment, { children: [_jsx(AdvancedTransitionWrapper, { type: 'slide', duration: 0.5, children: _jsx(Flex, { direction: 'column', justify: 'center', style: { width: '70%' }, className: `lg:w-[70%] lg:h-screen mx-auto h-full my-10`, children: renderStep() }) }), showVerifyMobileModal &&
70
- _jsx(VerifyMobileModal, { visible: showVerifyMobileModal, hide: () => setShowVerifyMobileModal(false), sessionToken: registrationParams?.sessionToken || '', phone: registrationParams?.phone || '' }), showVerifyEmailModal &&
71
- _jsx(VerifyEmailModal, { email: email, visible: showVerifyEmailModal, hide: () => setShowVerifyEmailModal(false), sessionToken: registrationParams?.sessionToken || '', onVerifiedOTP: () => {
72
- setShowVerifyEmailModal(false);
73
- setShowVerifyMobileModal(true);
74
- } })] }));
49
+ return (_jsx(AdvancedTransitionWrapper, { type: 'slide', duration: 0.5, children: _jsx(Flex, { direction: 'column', justify: 'center', style: { width: '70%' }, className: `lg:w-[70%] lg:h-screen mx-auto h-full my-10`, children: renderStep() }) }));
75
50
  };
76
51
  export { SignUpWebComponent };
77
- const VerifyMobileModal = ({ visible, hide, sessionToken, phone }) => {
78
- return (_jsx(ResponsiveModal, { title: 'Verify Mobile', open: visible, onClose: hide, onOpenChange: hide, maskClosable: false, showCloseButton: false, children: _jsx(VerifyMobile, { sessionToken: sessionToken, phone: phone }) }));
79
- };
80
- const VerifyEmailModal = ({ visible, hide, sessionToken, email, onVerifiedOTP }) => {
81
- return (_jsx(ResponsiveModal, { title: 'Verify Email', open: visible, onOpenChange: hide, onClose: hide, maskClosable: false, showCloseButton: false, children: _jsx(VerifyEmail, { email: email, sessionToken: sessionToken, onVerifiedOTP: onVerifiedOTP }) }));
82
- };