Files
klz-cables.com/.pnpm-store/v10/files/de/929f66b4819fa08ce6a50c6ba83d8d4254b05b2115ddbfc201b18fc7c0032fee0f59ff8ce323edef50c8a22ac895efa6b4d0420e59b39d2f378ca1a4329fe6
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

112 lines
2.6 KiB
Plaintext

'use client';
import { c as _c } from "react/compiler-runtime";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Button, ConfirmationModal, toast, useConfig, useModal, useTranslation } from '@payloadcms/ui';
import { formatAdminURL } from 'payload/shared';
import * as qs from 'qs-esm';
import { Fragment, useCallback } from 'react';
const confirmResetModalSlug = 'confirm-reset-modal';
export const ResetPreferences = t0 => {
const $ = _c(9);
const {
user
} = t0;
const {
openModal
} = useModal();
const {
t
} = useTranslation();
const {
config: t1
} = useConfig();
const {
routes: t2
} = t1;
const {
api: apiRoute
} = t2;
let t3;
if ($[0] !== apiRoute || $[1] !== user) {
t3 = async () => {
if (!user) {
return;
}
const stringifiedQuery = qs.stringify({
depth: 0,
where: {
user: {
id: {
equals: user.id
}
}
}
}, {
addQueryPrefix: true
});
;
try {
const res = await fetch(formatAdminURL({
apiRoute,
path: `/payload-preferences${stringifiedQuery}`
}), {
credentials: "include",
headers: {
"Content-Type": "application/json"
},
method: "DELETE"
});
const json = await res.json();
const message = json.message;
if (res.ok) {
toast.success(message);
} else {
toast.error(message);
}
} catch (t4) {
const _err = t4;
}
};
$[0] = apiRoute;
$[1] = user;
$[2] = t3;
} else {
t3 = $[2];
}
const handleResetPreferences = t3;
let t4;
if ($[3] !== openModal) {
t4 = () => openModal(confirmResetModalSlug);
$[3] = openModal;
$[4] = t4;
} else {
t4 = $[4];
}
let t5;
if ($[5] !== handleResetPreferences || $[6] !== t || $[7] !== t4) {
t5 = _jsxs(Fragment, {
children: [_jsx("div", {
children: _jsx(Button, {
buttonStyle: "secondary",
onClick: t4,
children: t("general:resetPreferences")
})
}), _jsx(ConfirmationModal, {
body: t("general:resetPreferencesDescription"),
confirmingLabel: t("general:resettingPreferences"),
heading: t("general:resetPreferences"),
modalSlug: confirmResetModalSlug,
onConfirm: handleResetPreferences
})]
});
$[5] = handleResetPreferences;
$[6] = t;
$[7] = t4;
$[8] = t5;
} else {
t5 = $[8];
}
return t5;
};
//# sourceMappingURL=index.js.map