try {
	let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
	n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "dc8c3b93-a05b-4921-a8da-e711cc3154d6", e._sentryDebugIdIdentifier = "sentry-dbid-dc8c3b93-a05b-4921-a8da-e711cc3154d6");
} catch (e) {}
import { r as useTranslation } from "./translation-DYpZlvOH.js";
import { t as Button } from "./Button-DOLNhJTG.js";
import { r as httpPost, s as useApiContext } from "./http-BN5CG8KV.js";
import { t as Header } from "./Header-Drk8jcMl.js";
import { t as useToastContext } from "./useToastContext-DDhNMXJE.js";
import { t as LoaderWrapper } from "./LoaderWrapper-B2xqWnWU.js";
import { t as Checkbox } from "./Checkbox-AGwtvVdU.js";
import { t as Spacer } from "./Spacer-CIwzVSSs.js";
import { useState } from "preact/hooks";
import { jsx, jsxs } from "preact/jsx-runtime";
import { useMutation } from "@tanstack/preact-query";
//#region src/api/legalEntity/useConfirmReview.ts
var confirmReview = async (legalEntityId, baseUrl) => {
	return httpPost({
		baseUrl,
		path: `legalEntities/${legalEntityId}/confirmDataReview`
	});
};
var useConfirmReview = (options) => {
	const { rootLegalEntityId, baseUrl } = useApiContext();
	return useMutation({
		mutationFn: () => {
			return confirmReview(rootLegalEntityId.value, baseUrl.value);
		},
		...options
	});
};
//#endregion
//#region src/components/Shared/tasks/Review/Review.tsx
function Review({ handleHomeClick }) {
	const { t } = useTranslation("common");
	const [loadingStatus, setLoadingStatus] = useState();
	const { showToast } = useToastContext();
	const [hasConfirmed, setHasConfirmed] = useState(false);
	const content = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(LoaderWrapper, {
		status: loadingStatus,
		formOpacityWhenLoading: .3,
		showSpinner: false,
		children: [
			/* @__PURE__ */ jsx(Header, { title: t(($) => $["submitReviewOfYourData"]) }),
			/* @__PURE__ */ jsx("span", { children: t(($) => $["pleaseNote"]) }),
			/* @__PURE__ */ jsx("br", {}),
			/* @__PURE__ */ jsx("br", {}),
			/* @__PURE__ */ jsx(Checkbox, {
				id: "review-checkbox",
				checked: hasConfirmed,
				onChange: setHasConfirmed,
				label: t(($) => $["byClickingSubmitReview"]),
				name: "confirmReviewData"
			})
		]
	}) });
	const { mutateAsync: confirmReview } = useConfirmReview();
	const onConfirmClick = async () => {
		try {
			setLoadingStatus("loading");
			await confirmReview();
			setLoadingStatus("success");
			showToast({
				label: t(($) => $["submitSuccessful"]),
				variant: "success"
			});
			handleHomeClick();
		} catch {
			showToast({
				label: t(($) => $["submitFailed"]),
				variant: "error"
			});
		} finally {
			setLoadingStatus("success");
		}
	};
	return /* @__PURE__ */ jsxs("div", { children: [
		content,
		" ",
		/* @__PURE__ */ jsxs("div", {
			class: "adyen-kyc-u-display-flex adyen-kyc-u-margin-top-48",
			children: [
				/* @__PURE__ */ jsx(Button, {
					variant: "secondary",
					onClick: handleHomeClick,
					children: t(($) => $["goToOverview"])
				}),
				/* @__PURE__ */ jsx(Spacer, {}),
				/* @__PURE__ */ jsx(Button, {
					onClick: onConfirmClick,
					disabled: !hasConfirmed,
					children: t(($) => $["submitReview"])
				})
			]
		})
	] });
}
//#endregion
export { Review };
