Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/dotenv-16.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
NguyenBao10 authored Jul 19, 2024
2 parents ab8e7a5 + 2ba9d06 commit 1601d4e
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ jobs:
languages: ${{ matrix.language }}

- name: Install modules
run: npm install --legacy-peer-deps
run: yarn install

- name: Lint
run: npm run lint:check
run: yarn run lint:check

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aesirx-sso",
"version": "1.4.11",
"version": "1.4.12",
"license": "GPL-3.0-only",
"author": "AesirX",
"repository": "https://github.com/aesirxio/sso",
Expand All @@ -18,7 +18,7 @@
"@wagmi/core": "^1.3.8",
"@web3modal/ethereum": "^2.7.0",
"@web3modal/react": "^2.7.0",
"aesirx-lib": "^2.0.9",
"aesirx-lib": "^2.0.10",
"axios": "^1.6.0",
"bootstrap": "^5.3.0",
"cross-env": "^7.0.3",
Expand All @@ -40,7 +40,7 @@
"socket.io-client": "^4.7.2",
"viem": "^1.0.0",
"bowser": "^2.11.0",
"wagmi": "^1.4.13",
"wagmi": "^1.3.2",
"yup": "^1.3.2"
},
"tsup": {
Expand Down
8 changes: 6 additions & 2 deletions src/SSOButton/EmailLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ interface EmailLoginProps {
spacingClass: string;
noLabel: boolean;
forgotPasswordLink?: string;
demoUser?: string;
demoPassword?: string;
}
const EmailLogin: React.FC<EmailLoginProps> = ({
onGetData,
btnClass,
spacingClass,
noLabel,
forgotPasswordLink,
demoUser,
demoPassword,
}) => {
const handleOnData = (data: any) => {
onGetData(data);
Expand All @@ -25,8 +29,8 @@ const EmailLogin: React.FC<EmailLoginProps> = ({
value={{
handleOnData: handleOnData,
toggle: () => {},
demoUser: '',
demoPassword: '',
demoUser: demoUser ?? '',
demoPassword: demoPassword ?? '',
noCreateAccount: false,
isSignUpForm: false,
isRequireEmail: false,
Expand Down
9 changes: 8 additions & 1 deletion src/SSOButton/Providers/Concordium/sign.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,15 @@ const SignMessageConcordium = ({
const nationality: string =
accountInfo?.accountCredentials[0]?.value?.contents?.commitments?.cmmAttributes
?.nationality;
const countryOfResidence: string =
accountInfo?.accountCredentials[0]?.value?.contents?.commitments?.cmmAttributes
?.countryOfResidence;
if (!nationality) {
statement[0].attributeTag = 'countryOfResidence';
if (countryOfResidence) {
statement[0].attributeTag = 'countryOfResidence';
} else {
statement[0].attributeTag = 'idDocIssuer';
}
}
const proof = await provider.requestIdProof(account ?? '', statement, challenge);
const re = await verifyProof(challenge, proof);
Expand Down
36 changes: 30 additions & 6 deletions src/SSOButton/Providers/CreateAccount/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,16 @@ const CreateAccount = ({
isRequireEmail,
hideDefaultProduct = false,
isRequireConcordium = false,
alertButton = {
isShow: false,
handleClick: undefined,
alertWarning: undefined,
},
}: any) => {
const [sending, setSending] = useState(false);
const [captcha, setCaptcha] = useState<any>();
const [loading, setLoading] = useState('');
const { registerForm, endpoint, web3Endpoint, partnerEndpoint } = getClientApp();
const { registerForm, endpoint, web3Endpoint, partnerEndpoint, socketEndpoint } = getClientApp();
const debouncedCheckWeb3Id: any = useCallback(debounce(validateWeb3Id, 200), []);
const debouncedCheckEmail: any = useCallback(debounce(validateEmail, 200), []);
const [data, setData] = useState<any>([]);
Expand Down Expand Up @@ -428,8 +433,15 @@ const CreateAccount = ({
const nationality: string =
accountInfo?.accountCredentials[0]?.value?.contents?.commitments?.cmmAttributes
?.nationality;
const countryOfResidence: string =
accountInfo?.accountCredentials[0]?.value?.contents?.commitments?.cmmAttributes
?.countryOfResidence;
if (!nationality) {
statement[0].attributeTag = 'countryOfResidence';
if (countryOfResidence) {
statement[0].attributeTag = 'countryOfResidence';
} else {
statement[0].attributeTag = 'idDocIssuer';
}
}
const proof = await provider.requestIdProof(
walletState?.accountAddress ?? '',
Expand Down Expand Up @@ -485,13 +497,13 @@ const CreateAccount = ({
formik.values[`field${registerForm.email}_1_email`]
) {
const createSocketServer = async () => {
await axios.get(`${partnerEndpoint}/api/socket`);
await axios.get(`${socketEndpoint}/api/socket`);
};

createSocketServer();

if (!socket && partnerEndpoint) {
socket = io(partnerEndpoint, {
if (!socket && socketEndpoint) {
socket = io(socketEndpoint, {
reconnection: true,
secure: true,
rejectUnauthorized: false,
Expand Down Expand Up @@ -595,7 +607,10 @@ const CreateAccount = ({
);
})}
</Row>
<p className="fst-italic mb-3 fs-7">Disclaimer : The ID @Username is public</p>
<p className="fst-italic mb-3 fs-7">
Disclaimer: The ID @Username is public and helps anonymize and pseudonymize data to
protect your privacy.
</p>
<Form.Check className="mb-10px fs-7" type="checkbox" id="check-subsribe">
<Form.Check.Input type="checkbox" required />
<Form.Check.Label>
Expand Down Expand Up @@ -685,6 +700,14 @@ const CreateAccount = ({
>
{sending ? 'Sending' : 'Send inquiry'}
</Button>
) : alertButton?.isShow && alertButton?.handleClick ? (
<Button
onClick={alertButton?.handleClick}
variant="success"
className="fw-semibold text-white px-4 py-13px lh-sm w-100"
>
Send inquiry
</Button>
) : (
<div key={product?.sku}>
<Button
Expand Down Expand Up @@ -728,6 +751,7 @@ const CreateAccount = ({
</Button>
</div>
)}
{alertButton?.alertWarning && alertButton?.alertWarning}
</>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/SSOConfig/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import { Col, Row } from 'react-bootstrap';
import Concordium from './Concordium';
import { useUserContext, UserContextProvider } from '../SSOButton/Providers/user';
import MetaMask from './MetaMask';
import { useGlobalContext, GlobalContextProvider } from '../SSOButton/Providers/global';
import { connectWallet, removeWallet } from '../utils/index';
import DeleteModal from './DeleteModal';
Expand All @@ -13,6 +12,7 @@ import Social from './Social';
import Web3ContextProvider from '../SSOButton/Providers/web3';
import { Spinner } from '../components/Spinner';
import { notify } from '../components/Toast';
const MetaMask = React.lazy(() => import('./MetaMask'));

const SSO = () => {
return (
Expand Down
1 change: 1 addition & 0 deletions src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ declare global {
web3Endpoint: string;
dappEndpoint: string;
partnerEndpoint: string;
socketEndpoint: string;
registerUsername: string;
registerFirstname: string;
registerLastname: string;
Expand Down
7 changes: 7 additions & 0 deletions src/utils/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ const getClientApp = () => {
process.env.NEXT_PUBLIC_PARTNERS_URL ||
'https://partners.aesirx.io';

const socketEndpoint = window['socketEndpoint']
? window['socketEndpoint']
: process.env.REACT_APP_SOCKET_URL ||
process.env.NEXT_PUBLIC_SOCKET_URL ||
'https://socket.aesirx.io';

const registerForm = {
username: window['registerUsername']
? window['registerUsername']
Expand Down Expand Up @@ -178,6 +184,7 @@ const getClientApp = () => {
dappEndpoint,
registerForm,
partnerEndpoint,
socketEndpoint,
};
};

Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2860,10 +2860,10 @@ aes-js@^3.1.2:
resolved "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz#db9aabde85d5caabbfc0d4f2a4446960f627146a"
integrity sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==

aesirx-lib@^2.0.9:
version "2.0.9"
resolved "https://registry.yarnpkg.com/aesirx-lib/-/aesirx-lib-2.0.9.tgz#0c081076c36454be296659675788bbed0935c1b7"
integrity sha512-tXz2K5xDIXsjOmGl1ZrDsNMMsmdf5h7vbYFSqtr7m3Shqm9zWcsUAkn9oJjTi7cLvqqiMB2kmpx9AN72PFoIbA==
aesirx-lib@^2.0.10:
version "2.0.10"
resolved "https://registry.yarnpkg.com/aesirx-lib/-/aesirx-lib-2.0.10.tgz#5bc29baa0e55726ef81b36880c6bd40c23b319fb"
integrity sha512-wQV6prcImn2shnYV+l/T+pnQk3smsR1DJhPu5XBNj5U6trqYGxxpCzAaeB4vZGhsXE1di22VSSdpSh3kcm9nkA==
dependencies:
axios "^1.6.0"
axios-auth-refresh "^3.3.6"
Expand Down Expand Up @@ -7044,7 +7044,7 @@ viem@^1.6.0:
isows "1.0.3"
ws "8.13.0"

wagmi@^1.4.13:
wagmi@^1.3.2:
version "1.4.13"
resolved "https://registry.yarnpkg.com/wagmi/-/wagmi-1.4.13.tgz#dc8dc077c7c2195877d7e33477b0417f5d2add4f"
integrity sha512-AScVYFjqNt1wMgL99Bob7MLdhoTZ3XKiOZL5HVBdy4W1sh7QodA3gQ8IsmTuUrQ7oQaTxjiXEhwg7sWNrPBvJA==
Expand Down

0 comments on commit 1601d4e

Please sign in to comment.