Update sonner

This commit is contained in:
Anton Gunnarsson
2025-05-07 09:57:54 +02:00
parent 11c1810249
commit 83646d4d02
4 changed files with 16 additions and 23 deletions

View File

@@ -38,15 +38,12 @@ export function useGuaranteePaymentFailedToast() {
if (!errorCode || errorCode === BookingErrorCodeEnum.TransactionCancelled)
return
// setTimeout is needed to show toasts on page load: https://sonner.emilkowal.ski/toast#render-toast-on-page-load
setTimeout(() => {
const toastType =
errorCode === BookingErrorCodeEnum.TransactionCancelled
? "warning"
: "error"
const toastType =
errorCode === BookingErrorCodeEnum.TransactionCancelled
? "warning"
: "error"
toast[toastType](errorMessage)
toast[toastType](errorMessage)
})
const ancillary = searchParams.get("ancillary")
if ((errorCode && ancillary) || errorCode === "AncillaryFailed") {
return

View File

@@ -41,15 +41,11 @@ export function usePaymentFailedToast() {
useEffect(() => {
if (!errorCode) return
// setTimeout is needed to show toasts on page load: https://sonner.emilkowal.ski/toast#render-toast-on-page-load
setTimeout(() => {
const toastType =
errorCode === BookingErrorCodeEnum.TransactionCancelled
? "warning"
: "error"
toast[toastType](errorMessage)
})
const toastType =
errorCode === BookingErrorCodeEnum.TransactionCancelled
? "warning"
: "error"
toast[toastType](errorMessage)
const queryParams = new URLSearchParams(searchParams.toString())
queryParams.delete("errorCode")

View File

@@ -104,7 +104,7 @@
"react-to-print": "^3.1.0",
"server-only": "^0.0.1",
"slugify": "^1.6.6",
"sonner": "^1.7.0",
"sonner": "^2.0.3",
"supercluster": "^8.0.1",
"superjson": "^2.2.2",
"usehooks-ts": "3.1.1",

View File

@@ -8304,7 +8304,7 @@ __metadata:
schema-dts: "npm:^1.1.5"
server-only: "npm:^0.0.1"
slugify: "npm:^1.6.6"
sonner: "npm:^1.7.0"
sonner: "npm:^2.0.3"
start-server-and-test: "npm:^2.0.11"
supercluster: "npm:^8.0.1"
superjson: "npm:^2.2.2"
@@ -22222,13 +22222,13 @@ __metadata:
languageName: node
linkType: hard
"sonner@npm:^1.7.0":
version: 1.7.4
resolution: "sonner@npm:1.7.4"
"sonner@npm:^2.0.3":
version: 2.0.3
resolution: "sonner@npm:2.0.3"
peerDependencies:
react: ^18.0.0 || ^19.0.0 || ^19.0.0-rc
react-dom: ^18.0.0 || ^19.0.0 || ^19.0.0-rc
checksum: 10c0/2856a43c1afaacec5ca74c7f6bb8eb439edf1fdadb045bd201590f809e6e9b711eabcf7d1e8f3448cf414e1333d97e3e16372a989011a3190f20952947b1f60a
checksum: 10c0/59f84142f7a692dd1ec90e6df2003a70ff0b325eaef1d5dd17ad250e7f992b71053824f1a7ab3912f8c4caa5ce30523a096b5f5108b3e8ae13f906048691aca1
languageName: node
linkType: hard