diff --git a/cypress/e2e/pages/load_safe.pages.js b/cypress/e2e/pages/load_safe.pages.js index 62b9627fe6..5b51424b9c 100644 --- a/cypress/e2e/pages/load_safe.pages.js +++ b/cypress/e2e/pages/load_safe.pages.js @@ -11,7 +11,6 @@ const addressInput = 'input[name="address"]' const sideBarIcon = '[data-testid="ChevronRightIcon"]' const sidebarCheckIcon = '[data-testid="CheckIcon"]' const addressStepNextBtn = '[data-testid="load-safe-next-btn"]' -const qrCodeBtn = '[data-testid="address-qr-scan"]' const typeFile = '[type="file"]' const nextBtnStr = 'Next' const addBtnStr = 'Add' @@ -65,12 +64,6 @@ export function verifyNameLengthErrorMessage() { cy.get(nameInput).parent().prev('label').contains(invalidAddressNameLengthErrorMsg) } -export function scanQRCode(image) { - cy.get(qrCodeBtn).click() - cy.contains('Upload an image').click() - cy.get(typeFile).attachFile(image) -} - export function inputAddress(address) { cy.get(addressInput).clear().type(address) } diff --git a/cypress/e2e/smoke/load_safe.cy.js b/cypress/e2e/smoke/load_safe.cy.js index d71fb615f2..5dc451d870 100644 --- a/cypress/e2e/smoke/load_safe.cy.js +++ b/cypress/e2e/smoke/load_safe.cy.js @@ -49,18 +49,6 @@ describe('[SMOKE] Load Safe tests', () => { safe.clickOnNextBtn() }) - it('[SMOKE] Verify a valid QR code is accepted', () => { - safe.scanQRCode(constants.VALID_QR_CODE_PATH) - safe.verifyAddressInputValue(constants.SEPOLIA_TEST_SAFE_6) - safe.verifyNextButtonStatus('be.enabled') - safe.clickOnNextBtn() - }) - - it('[SMOKE] Verify a non QR code is not accepted', () => { - safe.scanQRCode(constants.INVALID_QR_CODE_PATH) - safe.verifyQRCodeErrorMsg() - }) - it('[SMOKE] Verify the custom Safe name is successfully loaded', () => { safe.inputNameAndAddress(testSafeName, constants.SEPOLIA_TEST_SAFE_2) safe.clickOnNextBtn() diff --git a/cypress/e2e/smoke/spending_limits.cy.js b/cypress/e2e/smoke/spending_limits.cy.js index e471bdc9c3..0ea8711770 100644 --- a/cypress/e2e/smoke/spending_limits.cy.js +++ b/cypress/e2e/smoke/spending_limits.cy.js @@ -24,11 +24,6 @@ describe('[SMOKE] Spending limits tests', () => { spendinglimit.verifyValidAddressShowsNoErrors() }) - it('Verify Fill by QR code with a valid address', () => { - safe.scanQRCode(constants.VALID_QR_CODE_PATH) - spendinglimit.checkBeneficiaryENS(constants.SEPOLIA_TEST_SAFE_6) - }) - it('Verify Amount input cannot be 0', () => { spendinglimit.enterSpendingLimitAmount('0') spendinglimit.verifyNumberErrorValidation() diff --git a/package.json b/package.json index 862dee9c87..ebf7ec6d85 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,6 @@ "react-gtm-module": "^2.0.11", "react-hook-form": "7.41.1", "react-papaparse": "^4.0.2", - "react-qr-reader": "2.2.1", "react-redux": "^8.0.5", "semver": "^7.5.2" }, @@ -114,7 +113,6 @@ "@types/react": "18.2.28", "@types/react-dom": "18.2.13", "@types/react-gtm-module": "^2.0.1", - "@types/react-qr-reader": "^2.1.5", "@types/semver": "^7.3.10", "@typescript-eslint/eslint-plugin": "^5.47.1", "@walletconnect/types": "^2.11.0", diff --git a/src/components/common/AddressInput/index.tsx b/src/components/common/AddressInput/index.tsx index 99e77dc25b..d4789d5976 100644 --- a/src/components/common/AddressInput/index.tsx +++ b/src/components/common/AddressInput/index.tsx @@ -13,7 +13,6 @@ import { useFormContext, useWatch, type Validate, get } from 'react-hook-form' import { validatePrefixedAddress } from '@/utils/validation' import { useCurrentChain } from '@/hooks/useChains' import useNameResolver from './useNameResolver' -import ScanQRButton from '../ScanQRModal/ScanQRButton' import { FEATURES, hasFeature } from '@/utils/chains' import { cleanInputValue, parsePrefixedAddress } from '@/utils/addresses' import useDebounce from '@/hooks/useDebounce' @@ -97,8 +96,6 @@ const AddressInput = ({ )} - - {onOpenListClick && ( import('.')) - -type Props = { - onScan: (value: string) => void -} - -const ScanQRButton = ({ onScan }: Props): ReactElement => { - const [open, setOpen] = useState(false) - - const openQrModal = () => { - setOpen(true) - trackEvent(MODALS_EVENTS.SCAN_QR) - } - - const closeQrModal = () => { - setOpen(false) - } - - const onScanFinished = (value: string) => { - onScan(value) - closeQrModal() - trackEvent(MODALS_EVENTS.SCAN_QR_FINISHED) - } - - return ( - <> - - - - - {open && ( - - - - )} - - ) -} - -export default ScanQRButton diff --git a/src/components/common/ScanQRModal/index.tsx b/src/components/common/ScanQRModal/index.tsx deleted file mode 100644 index e2b766d772..0000000000 --- a/src/components/common/ScanQRModal/index.tsx +++ /dev/null @@ -1,101 +0,0 @@ -import { useState, useRef, useEffect } from 'react' -import { Box, Dialog, DialogTitle, IconButton, Button, Divider } from '@mui/material' -import QrReader from 'react-qr-reader' -import CloseIcon from '@mui/icons-material/Close' -import Typography from '@mui/material/Typography' -import ErrorMessage from '@/components/tx/ErrorMessage' - -type Props = { - isOpen: boolean - onClose: () => void - onScan: (value: string) => void -} - -const ScanQRModal = ({ isOpen, onClose, onScan }: Props): React.ReactElement => { - const [fileUploadModalOpen, setFileUploadModalOpen] = useState(false) - const [error, setError] = useState('') - const [cameraBlocked, setCameraBlocked] = useState(false) - const scannerRef = useRef(null) - - useEffect(() => { - if (!fileUploadModalOpen && cameraBlocked && !error) { - setFileUploadModalOpen(true) - scannerRef.current?.openImageDialog() - } - }, [cameraBlocked, fileUploadModalOpen, error]) - - const onFileScannedError = (error: Error) => { - if (error.name === 'NotAllowedError' || error.name === 'PermissionDismissedError') { - setCameraBlocked(true) - setFileUploadModalOpen(false) - } else { - setError('The QR could not be read') - } - } - - const onFileScannedResolve = (successData: string | null) => { - if (!successData) { - setError('The QR could not be read') - return - } - - setError('') - onScan(successData) - } - - return ( - - - Scan QR - {onClose ? ( - - - - ) : null} - - - - - - {error && {error}} - - - - - - - - - - - - ) -} - -export default ScanQRModal diff --git a/src/services/analytics/events/modals.ts b/src/services/analytics/events/modals.ts index 0cd92994e5..7798487023 100644 --- a/src/services/analytics/events/modals.ts +++ b/src/services/analytics/events/modals.ts @@ -15,14 +15,6 @@ export const MODALS_EVENTS = { action: 'Contract interaction', category: MODALS_CATEGORY, }, - SCAN_QR: { - action: 'Scan QR', - category: MODALS_CATEGORY, - }, - SCAN_QR_FINISHED: { - action: 'Scan QR finished', - category: MODALS_CATEGORY, - }, TX_DETAILS: { action: 'Transaction details', category: MODALS_CATEGORY, diff --git a/yarn.lock b/yarn.lock index 92ad7fb689..a1e452314b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5447,13 +5447,6 @@ resolved "https://registry.yarnpkg.com/@types/react-gtm-module/-/react-gtm-module-2.0.1.tgz#b2c6cd14ec251d6ae7fa576edf1d43825908a378" integrity sha512-T/DN9gAbCYk5wJ1nxf4pSwmXz4d1iVjM++OoG+mwMfz9STMAotGjSb65gJHOS5bPvl6vLSsJnuC+y/43OQrltg== -"@types/react-qr-reader@^2.1.5": - version "2.1.5" - resolved "https://registry.yarnpkg.com/@types/react-qr-reader/-/react-qr-reader-2.1.5.tgz#933351729b01f61ab7700fec3ed3f78737ed08a1" - integrity sha512-a21g42lQkBKr87zS0idEkTsnVB/UObQol9RcB7YTkLokz3bwwDVJqnXaOliITIAfZtQAYpsPAj08Mb9G2U8K4A== - dependencies: - "@types/react" "*" - "@types/react-transition-group@^4.4.10", "@types/react-transition-group@^4.4.5": version "4.4.10" resolved "https://registry.yarnpkg.com/@types/react-transition-group/-/react-transition-group-4.4.10.tgz#6ee71127bdab1f18f11ad8fb3322c6da27c327ac" @@ -5697,7 +5690,7 @@ events "^3.3.0" isomorphic-unfetch "^3.1.0" -"@walletconnect/core@2.11.0", "@walletconnect/core@^2.10.1", "@walletconnect/core@^2.11.0": +"@walletconnect/core@2.11.0", "@walletconnect/core@^2.10.1": version "2.11.0" resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-2.11.0.tgz#3a4e301077b2f858fd916b7a20b5b984d1afce63" integrity sha512-2Tjp5BCevI7dbmqo/OrCjX4tqgMqwJNQLlQAlphqPfvwlF9+tIu6pGcVbSN3U9zyXzWIZCeleqEaWUeSeET4Ew== @@ -13562,7 +13555,7 @@ react-papaparse@^4.0.2: "@types/papaparse" "^5.3.9" papaparse "^5.4.1" -react-qr-reader@2.2.1, react-qr-reader@^2.2.1: +react-qr-reader@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/react-qr-reader/-/react-qr-reader-2.2.1.tgz#dc89046d1c1a1da837a683dd970de5926817d55b" integrity sha512-EL5JEj53u2yAOgtpAKAVBzD/SiKWn0Bl7AZy6ZrSf1lub7xHwtaXe6XSx36Wbhl1VMGmvmrwYMRwO1aSCT2fwA==