@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,2 @@
1
+ declare const SSOCallbackComponents: () => import("react/jsx-runtime").JSX.Element;
2
+ export { SSOCallbackComponents };
@@ -0,0 +1,2 @@
1
+ declare const SSOCallbackComponents: () => null;
2
+ export { SSOCallbackComponents };
@@ -0,0 +1,11 @@
1
+ import type { useSSOCallbackProps, SignUpData } from "../../types";
2
+ /**
3
+ * @internal
4
+ * Hook for managing SSOCallback screen state and auth context integration.
5
+ * This hook is not exposed to package consumers.
6
+ */
7
+ declare const useSSOCallback: ({ clientId, code }: useSSOCallbackProps) => {
8
+ result: SignUpData | null;
9
+ error: string | null;
10
+ };
11
+ export { useSSOCallback };
@@ -0,0 +1,2 @@
1
+ declare const SSOCallback: () => null;
2
+ export default SSOCallback;
@@ -0,0 +1,4 @@
1
+ import type { AuthScreensProps } from '../../../navigator/index.native';
2
+ type ScreenProps = AuthScreensProps<'SSOCallback'>;
3
+ declare const SSOCallback: ({ navigation, route }: ScreenProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default SSOCallback;
@@ -0,0 +1,11 @@
1
+ interface SignUpData {
2
+ email: string;
3
+ firstName: string;
4
+ lastName: string;
5
+ registrationToken: string;
6
+ }
7
+ interface useSSOCallbackProps {
8
+ code?: string;
9
+ clientId: number | string;
10
+ }
11
+ export type { useSSOCallbackProps, SignUpData };
@@ -0,0 +1,18 @@
1
+ import type { Client } from "../../types";
2
+ /**
3
+ * @internal
4
+ * Hook for managing SSOSearchOrganization screen state and auth context integration.
5
+ * This hook is not exposed to package consumers.
6
+ */
7
+ declare const useSSOSearchOrganization: () => {
8
+ search: string;
9
+ clientList: Client[];
10
+ searchLoading: boolean;
11
+ noSearchResult: boolean;
12
+ selectedClient: Client | undefined;
13
+ setSearch: import("react").Dispatch<import("react").SetStateAction<string>>;
14
+ handleSelect: (client: Client) => void;
15
+ setNoSearchResult: import("react").Dispatch<import("react").SetStateAction<boolean>>;
16
+ setSelectedClient: import("react").Dispatch<import("react").SetStateAction<Client | undefined>>;
17
+ };
18
+ export { useSSOSearchOrganization };
@@ -0,0 +1,3 @@
1
+ import type { SSOSearchOrganizationProps } from "./types";
2
+ declare const SSOSearchOrganization: ({ onPressBack, onContinue }: SSOSearchOrganizationProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default SSOSearchOrganization;
@@ -0,0 +1,4 @@
1
+ import type { AuthScreensProps } from '../../../navigator/index.native';
2
+ type ScreenProps = AuthScreensProps<'SSOSearchOrganization'>;
3
+ declare const SSOSearchOrganization: ({ navigation }: ScreenProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default SSOSearchOrganization;
@@ -0,0 +1,13 @@
1
+ import type { Client } from "../../../types/types";
2
+ interface SSOSearchOrganizationProps {
3
+ onPressBack: () => void;
4
+ onContinue: (client: Client) => void;
5
+ }
6
+ type OptionWithClient = {
7
+ key: string;
8
+ value: string;
9
+ image: string;
10
+ client: Client;
11
+ label: JSX.Element;
12
+ };
13
+ export type { Client, SSOSearchOrganizationProps, OptionWithClient };
@@ -1,3 +1,3 @@
1
1
  import type { RegistrationFormComponentProps } from "./type";
2
- declare const SignUpFormComponent: ({ email, registrationMethod, userDetails, onContinue, onGoToLogin }: RegistrationFormComponentProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const SignUpFormComponent: ({ userDetails, onContinue }: RegistrationFormComponentProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export { SignUpFormComponent };
@@ -1,9 +1,6 @@
1
- import type { Country, RegistrationMethod, PersonalDetails } from "../../../../types/types";
1
+ import type { Country, PersonalDetails } from "../../../../types/types";
2
2
  interface RegistrationFormComponentProps {
3
- email: string;
4
- registrationMethod: RegistrationMethod | undefined;
5
3
  userDetails: PersonalDetails;
6
4
  onContinue: (data: PersonalDetails) => void;
7
- onGoToLogin: () => void;
8
5
  }
9
6
  export type { RegistrationFormComponentProps, Country };
@@ -6,19 +6,4 @@ interface UserDetailsProps {
6
6
  setValidDetail: (valid: boolean) => void;
7
7
  userDetails?: PersonalDetails;
8
8
  }
9
- interface VerifyMobileProps {
10
- visible: boolean;
11
- hide: () => void;
12
- sessionToken: string;
13
- phone: string;
14
- }
15
- interface VerifyEmailProps {
16
- visible: boolean;
17
- hide: () => void;
18
- sessionToken: string;
19
- email: string;
20
- onVerifiedOTP: (params: {
21
- sessionToken: string;
22
- }) => void;
23
- }
24
- export type { UserDetailsProps, VerifyMobileProps, VerifyEmailProps };
9
+ export type { UserDetailsProps };
@@ -1,8 +1,8 @@
1
+ import type { InitializeValuesParams, LinkedAccount } from "../../types";
1
2
  /**
2
- * @internal
3
- * Hook for managing SignUp screen state and auth context integration.
4
- * This hook is not exposed to package consumers.
5
- */
3
+ * @internal
4
+ * Hook for managing SignUp screen state and auth context integration.
5
+ */
6
6
  declare const useSignUp: () => {
7
7
  loading: boolean;
8
8
  firstName: string;
@@ -27,24 +27,22 @@ declare const useSignUp: () => {
27
27
  }>>;
28
28
  email: string;
29
29
  setEmail: import("react").Dispatch<import("react").SetStateAction<string>>;
30
- phoneError: boolean;
31
- setPhoneError: import("react").Dispatch<import("react").SetStateAction<boolean>>;
32
- isPhoneValid: boolean;
33
- setIsPhoneValid: import("react").Dispatch<import("react").SetStateAction<boolean>>;
34
- emailLinkedError: string;
35
- existingAccounts: any[];
36
- existingAccountModal: boolean;
37
- setExistingAccountModal: import("react").Dispatch<import("react").SetStateAction<boolean>>;
38
- onFirstName: (text: string) => void;
39
- onLastName: (text: string) => void;
40
- handleEmail: (text: string) => void;
41
- handleSubmit: ({ onResult }: {
42
- onResult: () => void;
43
- }) => void;
30
+ linkedAccounts: LinkedAccount[];
31
+ linkedAccountsSheet: boolean;
32
+ showLinkedAccountsSheet: import("react").Dispatch<import("react").SetStateAction<boolean>>;
33
+ handleFirstNameChange: (text: string) => void;
34
+ handleLastNameChange: (text: string) => void;
35
+ handleEmailChange: (emailInput: string) => void;
36
+ handleMobileChange: (mobileInput: string) => void;
37
+ handleSubmit: ({ onProceed }: {
38
+ onProceed: () => void;
39
+ }) => Promise<void>;
44
40
  getLoginTypeText: (loginType: number) => "Facebook" | "Google" | "Apple" | "Email" | "Microsoft";
45
41
  disabled: boolean;
46
42
  registrationMethod: import("../../../../types/types").RegistrationMethod;
43
+ onRegistrationMethodChange: (method: import("../../../../types/types").RegistrationMethod) => void;
47
44
  appName: string | undefined;
48
45
  termsAndConditionsUrl: string | undefined;
46
+ initializeValues: (params: InitializeValuesParams) => void;
49
47
  };
50
48
  export { useSignUp };
@@ -7,12 +7,34 @@ interface UseSignUpProps {
7
7
  }
8
8
  interface MobileInputProps {
9
9
  phone: string;
10
- setPhone: (v: string) => void;
11
10
  countryCode: string;
12
- setCountryCode: (v: string) => void;
13
- phoneError: boolean;
14
- setPhoneError: (v: boolean) => void;
15
- isValid: boolean;
16
- setIsValid: (v: boolean) => void;
11
+ onChangeCountryCode: () => void;
12
+ onChangeMobile: (v: string) => void;
13
+ onCross: () => void;
14
+ error: {
15
+ show: boolean;
16
+ message: string;
17
+ };
17
18
  }
18
- export type { UseSignUpProps, MobileInputProps };
19
+ interface InitializeValuesParams {
20
+ firstName?: string;
21
+ lastName?: string;
22
+ email?: string;
23
+ countryCode?: string;
24
+ }
25
+ interface LinkedAccount {
26
+ memberId: string;
27
+ name: string;
28
+ email: string;
29
+ loginType: number;
30
+ createdOn: string;
31
+ }
32
+ interface LinkedAccountsSheetProps {
33
+ visible: boolean;
34
+ hide: () => void;
35
+ linkedAccounts: LinkedAccount[];
36
+ countryCode: string;
37
+ phone: string;
38
+ getLoginTypeText: (loginType: number) => string;
39
+ }
40
+ export type { UseSignUpProps, MobileInputProps, InitializeValuesParams, LinkedAccount, LinkedAccountsSheetProps };
@@ -5,6 +5,6 @@ import type { onAgreeHandlerProps } from "../../types";
5
5
  */
6
6
  declare const useConsent: () => {
7
7
  loading: boolean;
8
- onAgree: ({ registrationParams, source, onResult }: onAgreeHandlerProps) => void;
8
+ onAgree: ({ userDetails, source, onResult }: onAgreeHandlerProps) => void;
9
9
  };
10
10
  export { useConsent };
@@ -1,3 +1,3 @@
1
1
  import type { UserConsentProps } from "./types";
2
- declare const UserConsent: ({ routeParams, onVerifyEmail, onVerifyMobile, onBackHandler }: UserConsentProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const UserConsent: ({ userDetails, handleBack }: UserConsentProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default UserConsent;
@@ -1,16 +1,7 @@
1
1
  import type { MemberProfile, PersonalDetails } from "../../types/types";
2
2
  interface UserConsentProps {
3
- routeParams: PersonalDetails;
4
- onVerifyEmail: ({ phone, email, sessionToken }: {
5
- phone: string;
6
- email: string;
7
- sessionToken: string;
8
- }) => void;
9
- onVerifyMobile: ({ phone, sessionToken }: {
10
- phone: string;
11
- sessionToken: string;
12
- }) => void;
13
- onBackHandler: () => void;
3
+ userDetails: PersonalDetails;
4
+ handleBack: () => void;
14
5
  }
15
6
  interface onAgreeHandlerResponse {
16
7
  token: string;
@@ -20,8 +11,23 @@ interface onAgreeHandlerResponse {
20
11
  sessionToken: string;
21
12
  }
22
13
  interface onAgreeHandlerProps {
23
- registrationParams: PersonalDetails;
14
+ userDetails: PersonalDetails;
24
15
  source: string;
25
16
  onResult: (res: onAgreeHandlerResponse) => void;
26
17
  }
27
- export type { UserConsentProps, onAgreeHandlerProps, onAgreeHandlerResponse };
18
+ interface VerifyMobileProps {
19
+ visible: boolean;
20
+ hide: () => void;
21
+ sessionToken: string;
22
+ phone: string;
23
+ }
24
+ interface VerifyEmailProps {
25
+ visible: boolean;
26
+ hide: () => void;
27
+ sessionToken: string;
28
+ email: string;
29
+ onVerifiedOTP: (params: {
30
+ sessionToken: string;
31
+ }) => void;
32
+ }
33
+ export type { UserConsentProps, onAgreeHandlerProps, onAgreeHandlerResponse, VerifyMobileProps, VerifyEmailProps };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @internal
3
+ * Hook for managing VerifyResetPasswordOTP screen state and auth context integration.
4
+ * This hook is not exposed to package consumers.
5
+ */
6
+ declare const useVerifyResetPasswordOTP: ({ email }: {
7
+ email: string;
8
+ }) => {
9
+ status: "loading" | "idle" | "valid" | "invalid";
10
+ resendOTPCounter: number;
11
+ sendOtp: () => void;
12
+ verifyOtp: ({ otp, onVerifiedOTP }: {
13
+ otp: string;
14
+ onVerifiedOTP: (data: {
15
+ sessionToken: string;
16
+ }) => void;
17
+ }) => void;
18
+ };
19
+ export { useVerifyResetPasswordOTP };
@@ -0,0 +1,7 @@
1
+ declare const VerifyResetPasswordOTP: ({ email, onVerifiedOTP }: {
2
+ email: string;
3
+ onVerifiedOTP: ({ sessionToken }: {
4
+ sessionToken: string;
5
+ }) => void;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ export default VerifyResetPasswordOTP;
@@ -0,0 +1,4 @@
1
+ import type { AuthScreensProps } from '../../navigator/index.native';
2
+ type ScreenProps = AuthScreensProps<'VerifyResetPasswordOTP'>;
3
+ declare const VerifyResetPasswordOTP: ({ navigation, route }: ScreenProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default VerifyResetPasswordOTP;
@@ -1,5 +1,6 @@
1
1
  import type { AxiosRequestConfig, AxiosResponseHeaders } from 'axios';
2
- type RegistrationMethod = 'email' | 'mobile' | null;
2
+ import { RegistrationMethod as RegistrationMethodEnum } from '../enums';
3
+ type RegistrationMethod = RegistrationMethodEnum | null;
3
4
  interface MemberProfile {
4
5
  id?: string;
5
6
  email?: string;
@@ -86,5 +87,26 @@ interface PersonalDetails {
86
87
  password?: string;
87
88
  confirmPassword?: string;
88
89
  }
90
+ interface PasswordPolicy {
91
+ minLength: number;
92
+ maxLength?: number;
93
+ numbers: boolean;
94
+ uppercase: boolean;
95
+ lowercase: boolean;
96
+ specialCharacters: boolean;
97
+ }
98
+ interface AuthSettings {
99
+ mobileLoginEnabled: boolean;
100
+ ssoEnabled: boolean;
101
+ }
102
+ interface Client {
103
+ key: string;
104
+ id: number;
105
+ name: string;
106
+ image: string;
107
+ mobileLoginEnabled: boolean;
108
+ ssoEnabled: boolean;
109
+ authSettings: AuthSettings;
110
+ }
89
111
  export type UseRequestOptions = BaseRequestOptions;
90
- export type { RegistrationParams, MemberProfile, ClientProfile, Partner, Profile, Country, RegistrationMethod, PersonalDetails };
112
+ export type { RegistrationParams, MemberProfile, ClientProfile, Partner, Profile, Country, RegistrationMethod, PersonalDetails, PasswordPolicy, Client, AuthSettings };
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.2",
7
+ "version": "1.2.4",
8
8
  "main": "build/src/index.js",
9
9
  "types": "build/types/index.d.ts",
10
10
  "files": [
@@ -27,14 +27,15 @@
27
27
  "@react-navigation/native-stack": "^6.10.0",
28
28
  "@truworth/twc-rn-common": "^1.0.15",
29
29
  "@truworth/twc-web-common": "^1.0.11",
30
- "@truworth/twc-web-design": "^1.9.0",
30
+ "@truworth/twc-web-design": "^1.10.0",
31
31
  "@twotalltotems/react-native-otp-input": "1.3.11",
32
32
  "@types/crypto-js": "^4.2.2",
33
33
  "@types/fbemitter": "^2.0.35",
34
34
  "@types/lodash": "^4.17.15",
35
35
  "@types/react": "^18.2.0",
36
- "@types/react-native": "^0.72.0",
37
36
  "@types/react-google-recaptcha": "^2.1.9",
37
+ "@types/react-native": "^0.72.0",
38
+ "@types/url-parse": "^1.4.11",
38
39
  "@ui-kitten/components": "^5.1.2",
39
40
  "antd": "^5.6.3",
40
41
  "copyfiles": "^2.4.1",
@@ -48,6 +49,7 @@
48
49
  "next": "^15.0.4",
49
50
  "react": "^18.2.0",
50
51
  "react-dom": "^18.2.0",
52
+ "react-google-recaptcha": "^3.1.0",
51
53
  "react-infinite-scroll-component": "^6.1.0",
52
54
  "react-lottie": "^1.2.3",
53
55
  "react-native": "^0.74.5",
@@ -62,11 +64,11 @@
62
64
  "react-native-safe-area-context": "^5.3.0",
63
65
  "react-native-svg": "15.8.0",
64
66
  "react-native-svg-uri": "^1.2.3",
65
- "react-google-recaptcha": "^3.1.0",
66
67
  "react-native-vector-icons": "^9.2.0",
67
68
  "react-redux": "^9.2.0",
68
69
  "sweetalert2": "^11.23.0",
69
- "typescript": "^5.0.0"
70
+ "typescript": "^5.0.0",
71
+ "url-parse": "^1.5.10"
70
72
  },
71
73
  "peerDependencies": {
72
74
  "@react-google-maps/api": ">=2.20.6",
@@ -1,26 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useEffect, useState } from "react";
3
- import { Dimensions, Platform, ScrollView, Text, TouchableOpacity, View } from "react-native";
4
- import { Layout } from "@ui-kitten/components";
5
- import { Header, Colors, CustomKeyboardAvoidingView } from "@truworth/twc-rn-common";
6
- import { ScreenLayout } from "../ScreenLayout";
7
- import { OTPStatusLabel } from "../OTPStatusLabel/index.native";
8
- import OTPInputView from "@twotalltotems/react-native-otp-input";
9
- const EmailOTPVerify = ({ status, validateOTP, resendOTP, resendOTPCounter, email }) => {
10
- const [otp, setOTP] = useState('');
11
- useEffect(() => {
12
- if (otp && otp.length === 6) {
13
- validateOTP?.(otp);
14
- }
15
- }, [otp]);
16
- return (_jsxs(Layout, { style: { flex: 1, backgroundColor: '#fff' }, children: [_jsx(Header, {}), _jsxs(CustomKeyboardAvoidingView, { behavior: Platform.OS === 'ios' ? 'padding' : undefined, keyboardVerticalOffset: Platform.OS === 'ios' ? 100 : 0, children: [_jsx(ScrollView, { showsVerticalScrollIndicator: false, children: _jsxs(ScreenLayout, { hideHeader: true, title: _jsxs(_Fragment, { children: ["OTP sent to ", '\n', _jsx(Text, { style: { fontSize: 20 }, children: email })] }), children: [_jsx(View, { style: { justifyContent: 'center', flexDirection: 'row', marginBottom: 30, position: 'relative' }, children: _jsx(OTPInputView, { pinCount: 6, autoFocusOnLoad: false, codeInputFieldStyle: {
17
- fontSize: 20, color: 'black',
18
- height: 45, width: 30,
19
- borderWidth: 0, borderBottomWidth: 1,
20
- }, codeInputHighlightStyle: { borderColor: '#03DAC6' }, style: {
21
- height: 50,
22
- width: Dimensions.get('window').width - 100,
23
- }, onCodeFilled: code => setOTP(code) }) }), resendOTPCounter < 3 &&
24
- _jsxs(View, { style: { flexDirection: 'row', alignItems: 'center' }, children: [_jsxs(Text, { style: { fontSize: 14, fontWeight: '500', color: Colors.gray.gray_400, lineHeight: 20 }, children: ["Did not receive OTP?", ' '] }), _jsx(TouchableOpacity, { activeOpacity: 0.8, onPress: resendOTP, children: _jsx(Text, { style: { fontSize: 14, fontWeight: '500', color: '#2cbaa4', lineHeight: 20 }, children: "Re-send OTP" }) })] })] }) }), _jsx(View, { style: { alignSelf: 'flex-end', width: '100%' }, children: _jsx(OTPStatusLabel, { status: status }) })] })] }));
25
- };
26
- export { EmailOTPVerify };
@@ -1,3 +0,0 @@
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 };
@@ -1,3 +0,0 @@
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 };
@@ -1,3 +0,0 @@
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 };
@@ -1,3 +0,0 @@
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 };