diff --git a/package-lock.json b/package-lock.json index cb367cc4..89db57e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,14 +28,14 @@ "@tailwindcss/aspect-ratio": "^0.4.0", "@tailwindcss/forms": "^0.5.9", "@tanstack/react-query": "^5.61.0", - "@uppy/core": "^3.13.1", - "@uppy/dashboard": "^3.9.1", - "@uppy/drag-drop": "^3.1.1", - "@uppy/file-input": "^3.1.0", - "@uppy/image-editor": "^2.4.6", - "@uppy/progress-bar": "^3.1.1", - "@uppy/react": "^3.4.0", - "@uppy/xhr-upload": "^3.6.8", + "@uppy/core": "^4.4.0", + "@uppy/dashboard": "^4.3.0", + "@uppy/drag-drop": "^4.1.0", + "@uppy/file-input": "^4.1.0", + "@uppy/image-editor": "^3.3.0", + "@uppy/progress-bar": "^4.2.0", + "@uppy/react": "^4.2.0", + "@uppy/xhr-upload": "^4.3.0", "autoprefixer": "^10.4.20", "babel-loader": "^9.2.1", "clean-webpack-plugin": "^4.0.0", @@ -4531,157 +4531,157 @@ "license": "ISC" }, "node_modules/@uppy/companion-client": { - "version": "3.8.2", - "resolved": "https://registry.npmjs.org/@uppy/companion-client/-/companion-client-3.8.2.tgz", - "integrity": "sha512-WLjZ0Y6Fe7lzwU1YPvvQ/YqooejcgIZkT2TC39xr+QQ7Y1FwJECsyUdlKwgi1ee8TNpjoCrj3Q1Hjel/+p0VhA==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@uppy/companion-client/-/companion-client-4.4.0.tgz", + "integrity": "sha512-+pmb4T3VRZkHe6vC2gjvPiLNkWxTJXPe/xX/vdB7WcjAg8hLm8TyKtS8cakJfg0S0K6Gg4sVlhSpTckmU5Vq6g==", "license": "MIT", "dependencies": { - "@uppy/utils": "^5.9.0", + "@uppy/utils": "^6.1.0", "namespace-emitter": "^2.0.1", "p-retry": "^6.1.0" }, "peerDependencies": { - "@uppy/core": "^3.13.1" + "@uppy/core": "^4.4.0" } }, "node_modules/@uppy/core": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/@uppy/core/-/core-3.13.1.tgz", - "integrity": "sha512-iQGAUO4ziQRpfv7kix6tO6JOWqjI0K4vt8AynvHWzDPZxYSba3zd6RojGNPsYWSR7Xv+dRXYx+GU8oTiK1FRUA==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@uppy/core/-/core-4.4.0.tgz", + "integrity": "sha512-zR7yOsVzZGP/NQqPFEaQnLWOlzJeVMKlfrKg3SA9PDJ8w4/3BoflcqrpmIRS/+UQCgnB0FwHjVWEyI7kxNFTZQ==", "license": "MIT", "dependencies": { "@transloadit/prettier-bytes": "^0.3.4", - "@uppy/store-default": "^3.2.2", - "@uppy/utils": "^5.9.0", + "@uppy/store-default": "^4.2.0", + "@uppy/utils": "^6.1.0", "lodash": "^4.17.21", "mime-match": "^1.0.2", "namespace-emitter": "^2.0.1", - "nanoid": "^4.0.0", + "nanoid": "^5.0.9", "preact": "^10.5.13" } }, "node_modules/@uppy/dashboard": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@uppy/dashboard/-/dashboard-3.9.1.tgz", - "integrity": "sha512-zZp+5Dwqu1jUdAZEu0Os2kC/8bF3cdrkve8CYEwqP/12yjNe8PF+XUQKF1RCYITjDE4hPSXcTh0MWw6t2LONuw==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@uppy/dashboard/-/dashboard-4.3.0.tgz", + "integrity": "sha512-5PsHzpgA4jQgnsbQON+l4+NmGlyx0EqmRe0oqj/lvDr4jMrKtmKfq+tjSVDcDYlG9L1EBwZUQx4Dv4Ljmo1BQQ==", "license": "MIT", "dependencies": { "@transloadit/prettier-bytes": "^0.3.4", - "@uppy/informer": "^3.1.0", - "@uppy/provider-views": "^3.13.0", - "@uppy/status-bar": "^3.3.3", - "@uppy/thumbnail-generator": "^3.1.0", - "@uppy/utils": "^5.9.0", + "@uppy/informer": "^4.2.0", + "@uppy/provider-views": "^4.3.0", + "@uppy/status-bar": "^4.1.0", + "@uppy/thumbnail-generator": "^4.1.0", + "@uppy/utils": "^6.1.0", "classnames": "^2.2.6", - "is-shallow-equal": "^1.0.1", "lodash": "^4.17.21", "memoize-one": "^6.0.0", - "nanoid": "^4.0.0", - "preact": "^10.5.13" + "nanoid": "^5.0.9", + "preact": "^10.5.13", + "shallow-equal": "^3.0.0" }, "peerDependencies": { - "@uppy/core": "^3.13.0" + "@uppy/core": "^4.4.0" } }, "node_modules/@uppy/drag-drop": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@uppy/drag-drop/-/drag-drop-3.1.1.tgz", - "integrity": "sha512-ujUBswJ/Acvg1UQUPtfWO6PekPzFgQAEtDW7yxsi81wy1/WNIYjY36bxKVpM/cz5PjmWOTWoqdjBQa4LIJCdyw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@uppy/drag-drop/-/drag-drop-4.1.0.tgz", + "integrity": "sha512-fUwj8ua/x5S58MDdekKFsmH38sDmOMUH0/bAth9bivep/dqJnYTzkMxf1OmlZx4S6MA0t92ysnz9jVH2DaNK/g==", "license": "MIT", "dependencies": { - "@uppy/utils": "^5.9.0", + "@uppy/utils": "^6.1.0", "preact": "^10.5.13" }, "peerDependencies": { - "@uppy/core": "^3.13.1" + "@uppy/core": "^4.4.0" } }, "node_modules/@uppy/file-input": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@uppy/file-input/-/file-input-3.1.2.tgz", - "integrity": "sha512-IgZhK3EfO2bEqmEwpqfo3N9k8OxV2pmuGdKU4IuwJFv3Q1s1F6ceSDhWX8ivtVXlDvnbJIkqZbZjnvWwJxfjng==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@uppy/file-input/-/file-input-4.1.0.tgz", + "integrity": "sha512-maiDeSmUxsRCzn3k6uJFTkTb2xqEkzHoJrfQOkAcA4snSXIGVm9e8yd87g1Q1c7eiV0EedRUrvAMb6rv6JnMXA==", "license": "MIT", "dependencies": { - "@uppy/utils": "^5.9.0", + "@uppy/utils": "^6.1.0", "preact": "^10.5.13" }, "peerDependencies": { - "@uppy/core": "^3.11.0" + "@uppy/core": "^4.4.0" } }, "node_modules/@uppy/image-editor": { - "version": "2.4.6", - "resolved": "https://registry.npmjs.org/@uppy/image-editor/-/image-editor-2.4.6.tgz", - "integrity": "sha512-uQ8k4pUSsYBv6ZBoICwKq3M1DqiKg6AFM/nbvxL/q5KpRkRTszzPvP4hyvjY2zDLLf/NlK3E45N2IcWraV87dQ==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@uppy/image-editor/-/image-editor-3.3.0.tgz", + "integrity": "sha512-adVxvDayUesf0R61rSUrqJWVYDMSig57eOVlJf0DHM6UF1xEZ8j/bK3DD2Y1Smw/JV9FDj9zZgAb4yEkWASwNQ==", "license": "MIT", "dependencies": { - "@uppy/utils": "^5.9.0", - "cropperjs": "1.5.7", + "@uppy/utils": "^6.1.0", + "cropperjs": "^1.6.2", "preact": "^10.5.13" }, "peerDependencies": { - "@uppy/core": "^3.11.3" + "@uppy/core": "^4.4.0" } }, "node_modules/@uppy/informer": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@uppy/informer/-/informer-3.1.0.tgz", - "integrity": "sha512-vmpTLqzSLmZSuIVDZV0o19yXVqyTh5/uCbKUEiyfBhR726kQiuYQLP/ZHaKcvW3c1ESQGbNg53iNHbFBqF681w==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@uppy/informer/-/informer-4.2.0.tgz", + "integrity": "sha512-nwIhn8tRDYrp4Qcy2/ztijN9GzjcuMQ/0avKwu93vjhfFiq98RPnNOh+7VPogVB12uUTM1hNfHkW7zNG/MeVyg==", "license": "MIT", "dependencies": { - "@uppy/utils": "^5.7.4", + "@uppy/utils": "^6.1.0", "preact": "^10.5.13" }, "peerDependencies": { - "@uppy/core": "^3.9.3" + "@uppy/core": "^4.4.0" } }, "node_modules/@uppy/progress-bar": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@uppy/progress-bar/-/progress-bar-3.1.1.tgz", - "integrity": "sha512-c7Wcv6/gvrdxICnZUaU/cZG6wUtS0V/GYGssGFQ6OW84h0smuzGGA+KOh9zKqr6HBHxgKRxmCDtrlTlSSvAuQQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@uppy/progress-bar/-/progress-bar-4.2.0.tgz", + "integrity": "sha512-a+TZ5sj9ZJjW3OQOQu6Jd+bMUxxJS0vkRGDltgcmB0yWIbaYryYWz2T4Qr8SiQ7ePeDYrCbD7fArztZz3ZOh/Q==", "license": "MIT", "dependencies": { - "@uppy/utils": "^5.7.5", + "@uppy/utils": "^6.1.0", "preact": "^10.5.13" }, "peerDependencies": { - "@uppy/core": "^3.10.0" + "@uppy/core": "^4.4.0" } }, "node_modules/@uppy/provider-views": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@uppy/provider-views/-/provider-views-3.13.0.tgz", - "integrity": "sha512-Z2oI88A+GC2zIPk8beoeFN/miHKkhtF58mYjvb5miGCMMZM7p7LRj98sgb5OOdKsGrfeiuTavtgL424BvcVd8w==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@uppy/provider-views/-/provider-views-4.3.0.tgz", + "integrity": "sha512-m2zk0pVz5hIee86SvV40pzoiE7Ta+Koo/nW0LtVd8TrMveSf1j/Shi5k1EPlc6Enbf7n9bRPf5FccRcB88RSAg==", "license": "MIT", "dependencies": { - "@uppy/utils": "^5.9.0", + "@uppy/utils": "^6.1.0", "classnames": "^2.2.6", - "nanoid": "^4.0.0", - "p-queue": "^7.3.4", + "nanoid": "^5.0.9", + "p-queue": "^8.0.0", "preact": "^10.5.13" }, "peerDependencies": { - "@uppy/core": "^3.13.0" + "@uppy/core": "^4.4.0" } }, "node_modules/@uppy/react": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@uppy/react/-/react-3.4.0.tgz", - "integrity": "sha512-UIDLIDKH4Hfy8OsEipwP6Q6cAzP55k/+I63UImcqerEyFnw4OxaV1POfVnmgp2AOLph9xmi3S2KQzJYfUENbpg==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@uppy/react/-/react-4.2.0.tgz", + "integrity": "sha512-Te0GsjZGNqar10gpxxKP3hDdWiz5VYUfn6NYwptioqeNB6VdklKwEOxEqCcrrvvfrL6yg8vIksRQIKbOGvk5Mw==", "license": "MIT", "dependencies": { - "@uppy/utils": "^5.9.0", - "prop-types": "^15.6.1" + "@uppy/utils": "^6.1.0", + "use-sync-external-store": "^1.2.0" }, "peerDependencies": { - "@uppy/core": "^3.13.0", - "@uppy/dashboard": "^3.9.0", - "@uppy/drag-drop": "^3.1.0", - "@uppy/file-input": "^3.1.2", - "@uppy/progress-bar": "^3.1.1", - "@uppy/status-bar": "^3.3.3", - "react": "^16.0.0 || ^17.0.0 || ^18.0.0" + "@uppy/core": "^4.4.0", + "@uppy/dashboard": "^4.3.0", + "@uppy/drag-drop": "^4.1.0", + "@uppy/file-input": "^4.1.0", + "@uppy/progress-bar": "^4.2.0", + "@uppy/status-bar": "^4.1.0", + "react": "^18.0.0 || ^19.0.0" }, "peerDependenciesMeta": { "@uppy/dashboard": { @@ -4702,43 +4702,43 @@ } }, "node_modules/@uppy/status-bar": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@uppy/status-bar/-/status-bar-3.3.3.tgz", - "integrity": "sha512-TCcnBjTDbq/AmnGOcWbCpQNsv05Z6Y36zdmTCt/xNe2/gTVAYAzGRoGOrkeb6jf/E4AAi25VyOolSqL2ibB8Kw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@uppy/status-bar/-/status-bar-4.1.0.tgz", + "integrity": "sha512-7/7ahI1ri/1wpAEPzlqNLCcRslbyBgP5tDnchwtnqEMhYyFlCOMlpUYc9y6ynSnseMrNsnZegFz+PnVzQtZr0g==", "license": "MIT", "dependencies": { "@transloadit/prettier-bytes": "^0.3.4", - "@uppy/utils": "^5.9.0", + "@uppy/utils": "^6.1.0", "classnames": "^2.2.6", "preact": "^10.5.13" }, "peerDependencies": { - "@uppy/core": "^3.11.2" + "@uppy/core": "^4.4.0" } }, "node_modules/@uppy/store-default": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/@uppy/store-default/-/store-default-3.2.2.tgz", - "integrity": "sha512-OiSgT++Jj4nLK0N9WTeod3UNjCH81OXE5BcMJCd9oWzl2d0xPNq2T/E9Y6O72XVd+6Y7+tf5vZlPElutfMB3KQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@uppy/store-default/-/store-default-4.2.0.tgz", + "integrity": "sha512-PieFVa8yTvRHIqsNKfpO/yaJw5Ae/hT7uT58ryw7gvCBY5bHrNWxH5N0XFe8PFHMpLpLn8v3UXGx9ib9QkB6+Q==", "license": "MIT" }, "node_modules/@uppy/thumbnail-generator": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@uppy/thumbnail-generator/-/thumbnail-generator-3.1.0.tgz", - "integrity": "sha512-tDKK/cukC0CrM0F/OlHFmvpGGUq+Db4YfakhIGPKtT7ZO8aWOiIu5JIvaYUnKRxGq3RGsk4zhkxYXuoxVzzsGA==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@uppy/thumbnail-generator/-/thumbnail-generator-4.1.0.tgz", + "integrity": "sha512-sxyi//xCGbV9rY7QMGJy6srMFibX7RJ6iXdjX3UIYizLszyV+S7UCoHO44nJ2vXRzjSrrX8jCxREbQYzTL4dCQ==", "license": "MIT", "dependencies": { - "@uppy/utils": "^5.7.5", + "@uppy/utils": "^6.1.0", "exifr": "^7.0.0" }, "peerDependencies": { - "@uppy/core": "^3.10.0" + "@uppy/core": "^4.4.0" } }, "node_modules/@uppy/utils": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/@uppy/utils/-/utils-5.9.0.tgz", - "integrity": "sha512-9Ubddd3orCOLYjf0KobwgJ+aTrABSxk9t4X/QdM4qJHVZuMIftkaMplrViRUO+kvIBCXEZDIP2AmS060siDNGw==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@uppy/utils/-/utils-6.1.0.tgz", + "integrity": "sha512-RNQgQ+Nrfi1vd2oMsK2zSQBgnVbHfqRhSDje7Yn2In5tP9tjtSbqL91Yz4azrq7IIL8ovyqpBYgDCrsYL7xWag==", "license": "MIT", "dependencies": { "lodash": "^4.17.21", @@ -4746,16 +4746,16 @@ } }, "node_modules/@uppy/xhr-upload": { - "version": "3.6.8", - "resolved": "https://registry.npmjs.org/@uppy/xhr-upload/-/xhr-upload-3.6.8.tgz", - "integrity": "sha512-zr3OHrIdo08jmCqTYKS0C7o3E0XQpjtZI40wmB6VvXYzu4x/aZankG9QqKxLiY0n8KbZ9aCIvO8loxBGoL7Kaw==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@uppy/xhr-upload/-/xhr-upload-4.3.0.tgz", + "integrity": "sha512-pMNcMrUU9uUW2RC537cKsk3boGduCSgfqMpXoE//TOKIrjJ54lxycxhY6TlEwVUGp5pUnbdy78KPYdc+ND15qA==", "license": "MIT", "dependencies": { - "@uppy/companion-client": "^3.8.1", - "@uppy/utils": "^5.9.0" + "@uppy/companion-client": "^4.4.0", + "@uppy/utils": "^6.1.0" }, "peerDependencies": { - "@uppy/core": "^3.13.0" + "@uppy/core": "^4.4.0" } }, "node_modules/@webassemblyjs/ast": { @@ -6694,9 +6694,9 @@ } }, "node_modules/cropperjs": { - "version": "1.5.7", - "resolved": "https://registry.npmjs.org/cropperjs/-/cropperjs-1.5.7.tgz", - "integrity": "sha512-sGj+G/ofKh+f6A4BtXLJwtcKJgMUsXYVUubfTo9grERiDGXncttefmue/fyQFvn8wfdyoD1KhDRYLfjkJFl0yw==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/cropperjs/-/cropperjs-1.6.2.tgz", + "integrity": "sha512-nhymn9GdnV3CqiEHJVai54TULFAE3VshJTXSqSJKa8yXAKyBKDWdhHarnlIPrshJ0WMFTGuFvG02YjLXfPiuOA==", "license": "MIT" }, "node_modules/cross-fetch": { @@ -8868,9 +8868,9 @@ "license": "MIT" }, "node_modules/express": { - "version": "4.21.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.21.1.tgz", - "integrity": "sha512-YSFlK1Ee0/GC8QaO91tHcDxJiE/X4FbpAyQWkxAvG6AXCuR65YzK8ua6D9hvi/TzUfZMpc+BwuM1IPw8fmQBiQ==", + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", "dev": true, "license": "MIT", "dependencies": { @@ -8893,7 +8893,7 @@ "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.10", + "path-to-regexp": "0.1.12", "proxy-addr": "~2.0.7", "qs": "6.13.0", "range-parser": "~1.2.1", @@ -8908,6 +8908,10 @@ }, "engines": { "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/express/node_modules/debug": { @@ -11168,12 +11172,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-shallow-equal": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-shallow-equal/-/is-shallow-equal-1.0.1.tgz", - "integrity": "sha512-lq5RvK+85Hs5J3p4oA4256M1FEffzmI533ikeDHvJd42nouRRx5wBzt36JuviiGe5dIPyHON/d0/Up+PBo6XkQ==", - "license": "MIT" - }, "node_modules/is-shared-array-buffer": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", @@ -12937,9 +12935,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-4.0.2.tgz", - "integrity": "sha512-7ZtY5KTCNheRGfEFxnedV5zFiORN1+Y1N6zvPTnHQd8ENUvfaDBeuJDZb2bN/oXwXxu3qkTXDzy57W5vAmDTBw==", + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.9.tgz", + "integrity": "sha512-Aooyr6MXU6HpvvWXKoVoXwKMs/KyVakWwg7xQfv5/S/RIgJMy0Ifa45H9qqYy7pTCszrHzP21Uk4PZq2HpEM8Q==", "funding": [ { "type": "github", @@ -12951,7 +12949,7 @@ "nanoid": "bin/nanoid.js" }, "engines": { - "node": "^14 || ^16 || >=18" + "node": "^18 || >=20" } }, "node_modules/natural-compare": { @@ -13378,16 +13376,16 @@ } }, "node_modules/p-queue": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-7.4.1.tgz", - "integrity": "sha512-vRpMXmIkYF2/1hLBKisKeVYJZ8S2tZ0zEAmIJgdVKP2nq0nh4qCdf8bgw+ZgKrkh71AOCaqzwbJJk1WtdcF3VA==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-8.0.1.tgz", + "integrity": "sha512-NXzu9aQJTAzbBqOt2hwsR63ea7yvxJc0PwN/zobNAudYfb1B7R08SzB4TsLeSbUCuG467NhnoT0oO6w1qRO+BA==", "license": "MIT", "dependencies": { "eventemitter3": "^5.0.1", - "p-timeout": "^5.0.2" + "p-timeout": "^6.1.2" }, "engines": { - "node": ">=12" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -13411,12 +13409,12 @@ } }, "node_modules/p-timeout": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-5.1.0.tgz", - "integrity": "sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==", + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.4.tgz", + "integrity": "sha512-MyIV3ZA/PmyBN/ud8vV9XzwTrNtR4jFrObymZYnZqMmW0zA8Z17vnT0rBgFE/TlohB+YCHqXMgZzb3Csp49vqg==", "license": "MIT", "engines": { - "node": ">=12" + "node": ">=14.16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -13565,9 +13563,9 @@ "license": "ISC" }, "node_modules/path-to-regexp": { - "version": "0.1.10", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", - "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==", + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", "dev": true, "license": "MIT" }, @@ -15397,9 +15395,9 @@ "license": "MIT" }, "node_modules/postcss/node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "funding": [ { "type": "github", @@ -16842,6 +16840,12 @@ "node": ">=8" } }, + "node_modules/shallow-equal": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/shallow-equal/-/shallow-equal-3.1.0.tgz", + "integrity": "sha512-pfVOw8QZIXpMbhBWvzBISicvToTiM5WBF1EeAUZDDSb5Dt29yl4AYbyywbJFSEsRUMr7gJaxqCdr4L3tQf9wVg==", + "license": "MIT" + }, "node_modules/shallowequal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/shallowequal/-/shallowequal-1.1.0.tgz", @@ -17953,9 +17957,9 @@ } }, "node_modules/testcafe-browser-tools/node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "dev": true, "funding": [ { @@ -18118,9 +18122,9 @@ "license": "MIT" }, "node_modules/testcafe-hammerhead/node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "dev": true, "funding": [ { @@ -18675,9 +18679,9 @@ } }, "node_modules/testcafe/node_modules/nanoid": { - "version": "3.3.7", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", - "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", "dev": true, "funding": [ { @@ -19391,6 +19395,15 @@ "node": ">=8" } }, + "node_modules/use-sync-external-store": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.4.0.tgz", + "integrity": "sha512-9WXSPC5fMv61vaupRkCKCxsPxBocVnwakBEkMIHHpkTTg6icbJtg6jzgtLDm4bl3cSHAca52rYWih0k4K3PfHw==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, "node_modules/utf8-byte-length": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.5.tgz", diff --git a/package.json b/package.json index 8112e8f4..e37f2962 100644 --- a/package.json +++ b/package.json @@ -88,14 +88,14 @@ "@tailwindcss/aspect-ratio": "^0.4.0", "@tailwindcss/forms": "^0.5.9", "@tanstack/react-query": "^5.61.0", - "@uppy/core": "^3.13.1", - "@uppy/dashboard": "^3.9.1", - "@uppy/drag-drop": "^3.1.1", - "@uppy/file-input": "^3.1.0", - "@uppy/image-editor": "^2.4.6", - "@uppy/progress-bar": "^3.1.1", - "@uppy/react": "^3.4.0", - "@uppy/xhr-upload": "^3.6.8", + "@uppy/core": "^4.4.0", + "@uppy/dashboard": "^4.3.0", + "@uppy/drag-drop": "^4.1.0", + "@uppy/file-input": "^4.1.0", + "@uppy/image-editor": "^3.3.0", + "@uppy/progress-bar": "^4.2.0", + "@uppy/react": "^4.2.0", + "@uppy/xhr-upload": "^4.3.0", "autoprefixer": "^10.4.20", "babel-loader": "^9.2.1", "clean-webpack-plugin": "^4.0.0", diff --git a/src/common/dataHooks/useCreateUppy.js b/src/common/dataHooks/useCreateUppy.js index c23f866d..053c53e2 100644 --- a/src/common/dataHooks/useCreateUppy.js +++ b/src/common/dataHooks/useCreateUppy.js @@ -1,3 +1,4 @@ +import { useState } from 'react' import PropTypes from 'prop-types' import Uppy from '@uppy/core' import XHR from '@uppy/xhr-upload' @@ -15,6 +16,7 @@ import { getAuthHeaderIfTokenExists } from 'common/utils/authHelpers' import api from 'services/api' import { getFileExtensions } from 'common/utils/stringHelpers' import { getPathForMediaType } from 'common/utils/mediaHelpers' +import { useSiteStore } from 'context/SiteContext' import { TYPE_IMAGE, TYPE_VIDEO, @@ -22,7 +24,9 @@ import { SUPPORTED_VIDEO_EXTENSIONS, } from 'common/constants' -function useCreateUppy(site, maxItems, setSelectedMedia, type) { +function useCreateUppy({ maxItems, setSelectedMedia, type }) { + const { site } = useSiteStore() + const extensionList = type === TYPE_IMAGE ? SUPPORTED_IMAGE_EXTENSIONS @@ -30,87 +34,85 @@ function useCreateUppy(site, maxItems, setSelectedMedia, type) { const mediaTypePath = getPathForMediaType(type) - const uppy = new Uppy({ - id: 'mediaUpload', - autoProceed: false, - allowMultipleUploadBatches: true, - restrictions: { - maxNumberOfFiles: maxItems, - requiredMetaFields: ['title'], - }, - // eslint-disable-next-line no-unused-vars - onBeforeFileAdded: (currentFile, _files) => { - if (!extensionList.includes(getFileExtensions(currentFile.name))) { - uppy.info( - { - message: `Unsupported file type. Please upload media with the extension ${extensionList.join( - ', ', - )}`, - details: - 'File couldn’t be uploaded because it was of unsupported type.', - }, - 'error', - 5000, - ) - return false - } - return true - }, - }) - - uppy.on('file-added', (file) => { - uppy.setFileMeta(file.id, { - ...file.meta, - title: file.name, + // IMPORTANT: passing an initializer function to prevent Uppy from being reinstantiated on every render. + const [uppy] = useState(() => + new Uppy({ + id: 'mediaUpload', + autoProceed: false, + allowMultipleUploadBatches: true, + restrictions: { + maxNumberOfFiles: maxItems, + requiredMetaFields: ['title'], + }, + // eslint-disable-next-line no-unused-vars + onBeforeFileAdded: (currentFile, _files) => { + if (!extensionList.includes(getFileExtensions(currentFile.name))) { + uppy.info( + { + message: `Unsupported file type. Please upload media with the extension ${extensionList.join( + ', ', + )}`, + details: + 'File couldn’t be uploaded because it was of unsupported type.', + }, + 'error', + 5000, + ) + return false + } + return true + }, }) - }) - - uppy.use(ImageEditor, { - id: 'ImageEditor', - quality: 0.8, - cropperOptions: { - aspectRatio: 1, - viewMode: 1, - background: false, - autoCropArea: 1, - responsive: true, - croppedCanvasOptions: {}, - }, - actions: { - revert: true, - rotate: true, - granularRotate: true, - flip: true, - zoomIn: true, - zoomOut: true, - cropSquare: true, - cropWidescreen: true, - cropWidescreenVertical: true, - }, - }) - - uppy.use(XHR, { - endpoint: api.media.getUploadEndpoint(site?.sitename, mediaTypePath), - fieldName: 'original', - formData: true, - headers: getAuthHeaderIfTokenExists(), - getResponseData: (response) => { - const parsedResponse = JSON.parse(response) - setSelectedMedia((oldArray) => [...oldArray, parsedResponse]) - return { - url: parsedResponse?.url, - } - }, - }) + .use(ImageEditor, { + id: 'ImageEditor', + quality: 0.8, + cropperOptions: { + aspectRatio: 1, + viewMode: 1, + background: false, + autoCropArea: 1, + responsive: true, + croppedCanvasOptions: {}, + }, + actions: { + revert: true, + rotate: true, + granularRotate: true, + flip: true, + zoomIn: true, + zoomOut: true, + cropSquare: true, + cropWidescreen: true, + cropWidescreenVertical: true, + }, + }) + .use(XHR, { + endpoint: api.media.getUploadEndpoint(site?.sitename, mediaTypePath), + fieldName: 'original', + formData: true, + headers: getAuthHeaderIfTokenExists(), + async onAfterResponse(xhr) { + if (xhr?.status === 201) { + const parsedResponse = JSON.parse(xhr?.response) + setSelectedMedia((oldArray) => [...oldArray, parsedResponse]) + } + }, + }) + .on('file-added', (file) => { + uppy.setFileMeta(file.id, { + ...file.meta, + title: file.name, + }) + }), + ) return uppy } // PROPTYPES -const { func, number, oneOf, object } = PropTypes +const { func, number, oneOf } = PropTypes useCreateUppy.propTypes = { - site: object, type: oneOf([TYPE_IMAGE, TYPE_VIDEO]), setSelectedMedia: func, maxItems: number, diff --git a/src/components/UploadVisualMedia/UploadVisualMedia.js b/src/components/UploadVisualMedia/UploadVisualMedia.js index 23cabb0e..d5d0e1ea 100644 --- a/src/components/UploadVisualMedia/UploadVisualMedia.js +++ b/src/components/UploadVisualMedia/UploadVisualMedia.js @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react' +import React, { useEffect } from 'react' import PropTypes from 'prop-types' import { Dashboard } from '@uppy/react' @@ -12,14 +12,12 @@ import '@uppy/image-editor/dist/style.css' // FPCC import useCreateUppy from 'common/dataHooks/useCreateUppy' import { TYPE_IMAGE, TYPE_VIDEO } from 'common/constants' -import { useSiteStore } from 'context/SiteContext' -function UploadVisualMedia({ type, maxItems, setSelectedMedia }) { - const { site } = useSiteStore() +function UploadVisualMedia({ maxItems, setSelectedMedia, type }) { + const uppy = useCreateUppy({ maxItems, setSelectedMedia, type }) - const [uppy] = useState(useCreateUppy(site, maxItems, setSelectedMedia, type)) - - useEffect(() => () => uppy.close({ reason: 'unmount' }), [uppy]) + // Clean up - Clear state of uppy on unmount + useEffect(() => () => uppy.clear(), [uppy]) const baseMetaFields = [ { @@ -75,7 +73,6 @@ function UploadVisualMedia({ type, maxItems, setSelectedMedia }) { return (