diff --git a/package-lock.json b/package-lock.json index 84aa2822..e02b5ad3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,9 +26,8 @@ "apollo-link-error": "^1.1.13", "apollo-link-http": "^1.5.17", "apollo-link-serialize": "^2.1.0", - "cross-fetch": "^3.1.5", + "cross-fetch": "4.0.0", "date-fns": "^2.29.3", - "detect-browser": "^5.3.0", "easymde": "^2.18.0", "file-saver": "^2.0.5", "framer-motion": "^6.5.1", @@ -72,7 +71,6 @@ "@graphql-codegen/typescript-react-apollo": "^3.3.7", "@sentry/types": "^7.44.0", "@types/file-saver": "^2.0.5", - "@types/isomorphic-fetch": "0.0.36", "@types/jest": "^29.5.13", "@types/mixpanel-browser": "^2.38.0", "@types/reach__router": "^1.3.10", @@ -271,26 +269,6 @@ "node": ">=14" } }, - "node_modules/@ardatan/sync-fetch/node_modules/node-fetch": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", - "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", - "dev": true, - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/@babel/code-frame": { "version": "7.22.13", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", @@ -2863,26 +2841,6 @@ "web-streams-polyfill": "^3.2.0" } }, - "node_modules/@graphql-tools/apollo-engine-loader/node_modules/node-fetch": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", - "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", - "dev": true, - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/@graphql-tools/apollo-engine-loader/node_modules/tslib": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", @@ -3302,26 +3260,6 @@ "web-streams-polyfill": "^3.2.0" } }, - "node_modules/@graphql-tools/github-loader/node_modules/node-fetch": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", - "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", - "dev": true, - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/@graphql-tools/github-loader/node_modules/tslib": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", @@ -5597,12 +5535,6 @@ "@types/node": "*" } }, - "node_modules/@types/isomorphic-fetch": { - "version": "0.0.36", - "resolved": "https://registry.npmjs.org/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.36.tgz", - "integrity": "sha512-ulw4d+vW1HKn4oErSmNN2HYEcHGq0N1C5exlrMM0CRqX1UUpFhGb5lwiom5j9KN3LBJJDLRmYIZz1ghm7FIzZw==", - "dev": true - }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", @@ -6329,26 +6261,6 @@ "web-streams-polyfill": "^3.2.0" } }, - "node_modules/@whatwg-node/fetch/node_modules/node-fetch": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", - "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", - "dev": true, - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/@whatwg-node/node-fetch": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/@whatwg-node/node-fetch/-/node-fetch-0.3.6.tgz", @@ -8212,30 +8124,11 @@ "dev": true }, "node_modules/cross-fetch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", - "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", - "dependencies": { - "node-fetch": "2.6.7" - } - }, - "node_modules/cross-fetch/node_modules/node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } + "node-fetch": "^2.6.12" } }, "node_modules/cross-spawn": { @@ -8550,11 +8443,6 @@ "npm": "1.2.8000 || >= 1.4.16" } }, - "node_modules/detect-browser": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/detect-browser/-/detect-browser-5.3.0.tgz", - "integrity": "sha512-53rsFbGdwMwlF7qvCt0ypLM5V5/Mbl0szB7GPN8y9NCcbknYOeVVXdrXEq+90IwAfrrzt6Hd+u2E2ntakICU8w==" - }, "node_modules/detect-indent": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.0.0.tgz", @@ -9926,6 +9814,15 @@ "integrity": "sha512-b2XGFAFdWZWg0phtAWLHCk836A1Xann+I+Dgd3Gk64MHKZO44FfoD1KxyvbSh0qZsIoXQGGlVztIY+oitJPpRQ==", "dev": true }, + "node_modules/fbjs/node_modules/cross-fetch": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", + "integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==", + "dev": true, + "dependencies": { + "node-fetch": "^2.6.12" + } + }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -10485,6 +10382,15 @@ "graphql": "14 - 16" } }, + "node_modules/graphql-request/node_modules/cross-fetch": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", + "integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==", + "dev": true, + "dependencies": { + "node-fetch": "^2.6.12" + } + }, "node_modules/graphql-tag": { "version": "2.12.6", "resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.12.6.tgz", @@ -14212,6 +14118,25 @@ "node": ">=10.5.0" } }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/node-forge": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", @@ -18465,17 +18390,6 @@ "dev": true, "requires": { "node-fetch": "^2.6.1" - }, - "dependencies": { - "node-fetch": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", - "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", - "dev": true, - "requires": { - "whatwg-url": "^5.0.0" - } - } } }, "@babel/code-frame": { @@ -20400,15 +20314,6 @@ "web-streams-polyfill": "^3.2.0" } }, - "node-fetch": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", - "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", - "dev": true, - "requires": { - "whatwg-url": "^5.0.0" - } - }, "tslib": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", @@ -20771,15 +20676,6 @@ "web-streams-polyfill": "^3.2.0" } }, - "node-fetch": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", - "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", - "dev": true, - "requires": { - "whatwg-url": "^5.0.0" - } - }, "tslib": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", @@ -22676,12 +22572,6 @@ "@types/node": "*" } }, - "@types/isomorphic-fetch": { - "version": "0.0.36", - "resolved": "https://registry.npmjs.org/@types/isomorphic-fetch/-/isomorphic-fetch-0.0.36.tgz", - "integrity": "sha512-ulw4d+vW1HKn4oErSmNN2HYEcHGq0N1C5exlrMM0CRqX1UUpFhGb5lwiom5j9KN3LBJJDLRmYIZz1ghm7FIzZw==", - "dev": true - }, "@types/istanbul-lib-coverage": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", @@ -23287,17 +23177,6 @@ "node-fetch": "^2.6.7", "undici": "^5.8.0", "web-streams-polyfill": "^3.2.0" - }, - "dependencies": { - "node-fetch": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", - "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", - "dev": true, - "requires": { - "whatwg-url": "^5.0.0" - } - } } }, "@whatwg-node/node-fetch": { @@ -24790,21 +24669,11 @@ "dev": true }, "cross-fetch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", - "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", "requires": { - "node-fetch": "2.6.7" - }, - "dependencies": { - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "requires": { - "whatwg-url": "^5.0.0" - } - } + "node-fetch": "^2.6.12" } }, "cross-spawn": { @@ -25031,11 +24900,6 @@ "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", "dev": true }, - "detect-browser": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/detect-browser/-/detect-browser-5.3.0.tgz", - "integrity": "sha512-53rsFbGdwMwlF7qvCt0ypLM5V5/Mbl0szB7GPN8y9NCcbknYOeVVXdrXEq+90IwAfrrzt6Hd+u2E2ntakICU8w==" - }, "detect-indent": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.0.0.tgz", @@ -26086,6 +25950,17 @@ "promise": "^7.1.1", "setimmediate": "^1.0.5", "ua-parser-js": "^0.7.30" + }, + "dependencies": { + "cross-fetch": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", + "integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==", + "dev": true, + "requires": { + "node-fetch": "^2.6.12" + } + } } }, "fbjs-css-vars": { @@ -26512,6 +26387,17 @@ "requires": { "@graphql-typed-document-node/core": "^3.2.0", "cross-fetch": "^3.1.5" + }, + "dependencies": { + "cross-fetch": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", + "integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==", + "dev": true, + "requires": { + "node-fetch": "^2.6.12" + } + } } }, "graphql-tag": { @@ -29250,6 +29136,14 @@ "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", "dev": true }, + "node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, "node-forge": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", diff --git a/package.json b/package.json index 3b82e656..8d352b85 100644 --- a/package.json +++ b/package.json @@ -38,9 +38,8 @@ "apollo-link-error": "^1.1.13", "apollo-link-http": "^1.5.17", "apollo-link-serialize": "^2.1.0", - "cross-fetch": "^3.1.5", + "cross-fetch": "4.0.0", "date-fns": "^2.29.3", - "detect-browser": "^5.3.0", "easymde": "^2.18.0", "file-saver": "^2.0.5", "framer-motion": "^6.5.1", @@ -84,7 +83,6 @@ "@graphql-codegen/typescript-react-apollo": "^3.3.7", "@sentry/types": "^7.44.0", "@types/file-saver": "^2.0.5", - "@types/isomorphic-fetch": "0.0.36", "@types/jest": "^29.5.13", "@types/mixpanel-browser": "^2.38.0", "@types/reach__router": "^1.3.10", diff --git a/src/api/apollo/client.ts b/src/api/apollo/client.ts index 2e960a32..d26a8c71 100644 --- a/src/api/apollo/client.ts +++ b/src/api/apollo/client.ts @@ -13,7 +13,6 @@ import * as Sentry from '@sentry/react'; import { GraphQLError, GraphQLErrorExtensions } from 'graphql'; const PLAYGROUND_API = process.env.PLAYGROUND_API; const DEFAULT_DEBOUNCE_TIMEOUT = 1200; // Debounce time in ms -const { detect } = require('detect-browser'); const cache = new InMemoryCache(); const client = new ApolloClient({ cache: cache, @@ -34,15 +33,10 @@ const client = new ApolloClient({ extensions = { code: 'NETWORK_ERROR' }; } const errorCode = extensions?.code; - const browser = detect(); switch (errorCode) { case 'BAD_REQUEST': console.log('Encountered User Error', gqlError); Sentry.captureException(gqlError); - if (browser && browser.name === 'safari') { - errorMessage = - 'Safari does not support cookies. Please use Chrome or Firefox.'; - } break; case 'GRAPHQL_VALIDATION_FAILED': console.log('Encountered GQL Error', gqlError); diff --git a/src/components/Editor/index.tsx b/src/components/Editor/index.tsx index 54545d7c..6ac8c1a9 100644 --- a/src/components/Editor/index.tsx +++ b/src/components/Editor/index.tsx @@ -1,16 +1,12 @@ import { Project } from 'api/apollo/generated/graphql'; import CookieDetector from 'components/BrowserDetector'; import FileExplorer from 'components/Editor/FileExplorer'; -import UnsupportedMessage from 'components/UnsupportedBrowser'; import { EditorContainer } from 'containers/Playground/components'; import { ActiveEditor } from 'providers/Project'; import React from 'react'; import ErrorToastContainer from './ErrorToastContainer'; import Header from 'components/TopNav/Header'; -const { detect } = require('detect-browser'); -const browser = detect(); - type EditorContainerProps = { isExplorerCollapsed: boolean; toggleExplorer: () => void; @@ -28,11 +24,7 @@ const Editor = ({ }: EditorContainerProps) => { return ( <> - {browser && browser.name === 'safari' ? ( - - ) : ( -
- )} +
{ - const context = useThemeUI(); - const { theme } = context; - - const styles: SXStyles = { - root: { - background: 'white', - display: 'flex', - gridArea: 'header', - flex: '1 1 auto', - flexWrap: 'wrap', - alignItems: 'center', - justifyContent: 'space-between', - paddingLeft: '1em', - paddingRight: '1em', - }, - message: { - display: 'flex', - justifyContent: 'center', - alignItems: 'center', - textAlign: 'center', - padding: '0.25rem', - margin: '0.05rem', - color: theme.colors.text, - borderRadius: '8px', - border: `1px solid ${theme.colors.errors}`, - background: theme.colors.errorBackground, - fontSize: theme.fontSizes[3], - fontWeight: `700`, - }, - }; - - return ( - - - This is an unsupported browser. We hope to support your browser in the - future. In order to have the best experience, we recommend you use - either Chrome or Firefox to access the Flow Playground. - - - ); -}; - -export default UnsupportedMessage;