@truworth/twc-auth 3.0.5 → 3.0.6

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.
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { motion } from 'framer-motion';
4
+ const LoadingAnimation = ({ height = 230, width = 250, }) => {
5
+ return (_jsxs("div", { style: {
6
+ height,
7
+ width,
8
+ display: 'flex',
9
+ alignItems: 'center',
10
+ justifyContent: 'center',
11
+ flexDirection: 'column',
12
+ gap: 16,
13
+ }, children: [_jsx(motion.div, { style: {
14
+ display: 'flex',
15
+ gap: 8,
16
+ alignItems: 'center',
17
+ justifyContent: 'center',
18
+ }, children: [0, 1, 2].map((i) => (_jsx(motion.div, { style: {
19
+ width: 12,
20
+ height: 12,
21
+ borderRadius: '50%',
22
+ backgroundColor: '#26C6DA',
23
+ }, animate: {
24
+ y: [0, -16, 0],
25
+ opacity: [0.5, 1, 0.5],
26
+ }, transition: {
27
+ duration: 0.8,
28
+ repeat: Infinity,
29
+ delay: i * 0.15,
30
+ ease: 'easeInOut',
31
+ } }, i))) }), _jsx(motion.div, { style: {
32
+ width: 120,
33
+ height: 4,
34
+ backgroundColor: '#E0E0E0',
35
+ borderRadius: 2,
36
+ overflow: 'hidden',
37
+ }, children: _jsx(motion.div, { style: {
38
+ width: '40%',
39
+ height: '100%',
40
+ backgroundColor: '#26C6DA',
41
+ borderRadius: 2,
42
+ }, animate: {
43
+ x: ['-100%', '250%'],
44
+ }, transition: {
45
+ duration: 1.2,
46
+ repeat: Infinity,
47
+ ease: 'easeInOut',
48
+ } }) })] }));
49
+ };
50
+ export { LoadingAnimation };
@@ -1,10 +1,9 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { Suspense, lazy, useEffect, useState } from 'react';
2
+ import React, { useEffect, useState } from 'react';
3
3
  import { Flex, Typography } from '@truworth/twc-web-design';
4
4
  import { usePartnerLogin } from '../../hooks/internal/usePartnerLogin';
5
5
  import { useNavigator } from '../../../../../hooks/useNavigator';
6
- import redirectAnimation from '../../../../../../assets/animation/redirect-home.json';
7
- const Lottie = lazy(() => import('react-lottie'));
6
+ import { LoadingAnimation } from '../../../../../components/LoadingAnimation';
8
7
  /**
9
8
  * PartnerLoginWebComponent
10
9
  *
@@ -64,14 +63,6 @@ const PartnerLoginWebComponent = ({ partner: partnerProp }) => {
64
63
  }, 2000);
65
64
  }
66
65
  }, [error, navigator]);
67
- return (_jsx(Flex, { justify: 'center', align: 'center', className: 'h-[100vh]', children: _jsxs("div", { className: 'text-center', children: [_jsx(Suspense, { fallback: _jsx("div", { className: "h-[230px] w-[250px]" }), children: _jsx(Lottie
68
- //@ts-ignore
69
- , {
70
- //@ts-ignore
71
- options: {
72
- animationData: redirectAnimation,
73
- loop: true,
74
- autoplay: true,
75
- }, height: 230, width: 250 }) }), error ? (_jsxs(_Fragment, { children: [_jsx(Typography, { size: 'h6', type: 'heading', color: 'error', children: error }), _jsx(Typography, { size: 'small', type: 'body', color: 'gray-400', className: 'mt-2', children: "Redirecting back..." })] })) : (_jsx(_Fragment, { children: _jsx(Typography, { size: 'h6', type: 'heading', color: 'gray-400', children: "Authenticating and Redirecting ..." }) }))] }) }));
66
+ return (_jsx(Flex, { justify: 'center', align: 'center', className: 'h-[100vh]', children: _jsxs("div", { className: 'text-center', children: [_jsx(LoadingAnimation, { height: 230, width: 250 }), error ? (_jsxs(_Fragment, { children: [_jsx(Typography, { size: 'h6', type: 'heading', color: 'error', children: error }), _jsx(Typography, { size: 'small', type: 'body', color: 'gray-400', className: 'mt-2', children: "Redirecting back..." })] })) : (_jsx(_Fragment, { children: _jsx(Typography, { size: 'h6', type: 'heading', color: 'gray-400', children: "Authenticating and Redirecting ..." }) }))] }) }));
76
67
  };
77
68
  export { PartnerLoginWebComponent };
@@ -1,26 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { Suspense, lazy, useEffect, useState, Component } from 'react';
2
+ import React, { useEffect, useState } from 'react';
3
3
  import { Flex, Typography } from '@truworth/twc-web-design';
4
4
  import { useSSOCallback } from '../../hooks/internal/useSSOCallback';
5
5
  import { useNavigator } from '../../../../../hooks/useNavigator';
6
- import redirectAnimation from '../../../../../../assets/animation/redirect-home.json';
6
+ import { LoadingAnimation } from '../../../../../components/LoadingAnimation';
7
7
  import { RegistrationMethod } from '../../../../../enums';
8
- const Lottie = lazy(() => import('react-lottie'));
9
- class LottieErrorBoundary extends Component {
10
- constructor(props) {
11
- super(props);
12
- this.state = { hasError: false };
13
- }
14
- static getDerivedStateFromError() {
15
- return { hasError: true };
16
- }
17
- componentDidCatch() { }
18
- render() {
19
- if (this.state.hasError)
20
- return this.props.fallback;
21
- return this.props.children;
22
- }
23
- }
24
8
  const SSOCallbackComponents = ({ authMethodOverride } = {}) => {
25
9
  const navigator = useNavigator();
26
10
  const [clientId, setClientId] = useState('');
@@ -73,15 +57,6 @@ const SSOCallbackComponents = ({ authMethodOverride } = {}) => {
73
57
  }, 1500);
74
58
  }
75
59
  }, [error, navigator]);
76
- const loadingFallback = _jsx("div", { className: "h-[230px] w-[250px]" });
77
- return (_jsx(Flex, { justify: 'center', align: 'center', className: 'h-[100vh]', children: _jsxs("div", { children: [_jsx(LottieErrorBoundary, { fallback: loadingFallback, children: _jsx(Suspense, { fallback: loadingFallback, children: _jsx(Lottie
78
- //@ts-ignore
79
- , {
80
- //@ts-ignore
81
- options: {
82
- animationData: redirectAnimation,
83
- loop: true,
84
- autoplay: true
85
- }, height: 230, width: 250 }) }) }), _jsx(Typography, { size: 'h6', type: 'heading', color: 'gray-400', children: "Authenticating and Redirecting ..." })] }) }));
60
+ return (_jsx(Flex, { justify: 'center', align: 'center', className: 'h-[100vh]', children: _jsxs("div", { children: [_jsx(LoadingAnimation, { height: 230, width: 250 }), _jsx(Typography, { size: 'h6', type: 'heading', color: 'gray-400', children: "Authenticating and Redirecting ..." })] }) }));
86
61
  };
87
62
  export { SSOCallbackComponents };
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import React, { Suspense, lazy } from 'react';
2
+ import React from 'react';
3
3
  import { useEffect, useState } from "react";
4
4
  import { Info } from 'lucide-react';
5
5
  import { Flex, Typography, ResponsiveModal as Modal, Button, ResponsiveModal } from '@truworth/twc-web-design';
@@ -7,10 +7,9 @@ import { useAuthPackageContext } from '../../hooks/internal/useAuthPackageContex
7
7
  import { CDN_IMAGES_URL } from '../../constants/cdn-url';
8
8
  import { useConsent } from './hooks/internal/useConsent';
9
9
  import { ScreenLayout } from "../../components/ScreenLayout";
10
+ import { LoadingAnimation } from '../../components/LoadingAnimation';
10
11
  import VerifyMobile from "../VerifyMobile";
11
12
  import VerifyEmail from "../VerifyEmail";
12
- import redirectHome from '../../../assets/animation/redirect-home.json';
13
- const Lottie = lazy(() => import('react-lottie'));
14
13
  const UserConsent = ({ userDetails, handleBack }) => {
15
14
  const { email, phone } = userDetails || {};
16
15
  const [redirectModal, setRedirectModal] = useState(false);
@@ -74,15 +73,7 @@ const RedirectToHomeModal = ({ redirectModal }) => {
74
73
  }, 2000);
75
74
  return () => clearTimeout(timer);
76
75
  }, []);
77
- return (_jsxs(Modal, { title: "", open: redirectModal, showCloseButton: false, footer: null, children: [isMounted && (_jsx(Suspense, { fallback: _jsx("div", { className: "h-[150px] w-[250px]" }), children: _jsx(Lottie
78
- /* @ts-ignore */
79
- , {
80
- /* @ts-ignore */
81
- options: {
82
- animationData: redirectHome,
83
- loop: true,
84
- autoplay: true
85
- }, height: 150, width: 250 }) })), _jsxs(Flex, { direction: 'column', style: { marginTop: isMounted ? "-30px" : "0" }, children: [_jsx(Typography, { type: 'heading', size: 'h5', className: 'text-center mb-6', color: "text-gray-800", children: "Redirecting to the website homepage" }), _jsxs(Flex, { children: [_jsx(Info, { color: 'blue' }), _jsx(Typography, { type: 'body', size: 'small', className: 'text-center mb-6', color: "text-gray-800", children: "We have not stored any information you shared during registration." })] })] })] }));
76
+ return (_jsxs(Modal, { title: "", open: redirectModal, showCloseButton: false, footer: null, children: [isMounted && (_jsx(LoadingAnimation, { height: 150, width: 250 })), _jsxs(Flex, { direction: 'column', style: { marginTop: isMounted ? "-30px" : "0" }, children: [_jsx(Typography, { type: 'heading', size: 'h5', className: 'text-center mb-6', color: "text-gray-800", children: "Redirecting to the website homepage" }), _jsxs(Flex, { children: [_jsx(Info, { color: 'blue' }), _jsx(Typography, { type: 'body', size: 'small', className: 'text-center mb-6', color: "text-gray-800", children: "We have not stored any information you shared during registration." })] })] })] }));
86
77
  };
87
78
  const VerifyMobileModal = ({ visible, hide, sessionToken, phone }) => {
88
79
  return (_jsx(ResponsiveModal, { title: 'Verify Mobile', open: visible, onClose: hide, onOpenChange: hide, maskClosable: false, showCloseButton: false, children: _jsx(VerifyMobile, { sessionToken: sessionToken, phone: phone }) }));
@@ -0,0 +1,6 @@
1
+ interface LoadingAnimationProps {
2
+ height?: number;
3
+ width?: number;
4
+ }
5
+ declare const LoadingAnimation: ({ height, width, }: LoadingAnimationProps) => import("react/jsx-runtime").JSX.Element;
6
+ export { LoadingAnimation };
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": "3.0.5",
7
+ "version": "3.0.6",
8
8
  "main": "build/src/index.js",
9
9
  "types": "build/types/index.d.ts",
10
10
  "files": [