Skip to content

Commit

Permalink
Merge pull request #312 from aesirxio/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
vietredweb authored Oct 3, 2024
2 parents 0557bbb + da3028b commit 522ccc8
Show file tree
Hide file tree
Showing 14 changed files with 3,900 additions and 3,688 deletions.
24 changes: 15 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aesirx-analytics",
"version": "2.2.21",
"version": "2.3.0",
"license": "GPL-3.0-only",
"author": "AesirX",
"repository": "https://gitlab.redweb.dk/aesirx/analytics",
Expand All @@ -9,27 +9,28 @@
"types": "dist/index.d.ts",
"type": "module",
"dependencies": {
"@concordium/browser-wallet-api-helpers": "^3.0.0",
"@concordium/react-components": "^0.4.0-rc.7",
"@concordium/web-sdk": "^7.0.4-rc.3",
"@concordium/browser-wallet-api-helpers": "3.0.1",
"@concordium/react-components": "0.4.0-rc.7",
"@concordium/web-sdk": "7.0.4-rc.3",
"@web3modal/ethereum": "^2.7.0",
"@web3modal/react": "^2.7.0",
"aesirx-sso": "^1.4.17",
"axios": "^1.6.0",
"aesirx-sso": "^1.4.18",
"axios": "^1.7.4",
"bootstrap": "^5.3.2",
"bowser": "^2.11.0",
"buffer": "^6.0.3",
"ethers": "^6.6.5",
"i18next": "^23.6.0",
"i18next-browser-languagedetector": "^7.2.1",
"murmurhash-js": "^1.0.0",
"next": "^14.1.1",
"next": "^14.2.10",
"query-string": "^7.1.1",
"react": "^18.3.1",
"react-bootstrap": "^2.8.0",
"react-content-loader": "^7.0.0",
"react-device-detect": "^2.2.3",
"react-dom": "18",
"react-select": "^5.8.0",
"react-toastify": "^9.1.3",
"wagmi": "^1.3.2"
},
Expand Down Expand Up @@ -87,12 +88,17 @@
"react-i18next": "^13.1.2",
"ts-jest": "^29.0.5",
"tsup": "^7.2.0",
"typescript": "^5.0.3"
"typescript": "5.1.6"
},
"files": [
"dist"
],
"resolutions": {
"postcss": "^8"
"postcss": "^8",
"ws": "8.17.1",
"@walletconnect/core": "2.9.1",
"@walletconnect/types": "2.9.1",
"@walletconnect/sign-client": "2.9.1",
"rollup": "3.26.3"
}
}
3 changes: 1 addition & 2 deletions src/Components/Consent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Button, Form } from 'react-bootstrap';
import useConsentStatus from '../Hooks/useConsentStatus';
import '../styles/style.scss';
import { TermsComponent } from './Terms';
import { ToastContainer, toast } from 'react-toastify';
import { toast } from 'react-toastify';

import yes from '../Assets/yes.svg';
import no from '../Assets/no.svg';
Expand Down Expand Up @@ -682,7 +682,6 @@ const ConsentComponentApp = (props: WalletConnectionPropsExtends) => {

return (
<div>
<ToastContainer />
<div className={`offcanvas-backdrop fade ${showBackdrop && show ? 'show' : 'd-none'}`} />
<div
tabIndex={-1}
Expand Down
90 changes: 31 additions & 59 deletions src/Components/ConsentCustom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Button, Col, Form, Row } from 'react-bootstrap';
import useConsentStatus from '../Hooks/useConsentStatus';
import '../styles/style.scss';
import { TermsComponent } from './Terms';
import { ToastContainer, toast } from 'react-toastify';
import { toast } from 'react-toastify';

import no from '../Assets/no.svg';
import bg from '../Assets/bg.png';
Expand Down Expand Up @@ -51,6 +51,7 @@ import { useAccount, useSignMessage } from 'wagmi';
import SSOEthereumProvider from './Ethereum';
import { getWeb3ID } from '../utils/Concordium';
import { trackEvent } from '../utils';
import ConsentHeader from './ConsentHeader';
declare global {
interface Window {
dataLayer: any;
Expand All @@ -69,6 +70,7 @@ const ConsentComponentCustom = ({
layout,
isOptInReplaceAnalytics,
customConsentText,
languageSwitcher,
}: any) => {
return (
<>
Expand All @@ -86,6 +88,7 @@ const ConsentComponentCustom = ({
gtmId={gtmId}
layout={layout}
customConsentText={customConsentText}
languageSwitcher={languageSwitcher}
/>
)}
</WithWalletConnector>
Expand Down Expand Up @@ -124,6 +127,7 @@ const ConsentComponentCustomWrapper = (props: any) => {
gtmId={props?.gtmId}
layout={props?.layout}
customConsentText={props?.customConsentText}
languageSwitcher={props?.languageSwitcher}
uuid={uuid}
level={level}
connection={connection}
Expand All @@ -150,6 +154,7 @@ const ConsentComponentCustomApp = (props: any) => {
gtmId,
layout,
customConsentText,
languageSwitcher,
activeConnectorType,
activeConnector,
activeConnectorError,
Expand Down Expand Up @@ -262,8 +267,7 @@ const ConsentComponentCustomApp = (props: any) => {
jwt,
'metamask',
gtagId,
gtmId,
layout
gtmId
);
sessionStorage.setItem('aesirx-analytics-uuid', uuid);
sessionStorage.setItem('aesirx-analytics-allow', '1');
Expand Down Expand Up @@ -363,8 +367,7 @@ const ConsentComponentCustomApp = (props: any) => {
jwt,
'concordium',
gtagId,
gtmId,
layout
gtmId
);
sessionStorage.setItem('aesirx-analytics-consent-type', 'concordium');
setUpgradeLayout(false);
Expand Down Expand Up @@ -402,8 +405,7 @@ const ConsentComponentCustomApp = (props: any) => {
null,
null,
gtagId,
gtmId,
layout
gtmId
);
} else if (
!!existConsent?.consent_uuid &&
Expand All @@ -421,8 +423,7 @@ const ConsentComponentCustomApp = (props: any) => {
null,
null,
gtagId,
gtmId,
layout
gtmId
);
}
});
Expand Down Expand Up @@ -492,8 +493,7 @@ const ConsentComponentCustomApp = (props: any) => {
response?.jwt,
'concordium',
gtagId,
gtmId,
layout
gtmId
);
setShow(false);
handleRevoke(true, level);
Expand Down Expand Up @@ -551,8 +551,7 @@ const ConsentComponentCustomApp = (props: any) => {
response?.jwt,
'concordium',
gtagId,
gtmId,
layout
gtmId
);
setShow(false);
handleRevoke(true, level);
Expand Down Expand Up @@ -799,7 +798,6 @@ const ConsentComponentCustomApp = (props: any) => {
.map((key) => key);
return (
<div>
<ToastContainer />
<div className={`offcanvas-backdrop fade ${showBackdrop && show ? 'show' : 'd-none'}`} />
<div
tabIndex={-1}
Expand Down Expand Up @@ -854,36 +852,7 @@ const ConsentComponentCustomApp = (props: any) => {

{showExpandRevoke && (
<>
<div
className={`d-flex rounded-top align-items-center justify-content-between p-2 p-lg-3 fw-medium flex-wrap py-2 py-lg-3 px-4 header-consent-bg`}
style={{
borderBottom: '1px solid #DEDEDE',
}}
>
<div className="text-primary text-nowrap">
{(window as any)?.aesirx_analytics_translate?.txt_tracking_data_privacy ??
t('txt_tracking_data_privacy')}
</div>
<div className="d-flex align-items-center fs-14 text-primary">
<a
href="https://shield.aesirx.io/"
rel="noreferrer"
target="_blank"
className="minimize-shield-wrapper position-relative text-decoration-none"
>
<img
className="cover-img position-absolute h-100 w-100 object-fit-cover z-1"
src={bg}
alt="Background Image"
/>
<div className="minimize-shield position-relative z-2 py-2">
<img src={privacy} alt="SoP Icon" />
{(window as any)?.aesirx_analytics_translate?.txt_shield_of_privacy ??
t('txt_shield_of_privacy')}
</div>
</a>
</div>
</div>
<ConsentHeader languageSwitcher={languageSwitcher} />
<div
className="minimize-revoke"
onClick={() => {
Expand All @@ -894,10 +863,10 @@ const ConsentComponentCustomApp = (props: any) => {
</div>
<div className="p-3 bg-white">
{paymentRevoke
? (window as any)?.aesirx_analytics_translate
?.txt_you_can_revoke_on_the_site ?? t('txt_you_can_revoke_on_the_site')
: (window as any)?.aesirx_analytics_translate?.txt_you_can_revoke ??
t('txt_you_can_revoke')}
? ((window as any)?.aesirx_analytics_translate
?.txt_you_can_revoke_on_the_site ?? t('txt_you_can_revoke_on_the_site'))
: ((window as any)?.aesirx_analytics_translate?.txt_you_can_revoke ??
t('txt_you_can_revoke'))}
</div>
<Form className="mb-0 w-100 bg-white px-3">
<Form.Check
Expand All @@ -922,18 +891,19 @@ const ConsentComponentCustomApp = (props: any) => {
type="checkbox"
label={
item === 'aesirx-analytics-optin-default'
? (window as any)?.aesirx_analytics_translate?.txt_revoke_opt_in ??
t('txt_revoke_opt_in')
? ((window as any)?.aesirx_analytics_translate?.txt_revoke_opt_in ??
t('txt_revoke_opt_in'))
: item === 'aesirx-analytics-optin-payment'
? (window as any)?.aesirx_analytics_translate
?.txt_revoke_opt_in_payment ?? t('txt_revoke_opt_in_payment')
: item === 'aesirx-analytics-optin-advisor'
? (window as any)?.aesirx_analytics_translate
?.txt_revoke_opt_in_advisor ?? t('txt_revoke_opt_in_advisor')
: (window as any)?.aesirx_analytics_translate?.txt_revoke_opt_in ??
t('txt_revoke_opt_in') +
' ' +
item?.replace('aesirx-analytics-optin-', '')
? ((window as any)?.aesirx_analytics_translate
?.txt_revoke_opt_in_payment ?? t('txt_revoke_opt_in_payment'))
: item === 'aesirx-analytics-optin-advisor'
? ((window as any)?.aesirx_analytics_translate
?.txt_revoke_opt_in_advisor ?? t('txt_revoke_opt_in_advisor'))
: ((window as any)?.aesirx_analytics_translate
?.txt_revoke_opt_in ??
t('txt_revoke_opt_in') +
' ' +
item?.replace('aesirx-analytics-optin-', ''))
}
value={item}
onChange={({ target: { value } }) => {
Expand Down Expand Up @@ -1299,6 +1269,7 @@ const ConsentComponentCustomApp = (props: any) => {
isCustom={true}
layout={layout}
isRejectedLayout={true}
languageSwitcher={languageSwitcher}
>
<Form className="mb-0 w-100">
<Form.Check
Expand Down Expand Up @@ -1382,6 +1353,7 @@ const ConsentComponentCustomApp = (props: any) => {
isCustom={true}
layout={layout}
customConsentText={customConsentText}
languageSwitcher={languageSwitcher}
>
<Form className="mb-0 w-100">
<Form.Check
Expand Down
79 changes: 79 additions & 0 deletions src/Components/ConsentHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React from 'react';
import bg from '../Assets/bg.png';
import privacy from '../Assets/privacy.svg';
import { useTranslation } from 'react-i18next';
import { useI18nextContext } from '../utils/I18nextProvider';
import Select, { StylesConfig } from 'react-select';
import i18n from 'i18next';

const ConsentHeader = ({ isRejectedLayout, languageSwitcher }: any) => {
const { t } = useTranslation();
const { listLanguages } = useI18nextContext();
const currentLanguage = listLanguages.filter(
(lang: any) => lang.value == i18n.language || i18n.language?.includes(lang.value)
);
const customStyles: StylesConfig = {
menuList: (base) => ({
...base,
maxHeight: '160px',
}),
};
return (
<div
className={`rounded-top align-items-center justify-content-between p-2 p-lg-3 fw-medium flex-wrap py-2 py-lg-3 px-lg-4 header-consent-bg ${
isRejectedLayout ? 'd-none' : 'd-flex'
}`}
style={{
borderBottom: '1px solid #DEDEDE',
}}
>
<div className="text-primary text-nowrap">
{(window as any)?.aesirx_analytics_translate?.txt_tracking_data_privacy ??
t('txt_tracking_data_privacy')}
</div>
{languageSwitcher ? (
<div className="language-switcher ms-auto me-2 d-flex align-items-center fs-14">
<Select
styles={customStyles}
components={{
IndicatorSeparator: () => null,
}}
isClearable={false}
isSearchable={false}
placeholder={t('txt_select')}
options={listLanguages}
className="shadow-none"
onChange={(data: any) => {
i18n.changeLanguage(data.value);
}}
defaultValue={
currentLanguage?.length ? currentLanguage : [{ label: 'English', value: 'en' }]
}
/>
</div>
) : (
<></>
)}
<div className="d-flex align-items-center fs-14 text-primary">
<a
href="https://shield.aesirx.io/"
rel="noreferrer"
target="_blank"
className="minimize-shield-wrapper position-relative text-decoration-none"
>
<img
className="cover-img position-absolute h-100 w-100 object-fit-cover z-1"
src={bg}
alt="Background Image"
/>
<div className="minimize-shield position-relative z-2 py-2">
<img src={privacy} alt="SoP Icon" />
{(window as any)?.aesirx_analytics_translate?.txt_shield_of_privacy ??
t('txt_shield_of_privacy')}
</div>
</a>
</div>
</div>
);
};
export default ConsentHeader;
Loading

0 comments on commit 522ccc8

Please sign in to comment.