diff --git a/package.json b/package.json index 7048869..6494c8c 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "query-string": "^7.1.1", "react": "^18.2.0", "react-bootstrap": "^2.8.0", - "react-content-loader": "^6.2.1", + "react-content-loader": "^7.0.0", "react-device-detect": "^2.2.3", "react-dom": "18", "react-toastify": "^9.1.3", diff --git a/src/AnalyticsNext/index.tsx b/src/AnalyticsNext/index.tsx index 7ff1516..acf7d3a 100644 --- a/src/AnalyticsNext/index.tsx +++ b/src/AnalyticsNext/index.tsx @@ -11,11 +11,20 @@ const ConsentComponentCustom = dynamic(() => import('../Components/ConsentCustom interface AnalyticsNext { router: NextRouter; attributes: any; - customLayout?: boolean; + oldLayout?: boolean; + loginApp?: any; + isLoggedApp?: boolean; children?: ReactNode; } -const AnalyticsNext = ({ router, attributes, customLayout = false, children }: AnalyticsNext) => { +const AnalyticsNext = ({ + router, + attributes, + oldLayout = false, + loginApp, + isLoggedApp, + children, +}: AnalyticsNext) => { return ( <> @@ -23,17 +32,21 @@ const AnalyticsNext = ({ router, attributes, customLayout = false, children }: A {children} {process.env.NEXT_PUBLIC_DISABLE_ANALYTICS_CONSENT !== 'true' && ( <> - {customLayout ? ( - ) : ( - )} diff --git a/src/AnalyticsReact/index.tsx b/src/AnalyticsReact/index.tsx index bee4e34..c96663c 100644 --- a/src/AnalyticsReact/index.tsx +++ b/src/AnalyticsReact/index.tsx @@ -4,25 +4,35 @@ import AnalyticsContextProvider from '../utils/AnalyticsContextProvider'; import AnalyticsHandle from './handle'; const ConsentComponent = React.lazy(() => import('../Components/Consent')); +const ConsentComponentCustom = React.lazy(() => import('../Components/ConsentCustom')); interface AnalyticsReact { location: { search: string; pathname: string }; history: { replace: (_: object) => void }; children?: ReactNode; + oldLayout?: boolean; } -const AnalyticsReact = ({ location, history, children }: AnalyticsReact) => { +const AnalyticsReact = ({ location, history, oldLayout = false, children }: AnalyticsReact) => { return ( {children} {process.env.REACT_APP_DISABLE_ANALYTICS_CONSENT !== 'true' && ( }> - + {oldLayout ? ( + + ) : ( + + )} )} diff --git a/src/Components/Consent.tsx b/src/Components/Consent.tsx index cdc2770..2f0bb35 100644 --- a/src/Components/Consent.tsx +++ b/src/Components/Consent.tsx @@ -48,14 +48,22 @@ interface WalletConnectionPropsExtends extends WalletConnectionProps { endpoint: string; aesirXEndpoint: string; networkEnv?: string; + loginApp?: any; + isLoggedApp?: boolean; } -const ConsentComponent = ({ endpoint, aesirXEndpoint, networkEnv }: any) => { +const ConsentComponent = ({ endpoint, aesirXEndpoint, networkEnv, loginApp, isLoggedApp }: any) => { return ( {(props) => (
- +
)} @@ -66,6 +74,8 @@ const ConsentComponentApp = (props: WalletConnectionPropsExtends) => { const { endpoint, aesirXEndpoint, + loginApp, + isLoggedApp, activeConnectorType, activeConnector, activeConnectorError, @@ -227,6 +237,7 @@ const ConsentComponentApp = (props: WalletConnectionPropsExtends) => { ); sessionStorage.setItem('aesirx-analytics-jwt', data?.jwt); jwt = data?.jwt; + loginApp && !isLoggedApp && loginApp(data); setLoadingCheckAccount(false); } } else { @@ -398,6 +409,7 @@ const ConsentComponentApp = (props: WalletConnectionPropsExtends) => { setLoading('done'); } } + loginApp && !isLoggedApp && loginApp(response); } catch (error) { console.log(error); setShow(false); diff --git a/src/Components/ConsentCustom.tsx b/src/Components/ConsentCustom.tsx index f3de5d9..438d2ee 100644 --- a/src/Components/ConsentCustom.tsx +++ b/src/Components/ConsentCustom.tsx @@ -50,8 +50,16 @@ interface WalletConnectionPropsExtends extends WalletConnectionProps { endpoint: string; aesirXEndpoint: string; networkEnv?: string; + loginApp?: any; + isLoggedApp: boolean; } -const ConsentComponentCustom = ({ endpoint, aesirXEndpoint, networkEnv }: any) => { +const ConsentComponentCustom = ({ + endpoint, + aesirXEndpoint, + networkEnv, + loginApp, + isLoggedApp, +}: any) => { return ( {(props) => ( @@ -61,6 +69,8 @@ const ConsentComponentCustom = ({ endpoint, aesirXEndpoint, networkEnv }: any) = {...props} endpoint={endpoint} aesirXEndpoint={aesirXEndpoint} + loginApp={loginApp} + isLoggedApp={isLoggedApp} /> @@ -72,6 +82,8 @@ const ConsentComponentCustomApp = (props: WalletConnectionPropsExtends) => { const { endpoint, aesirXEndpoint, + loginApp, + isLoggedApp, activeConnectorType, activeConnector, activeConnectorError, @@ -236,6 +248,7 @@ const ConsentComponentCustomApp = (props: WalletConnectionPropsExtends) => { ); sessionStorage.setItem('aesirx-analytics-jwt', data?.jwt); jwt = data?.jwt; + loginApp && !isLoggedApp && loginApp(data); setLoadingCheckAccount(false); } } else { @@ -407,6 +420,7 @@ const ConsentComponentCustomApp = (props: WalletConnectionPropsExtends) => { setLoading('done'); } } + loginApp && !isLoggedApp && loginApp(response); } catch (error) { console.log(error); setShow(false); @@ -741,6 +755,7 @@ const ConsentComponentCustomApp = (props: WalletConnectionPropsExtends) => { />
{ setShowExpandConsent(true); sessionStorage.removeItem('aesirx-analytics-rejected'); @@ -760,7 +775,7 @@ const ConsentComponentCustomApp = (props: WalletConnectionPropsExtends) => {
{loading === 'done' ? ( <> -

{t('txt_upgrade_consent_text')}

+

{t('txt_upgrade_consent_text')}

{t('txt_your_current_level')}

{ onClick={() => { setUpgradeLayout(true); }} - className="d-flex align-items-center justify-content-center fs-14 w-100 me-3 mb-2 mb-lg-0 rounded-pill py-3 text-dark" + className="d-flex align-items-center justify-content-center fs-14 w-100 me-3 mb-2 mb-lg-0 rounded-pill py-2 py-lg-3 text-dark" > {t('txt_change_consent')} {' '} @@ -908,7 +923,7 @@ const ConsentComponentCustomApp = (props: WalletConnectionPropsExtends) => { }`} > @@ -926,7 +941,7 @@ const ConsentComponentCustomApp = (props: WalletConnectionPropsExtends) => {