diff --git a/README.md b/README.md index f432abe68..e23e6f8d7 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Discord - Demo + Demo
@@ -33,7 +33,7 @@ ## Features -- **Next.js 13**: File-based routing, React 18, Fast Refresh, Image Optimization and more. +- **Next.js 14**: File-based routing, React 18, Fast Refresh, Image Optimization and more. - **App Router**: Uses React Server Components, Data Cache, and async components. - **TypeScript**: Strongly typed codebase and GraphQL payloads with strict mode. - **GraphQL best practices**: Uses GraphQL Codegen and `TypedDocumentString` to reduce boilerplate and bundle size. diff --git a/package.json b/package.json index ed6f7a0b2..1566f1232 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "type": "module", "scripts": { - "dev": "next dev", + "dev": "next dev --turbo", "build": "next build", "start": "next start", "predev": "pnpm run generate", @@ -15,11 +15,10 @@ "test": "playwright test" }, "dependencies": { - "@adyen/adyen-web": "5.52.0", + "@adyen/adyen-web": "5.53.2", "@adyen/api-library": "14.3.0", - "@apollo/client": "3.8.6", "@headlessui/react": "1.7.17", - "@saleor/auth-sdk": "0.13.1", + "@saleor/auth-sdk": "0.14.0", "clsx": "2.0.0", "editorjs-html": "3.4.3", "formik": "2.4.5", @@ -51,10 +50,10 @@ "@tailwindcss/forms": "0.5.6", "@tailwindcss/typography": "0.5.10", "@types/lodash-es": "4.17.10", - "@types/node": "20.8.2", - "@types/react": "18.2.27", + "@types/node": "20.8.9", + "@types/react": "18.2.33", "@types/react-dom": "18.2.14", - "@types/url-join": "4.0.1", + "@types/url-join": "4.0.2", "@typescript-eslint/eslint-plugin": "6.9.0", "@typescript-eslint/parser": "6.9.0", "autoprefixer": "10.4.16", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6b90fdccb..d546dace1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,20 +9,17 @@ overrides: dependencies: '@adyen/adyen-web': - specifier: 5.52.0 - version: 5.52.0 + specifier: 5.53.2 + version: 5.53.2 '@adyen/api-library': specifier: 14.3.0 version: 14.3.0 - '@apollo/client': - specifier: 3.8.6 - version: 3.8.6(graphql@16.8.1)(react-dom@18.2.0)(react@18.2.0) '@headlessui/react': specifier: 1.7.17 version: 1.7.17(react-dom@18.2.0)(react@18.2.0) '@saleor/auth-sdk': - specifier: 0.13.1 - version: 0.13.1(@apollo/client@3.8.6)(next@14.0.0)(react-dom@18.2.0)(react@18.2.0)(urql@4.0.5) + specifier: 0.14.0 + version: 0.14.0(next@14.0.0)(react-dom@18.2.0)(react@18.2.0)(urql@4.0.5) clsx: specifier: 2.0.0 version: 2.0.0 @@ -82,12 +79,12 @@ dependencies: version: 1.3.2 zustand: specifier: 4.4.4 - version: 4.4.4(@types/react@18.2.27)(react@18.2.0) + version: 4.4.4(@types/react@18.2.33)(react@18.2.0) devDependencies: '@graphql-codegen/cli': specifier: 5.0.0 - version: 5.0.0(@parcel/watcher@2.3.0)(@types/node@20.8.2)(graphql@16.8.1)(typescript@5.2.2) + version: 5.0.0(@parcel/watcher@2.3.0)(@types/node@20.8.9)(graphql@16.8.1)(typescript@5.2.2) '@graphql-codegen/client-preset': specifier: 4.1.0 version: 4.1.0(graphql@16.8.1) @@ -113,17 +110,17 @@ devDependencies: specifier: 4.17.10 version: 4.17.10 '@types/node': - specifier: 20.8.2 - version: 20.8.2 + specifier: 20.8.9 + version: 20.8.9 '@types/react': - specifier: 18.2.27 - version: 18.2.27 + specifier: 18.2.33 + version: 18.2.33 '@types/react-dom': specifier: 18.2.14 version: 18.2.14 '@types/url-join': - specifier: 4.0.1 - version: 4.0.1 + specifier: 4.0.2 + version: 4.0.2 '@typescript-eslint/eslint-plugin': specifier: 6.9.0 version: 6.9.0(@typescript-eslint/parser@6.9.0)(eslint@8.52.0)(typescript@5.2.2) @@ -194,8 +191,8 @@ packages: engines: {node: '>=0.10.0'} dev: true - /@adyen/adyen-web@5.52.0: - resolution: {integrity: sha512-x83JgvR28BQ18EIR003uATZ5U4SIFKkgP+28I/RToImpsrtkjWDJP3GHVKKGk2DA+5GGnvPwmNJzCLqV2skCvw==} + /@adyen/adyen-web@5.53.2: + resolution: {integrity: sha512-hnOphMNTaauu9+cLvPVD4jxFxKZZV+DJJsKfRoldaafBt2Z/0zH0iol3ZnA9FjwWJjxBw8Qh4JXwu0lcx+uwIw==} dependencies: '@babel/runtime': 7.23.2 '@babel/runtime-corejs3': 7.23.2 @@ -229,42 +226,6 @@ packages: '@jridgewell/gen-mapping': 0.3.3 '@jridgewell/trace-mapping': 0.3.20 - /@apollo/client@3.8.6(graphql@16.8.1)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-FnHg3vhQP8tQzgBs6oTJCFFIbovelDGYujj6MK7CJneiHf62TJstCIO0Ot4A1h7XrgFEtgl8a/OgajQWqrTuYw==} - peerDependencies: - graphql: 16.8.1 - graphql-ws: ^5.5.5 - react: ^16.8.0 || ^17.0.0 || ^18.0.0 - react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 - subscriptions-transport-ws: ^0.9.0 || ^0.11.0 - peerDependenciesMeta: - graphql-ws: - optional: true - react: - optional: true - react-dom: - optional: true - subscriptions-transport-ws: - optional: true - dependencies: - '@graphql-typed-document-node/core': 3.2.0(graphql@16.8.1) - '@wry/context': 0.7.4 - '@wry/equality': 0.5.7 - '@wry/trie': 0.4.3 - graphql: 16.8.1 - graphql-tag: 2.12.6(graphql@16.8.1) - hoist-non-react-statics: 3.3.2 - optimism: 0.17.5 - prop-types: 15.8.1 - react: 18.2.0 - react-dom: 18.2.0(react@18.2.0) - response-iterator: 0.2.6 - symbol-observable: 4.0.0 - ts-invariant: 0.10.3 - tslib: 2.6.2 - zen-observable-ts: 1.2.5 - dev: false - /@ardatan/relay-compiler@12.0.0(graphql@16.8.1): resolution: {integrity: sha512-9anThAaj1dQr6IGmzBMcfzOQKTa5artjuPmw8NYK/fiGEMjADbSguBY2FMDykt+QhilR3wc9VA/3yVju7JHg7Q==} hasBin: true @@ -892,7 +853,7 @@ packages: tslib: 2.5.3 dev: true - /@graphql-codegen/cli@5.0.0(@parcel/watcher@2.3.0)(@types/node@20.8.2)(graphql@16.8.1)(typescript@5.2.2): + /@graphql-codegen/cli@5.0.0(@parcel/watcher@2.3.0)(@types/node@20.8.9)(graphql@16.8.1)(typescript@5.2.2): resolution: {integrity: sha512-A7J7+be/a6e+/ul2KI5sfJlpoqeqwX8EzktaKCeduyVKgOLA6W5t+NUGf6QumBDXU8PEOqXk3o3F+RAwCWOiqA==} hasBin: true peerDependencies: @@ -910,12 +871,12 @@ packages: '@graphql-tools/apollo-engine-loader': 8.0.0(graphql@16.8.1) '@graphql-tools/code-file-loader': 8.0.2(graphql@16.8.1) '@graphql-tools/git-loader': 8.0.2(graphql@16.8.1) - '@graphql-tools/github-loader': 8.0.0(@types/node@20.8.2)(graphql@16.8.1) + '@graphql-tools/github-loader': 8.0.0(@types/node@20.8.9)(graphql@16.8.1) '@graphql-tools/graphql-file-loader': 8.0.0(graphql@16.8.1) '@graphql-tools/json-file-loader': 8.0.0(graphql@16.8.1) '@graphql-tools/load': 8.0.0(graphql@16.8.1) - '@graphql-tools/prisma-loader': 8.0.1(@types/node@20.8.2)(graphql@16.8.1) - '@graphql-tools/url-loader': 8.0.0(@types/node@20.8.2)(graphql@16.8.1) + '@graphql-tools/prisma-loader': 8.0.1(@types/node@20.8.9)(graphql@16.8.1) + '@graphql-tools/url-loader': 8.0.0(@types/node@20.8.9)(graphql@16.8.1) '@graphql-tools/utils': 10.0.7(graphql@16.8.1) '@parcel/watcher': 2.3.0 '@whatwg-node/fetch': 0.8.8 @@ -924,7 +885,7 @@ packages: debounce: 1.2.1 detect-indent: 6.1.0 graphql: 16.8.1 - graphql-config: 5.0.3(@types/node@20.8.2)(graphql@16.8.1)(typescript@5.2.2) + graphql-config: 5.0.3(@types/node@20.8.9)(graphql@16.8.1)(typescript@5.2.2) inquirer: 8.2.6 is-glob: 4.0.3 jiti: 1.20.0 @@ -1183,7 +1144,7 @@ packages: - utf-8-validate dev: true - /@graphql-tools/executor-http@1.0.3(@types/node@20.8.2)(graphql@16.8.1): + /@graphql-tools/executor-http@1.0.3(@types/node@20.8.9)(graphql@16.8.1): resolution: {integrity: sha512-5WZIMBevRaxMabZ8U2Ty0dTUPy/PpeYSlMNEmC/YJjKKykgSfc/AwSejx2sE4FFKZ0I2kxRKRenyoWMHRAV49Q==} engines: {node: '>=16.0.0'} peerDependencies: @@ -1194,7 +1155,7 @@ packages: '@whatwg-node/fetch': 0.9.13 extract-files: 11.0.0 graphql: 16.8.1 - meros: 1.3.0(@types/node@20.8.2) + meros: 1.3.0(@types/node@20.8.9) tslib: 2.6.2 value-or-promise: 1.0.12 transitivePeerDependencies: @@ -1249,14 +1210,14 @@ packages: - supports-color dev: true - /@graphql-tools/github-loader@8.0.0(@types/node@20.8.2)(graphql@16.8.1): + /@graphql-tools/github-loader@8.0.0(@types/node@20.8.9)(graphql@16.8.1): resolution: {integrity: sha512-VuroArWKcG4yaOWzV0r19ElVIV6iH6UKDQn1MXemND0xu5TzrFme0kf3U9o0YwNo0kUYEk9CyFM0BYg4he17FA==} engines: {node: '>=16.0.0'} peerDependencies: graphql: 16.8.1 dependencies: '@ardatan/sync-fetch': 0.0.1 - '@graphql-tools/executor-http': 1.0.3(@types/node@20.8.2)(graphql@16.8.1) + '@graphql-tools/executor-http': 1.0.3(@types/node@20.8.9)(graphql@16.8.1) '@graphql-tools/graphql-tag-pluck': 8.0.2(graphql@16.8.1) '@graphql-tools/utils': 10.0.7(graphql@16.8.1) '@whatwg-node/fetch': 0.9.13 @@ -1360,13 +1321,13 @@ packages: tslib: 2.5.3 dev: true - /@graphql-tools/prisma-loader@8.0.1(@types/node@20.8.2)(graphql@16.8.1): + /@graphql-tools/prisma-loader@8.0.1(@types/node@20.8.9)(graphql@16.8.1): resolution: {integrity: sha512-bl6e5sAYe35Z6fEbgKXNrqRhXlCJYeWKBkarohgYA338/SD9eEhXtg3Cedj7fut3WyRLoQFpHzfiwxKs7XrgXg==} engines: {node: '>=16.0.0'} peerDependencies: graphql: 16.8.1 dependencies: - '@graphql-tools/url-loader': 8.0.0(@types/node@20.8.2)(graphql@16.8.1) + '@graphql-tools/url-loader': 8.0.0(@types/node@20.8.9)(graphql@16.8.1) '@graphql-tools/utils': 10.0.7(graphql@16.8.1) '@types/js-yaml': 4.0.8 '@types/json-stable-stringify': 1.0.35 @@ -1421,7 +1382,7 @@ packages: value-or-promise: 1.0.12 dev: true - /@graphql-tools/url-loader@8.0.0(@types/node@20.8.2)(graphql@16.8.1): + /@graphql-tools/url-loader@8.0.0(@types/node@20.8.9)(graphql@16.8.1): resolution: {integrity: sha512-rPc9oDzMnycvz+X+wrN3PLrhMBQkG4+sd8EzaFN6dypcssiefgWKToXtRKI8HHK68n2xEq1PyrOpkjHFJB+GwA==} engines: {node: '>=16.0.0'} peerDependencies: @@ -1430,7 +1391,7 @@ packages: '@ardatan/sync-fetch': 0.0.1 '@graphql-tools/delegate': 10.0.3(graphql@16.8.1) '@graphql-tools/executor-graphql-ws': 1.1.0(graphql@16.8.1) - '@graphql-tools/executor-http': 1.0.3(@types/node@20.8.2)(graphql@16.8.1) + '@graphql-tools/executor-http': 1.0.3(@types/node@20.8.9)(graphql@16.8.1) '@graphql-tools/executor-legacy-ws': 1.0.4(graphql@16.8.1) '@graphql-tools/utils': 10.0.7(graphql@16.8.1) '@graphql-tools/wrap': 10.0.1(graphql@16.8.1) @@ -1822,11 +1783,11 @@ packages: resolution: {integrity: sha512-6i/8UoL0P5y4leBIGzvkZdS85RDMG9y1ihZzmTZQ5LdHUYmZ7pKFoj8X0236s3lusPs1Fa5HTQUpwI+UfTcmeA==} dev: true - /@saleor/auth-sdk@0.13.1(@apollo/client@3.8.6)(next@14.0.0)(react-dom@18.2.0)(react@18.2.0)(urql@4.0.5): - resolution: {integrity: sha512-f/8FjfqB2qNHb/9qyq3dJpq37r12zF5fyUy63p9oZyZo2dB0bwkeK9CiNWpvKaA0OginxMMarjF/BSkAJ0NUxQ==} + /@saleor/auth-sdk@0.14.0(next@14.0.0)(react-dom@18.2.0)(react@18.2.0)(urql@4.0.5): + resolution: {integrity: sha512-38lK68F0g+s9BhtR+zFdNu7s+tATQ+lIIlcSExM35mOuecIrZCPMbbwzHNvD7X8snM0BHSsi5bacVKzv4Xu/Pw==} peerDependencies: - '@apollo/client': ^3.7.15 - next: ^13.4.4 + '@apollo/client': '*' + next: ^13.4.4 || ^14.0.0 react: ^18.2.0 react-dom: ^18.2.0 urql: ^4.0.3 @@ -1842,7 +1803,6 @@ packages: urql: optional: true dependencies: - '@apollo/client': 3.8.6(graphql@16.8.1)(react-dom@18.2.0)(react@18.2.0) '@graphql-typed-document-node/core': 3.2.0(graphql@16.8.1) cookie: 0.5.0 graphql: 16.8.1 @@ -1890,7 +1850,7 @@ packages: /@types/hoist-non-react-statics@3.3.4: resolution: {integrity: sha512-ZchYkbieA+7tnxwX/SCBySx9WwvWR8TaP5tb2jRAzwvLb/rWchGw3v0w3pqUbUvj0GCwW2Xz/AVPSk6kUGctXQ==} dependencies: - '@types/react': 18.2.27 + '@types/react': 18.2.33 hoist-non-react-statics: 3.3.2 dev: false @@ -1926,8 +1886,10 @@ packages: dev: false optional: true - /@types/node@20.8.2: - resolution: {integrity: sha512-Vvycsc9FQdwhxE3y3DzeIxuEJbWGDsnrxvMADzTDF/lcdR9/K+AQIeAghTQsHtotg/q0j3WEOYS/jQgSdWue3w==} + /@types/node@20.8.9: + resolution: {integrity: sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==} + dependencies: + undici-types: 5.26.5 dev: true /@types/prop-types@15.7.9: @@ -1936,11 +1898,11 @@ packages: /@types/react-dom@18.2.14: resolution: {integrity: sha512-V835xgdSVmyQmI1KLV2BEIUgqEuinxp9O4G6g3FqO/SqLac049E53aysv0oEFD2kHfejeKU+ZqL2bcFWj9gLAQ==} dependencies: - '@types/react': 18.2.27 + '@types/react': 18.2.33 dev: true - /@types/react@18.2.27: - resolution: {integrity: sha512-Wfv7B7FZiR2r3MIqbAlXoY1+tXm4bOqfz4oRr+nyXdBqapDBZ0l/IGcSlAfvxIHEEJjkPU0MYAc/BlFPOcrgLw==} + /@types/react@18.2.33: + resolution: {integrity: sha512-v+I7S+hu3PIBoVkKGpSYYpiBT1ijqEzWpzQD62/jm4K74hPpSP7FF9BnKG6+fg2+62weJYkkBWDJlZt5JO/9hg==} dependencies: '@types/prop-types': 15.7.9 '@types/scheduler': 0.16.5 @@ -1953,14 +1915,14 @@ packages: resolution: {integrity: sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==} dev: true - /@types/url-join@4.0.1: - resolution: {integrity: sha512-wDXw9LEEUHyV+7UWy7U315nrJGJ7p1BzaCxDpEoLr789Dk1WDVMMlf3iBfbG2F8NdWnYyFbtTxUn2ZNbm1Q4LQ==} + /@types/url-join@4.0.2: + resolution: {integrity: sha512-uv54MkAtQ4B5Qm20LmMN7tAdczqRenu1K6Sf7PHCygqylVJlRwjpUE5OGofqxdXGH3QJUu+qvDZzPadz5EOjxA==} dev: true /@types/ws@8.5.8: resolution: {integrity: sha512-flUksGIQCnJd6sZ1l5dqCEG/ksaoAg/eUwiLAGTJQcfgvZJKF++Ta4bJA6A5aPSJmsr+xlseHn4KLgVlNnvPTg==} dependencies: - '@types/node': 20.8.2 + '@types/node': 20.8.9 dev: true /@typescript-eslint/eslint-plugin@6.9.0(@typescript-eslint/parser@6.9.0)(eslint@8.52.0)(typescript@5.2.2): @@ -2155,27 +2117,6 @@ packages: tslib: 2.6.2 dev: true - /@wry/context@0.7.4: - resolution: {integrity: sha512-jmT7Sb4ZQWI5iyu3lobQxICu2nC/vbUhP0vIdd6tHC9PTfenmRmuIFqktc6GH9cgi+ZHnsLWPvfSvc4DrYmKiQ==} - engines: {node: '>=8'} - dependencies: - tslib: 2.6.2 - dev: false - - /@wry/equality@0.5.7: - resolution: {integrity: sha512-BRFORjsTuQv5gxcXsuDXx6oGRhuVsEGwZy6LOzRRfgu+eSfxbhUQ9L9YtSEIuIjY/o7g3iWFjrc5eSY1GXP2Dw==} - engines: {node: '>=8'} - dependencies: - tslib: 2.6.2 - dev: false - - /@wry/trie@0.4.3: - resolution: {integrity: sha512-I6bHwH0fSf6RqQcnnXLJKhkSXG45MFral3GxPaY4uAl0LYDZM+YDVDAiU9bYwjTuysy1S0IeecWtmq1SZA3M1w==} - engines: {node: '>=8'} - dependencies: - tslib: 2.6.2 - dev: false - /acorn-jsx@5.3.2(acorn@8.10.0): resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -3780,7 +3721,7 @@ packages: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} dev: true - /graphql-config@5.0.3(@types/node@20.8.2)(graphql@16.8.1)(typescript@5.2.2): + /graphql-config@5.0.3(@types/node@20.8.9)(graphql@16.8.1)(typescript@5.2.2): resolution: {integrity: sha512-BNGZaoxIBkv9yy6Y7omvsaBUHOzfFcII3UN++tpH8MGOKFPFkCPZuwx09ggANMt8FgyWP1Od8SWPmrUEZca4NQ==} engines: {node: '>= 16.0.0'} peerDependencies: @@ -3794,7 +3735,7 @@ packages: '@graphql-tools/json-file-loader': 8.0.0(graphql@16.8.1) '@graphql-tools/load': 8.0.0(graphql@16.8.1) '@graphql-tools/merge': 9.0.0(graphql@16.8.1) - '@graphql-tools/url-loader': 8.0.0(@types/node@20.8.2)(graphql@16.8.1) + '@graphql-tools/url-loader': 8.0.0(@types/node@20.8.9)(graphql@16.8.1) '@graphql-tools/utils': 10.0.7(graphql@16.8.1) cosmiconfig: 8.3.6(typescript@5.2.2) graphql: 16.8.1 @@ -3830,6 +3771,7 @@ packages: dependencies: graphql: 16.8.1 tslib: 2.6.2 + dev: true /graphql-ws@5.14.1(graphql@16.8.1): resolution: {integrity: sha512-aqkls1espsygP1PfkAuuLIV96IbztQ6EaADse97pw8wRIMT3+AL/OYfS8V2iCRkc0gzckitoDRGCQEdnySggiA==} @@ -4577,7 +4519,7 @@ packages: engines: {node: '>= 8'} dev: true - /meros@1.3.0(@types/node@20.8.2): + /meros@1.3.0(@types/node@20.8.9): resolution: {integrity: sha512-2BNGOimxEz5hmjUG2FwoxCt5HN7BXdaWyFqEwxPTrJzVdABtrL4TiHTcsWSFAxPQ/tOnEaQEJh3qWq71QRMY+w==} engines: {node: '>=13'} peerDependencies: @@ -4586,7 +4528,7 @@ packages: '@types/node': optional: true dependencies: - '@types/node': 20.8.2 + '@types/node': 20.8.9 dev: true /micromatch@4.0.5: @@ -4845,14 +4787,6 @@ packages: mimic-fn: 4.0.0 dev: true - /optimism@0.17.5: - resolution: {integrity: sha512-TEcp8ZwK1RczmvMnvktxHSF2tKgMWjJ71xEFGX5ApLh67VsMSTy1ZUlipJw8W+KaqgOmQ+4pqwkeivY89j+4Vw==} - dependencies: - '@wry/context': 0.7.4 - '@wry/trie': 0.4.3 - tslib: 2.6.2 - dev: false - /optionator@0.9.3: resolution: {integrity: sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==} engines: {node: '>= 0.8.0'} @@ -5212,6 +5146,7 @@ packages: loose-envify: 1.4.0 object-assign: 4.1.1 react-is: 16.13.1 + dev: true /property-expr@2.0.6: resolution: {integrity: sha512-SVtmxhRE/CGkn3eZY1T6pC8Nln6Fr/lu1mKSgRud0eC73whjGfoAogbn78LkD8aFL0zz3bAFerKSnOl7NlErBA==} @@ -5438,11 +5373,6 @@ packages: supports-preserve-symlinks-flag: 1.0.0 dev: true - /response-iterator@0.2.6: - resolution: {integrity: sha512-pVzEEzrsg23Sh053rmDUvLSkGXluZio0qu8VT6ukrYuvtjVfCbDZH9d6PGXb8HZfzdNZt8feXv/jvUzlhRgLnw==} - engines: {node: '>=0.8'} - dev: false - /restore-cursor@3.1.0: resolution: {integrity: sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==} engines: {node: '>=8'} @@ -5826,11 +5756,6 @@ packages: tslib: 2.5.3 dev: true - /symbol-observable@4.0.0: - resolution: {integrity: sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ==} - engines: {node: '>=0.10'} - dev: false - /tailwindcss@3.3.5: resolution: {integrity: sha512-5SEZU4J7pxZgSkv7FP1zY8i2TIAOooNZ1e/OGtxIEv6GltpoiXUqWvLy89+a10qYTB1N5Ifkuw9lqQkN9sscvA==} engines: {node: '>=14.0.0'} @@ -6057,6 +5982,10 @@ packages: engines: {node: '>=0.10.0'} dev: true + /undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + dev: true + /unixify@1.0.0: resolution: {integrity: sha512-6bc58dPYhCMHHuwxldQxO3RRNZ4eCogZ/st++0+fcC1nr0jiGUtAdBJ2qzmLQWSxbtz42pWt4QQMiZ9HvZf5cg==} engines: {node: '>=0.10.0'} @@ -6372,17 +6301,7 @@ packages: type-fest: 2.19.0 dev: false - /zen-observable-ts@1.2.5: - resolution: {integrity: sha512-QZWQekv6iB72Naeake9hS1KxHlotfRpe+WGNbNx5/ta+R3DNjVO2bswf63gXlWDcs+EMd7XY8HfVQyP1X6T4Zg==} - dependencies: - zen-observable: 0.8.15 - dev: false - - /zen-observable@0.8.15: - resolution: {integrity: sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==} - dev: false - - /zustand@4.4.4(@types/react@18.2.27)(react@18.2.0): + /zustand@4.4.4(@types/react@18.2.33)(react@18.2.0): resolution: {integrity: sha512-5UTUIAiHMNf5+mFp7/AnzJXS7+XxktULFN0+D1sCiZWyX7ZG+AQpqs2qpYrynRij4QvoDdCD+U+bmg/cG3Ucxw==} engines: {node: '>=12.7.0'} peerDependencies: @@ -6397,7 +6316,7 @@ packages: react: optional: true dependencies: - '@types/react': 18.2.27 + '@types/react': 18.2.33 react: 18.2.0 use-sync-external-store: 1.2.0(react@18.2.0) dev: false diff --git a/src/app/(main)/login/page.tsx b/src/app/(main)/login/page.tsx index 3d66e8acb..0af7f7515 100644 --- a/src/app/(main)/login/page.tsx +++ b/src/app/(main)/login/page.tsx @@ -1,8 +1,7 @@ "use client"; -import React from "react"; +import { gql, useQuery } from "urql"; import { useSaleorAuthContext } from "@saleor/auth-sdk/react"; -import { gql, useQuery } from "@apollo/client"; import { LoginForm } from "@/ui/components/LoginForm"; import { Loader } from "@/ui/atoms/Loader"; import { CurrentUserDocument, type CurrentUserQuery } from "@/gql/graphql"; @@ -11,9 +10,11 @@ import { UserCard } from "@/ui/components/UserCard"; export default function LoginPage() { const { signOut } = useSaleorAuthContext(); - const { data, loading } = useQuery(gql(CurrentUserDocument.toString())); + const [{ data, fetching }] = useQuery({ + query: gql(CurrentUserDocument.toString()), + }); - if (loading) { + if (fetching) { return ; } diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts deleted file mode 100644 index e3ebd35ed..000000000 --- a/src/app/sitemap.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { type MetadataRoute } from "next"; - -export default function sitemap(): MetadataRoute.Sitemap { - return [ - // TODO - ]; -} diff --git a/src/checkout/Root.tsx b/src/checkout/Root.tsx index c97fe4d8a..9bf1db4e3 100644 --- a/src/checkout/Root.tsx +++ b/src/checkout/Root.tsx @@ -25,7 +25,7 @@ export const Root = ({ saleorApiUrl }: { saleorApiUrl: string }) => { url: saleorApiUrl, suspense: true, requestPolicy: "cache-first", - fetch: saleorAuthClient.fetchWithAuth, + fetch: (input, init) => saleorAuthClient.fetchWithAuth(input as NodeJS.fetch.RequestInfo, init), exchanges: [dedupExchange, cacheExchange, fetchExchange], }); diff --git a/src/checkout/graphql/index.ts b/src/checkout/graphql/index.ts index 7841b46c2..c73cb02ba 100644 --- a/src/checkout/graphql/index.ts +++ b/src/checkout/graphql/index.ts @@ -1,5 +1,4 @@ // THIS FILE IS GENERATED WITH `pnpm generate` -import "graphql/language/ast"; import gql from "graphql-tag"; import * as Urql from "urql"; export type Maybe = T | null; diff --git a/src/ui/components/AuthProvider.tsx b/src/ui/components/AuthProvider.tsx index 92572157e..e37e6fab6 100644 --- a/src/ui/components/AuthProvider.tsx +++ b/src/ui/components/AuthProvider.tsx @@ -1,10 +1,17 @@ "use client"; import { SaleorAuthProvider, useAuthChange } from "@saleor/auth-sdk/react"; -import { ApolloClient, ApolloProvider, InMemoryCache, createHttpLink } from "@apollo/client"; import { invariant } from "ts-invariant"; import { createSaleorAuthClient } from "@saleor/auth-sdk"; -import { type ReactNode } from "react"; +import { useState, type ReactNode } from "react"; +import { + type Client, + Provider as UrqlProvider, + cacheExchange, + createClient, + dedupExchange, + fetchExchange, +} from "urql"; const saleorApiUrl = process.env.NEXT_PUBLIC_SALEOR_API_URL; invariant(saleorApiUrl, "Missing NEXT_PUBLIC_SALEOR_API_URL env variable"); @@ -13,25 +20,28 @@ export const saleorAuthClient = createSaleorAuthClient({ saleorApiUrl, }); -export const apolloClient = new ApolloClient({ - link: createHttpLink({ - uri: saleorApiUrl, - fetch: saleorAuthClient.fetchWithAuth, - }), - cache: new InMemoryCache(), -}); +const makeUrqlClient = () => + createClient({ + url: saleorApiUrl, + suspense: true, + requestPolicy: "cache-first", + fetch: (input, init) => saleorAuthClient.fetchWithAuth(input as NodeJS.fetch.RequestInfo, init), + exchanges: [dedupExchange, cacheExchange, fetchExchange], + }); export function AuthProvider({ children }: { children: ReactNode }) { invariant(saleorApiUrl, "Missing NEXT_PUBLIC_SALEOR_API_URL env variable"); + + const [urqlClient, setUrqlClient] = useState(makeUrqlClient()); useAuthChange({ saleorApiUrl, - onSignedOut: () => apolloClient.resetStore(), - onSignedIn: () => apolloClient.refetchQueries({ include: "all" }), + onSignedOut: () => setUrqlClient(makeUrqlClient()), + onSignedIn: () => setUrqlClient(makeUrqlClient()), }); return ( - {children} + {children} ); } diff --git a/tsconfig.json b/tsconfig.json index 0765f57a5..f03819840 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,8 +27,10 @@ "paths": { "@/*": ["./src/*"], "@ui/*": ["./src/components/*"] - } + }, + "types": ["react-dom/canary"] }, + "include": [ "next-env.d.ts", "src/**/*.ts",