export function handleErrorResult(result, ui, state) {
    if (result.type === "error") {
        console.log("show error toast", result);
        ui.showErrorToast({
            summary: result.summary || "Error",
            details: result.details || "An error occurred",
        });
        return true;
    }
    if (result.type === "unauthorized") {
        if (result.summary === "Session revoked") {
            window.dispatchEvent(new CustomEvent("parhelia:session-revoked", {
                detail: { reason: result.details || "session-revoked" },
            }));
            return true;
        }
        if (state.configuration.events.onUnauthorized) {
            state.configuration.events.onUnauthorized();
            return true;
        }
        ui.confirmationDialogRef.current?.confirm({
            header: "Not logged in",
            message: "You are not logged in anymore. Proceed to login page?",
            accept: () => {
                window.location.href = "/sitecore/login";
            },
        });
        ui.showErrorToast({
            summary: result.summary || "Error",
            details: result.details || "An error occurred",
        });
        return true;
    }
}
//# sourceMappingURL=helpers.js.map