import { v as i, h as a, T as n, i as s, j as l, S as r, x as u } from "./index-162fd1aa.mjs";
import e from "react";
import "./dateFns-2367ee5b.mjs";
import "./validator-61879ab7.mjs";
import "./reactPlayer-2f69f369.mjs";
import "react-router-dom";
import "./reactSlick-cb4a2d39.mjs";
class b extends e.Component {
  constructor(o) {
    super(o), this.notifyCancelAccountDeletionSuccess = async () => {
      i.push({
        type: a.success,
        element: /* @__PURE__ */ e.createElement(n, { i18nKey: "AccountDeletionNoticePage.cancelAccountDeletionSuccess" }, "The account deletion process has been cancelled. Please log in to continue."),
        autoDismiss: !0
      }), this.props.appState.clear();
    }, this.notifyCancelAccountDeletionError = (t) => {
      this.setState({
        alert: {
          type: a.danger,
          element: /* @__PURE__ */ e.createElement(s, { error: t })
        }
      });
    }, this.cancelDeletion = async () => {
      const { user: t } = this.props.appState.getUserManager().state;
      if (t)
        try {
          await this.logic.cancelDeleteAccount(t.userId), this.notifyCancelAccountDeletionSuccess(), await this.props.appState.logout();
        } catch (c) {
          this.notifyCancelAccountDeletionError(c);
        }
    }, this.continueDeletion = async () => {
      await this.props.appState.logout();
    }, this.logic = this.props.appState.getGdprManager(), this.logic.subscribe(() => this.setState({})), this.state = {
      alert: null
    };
  }
  render() {
    const { alert: o } = this.state, { isRequestingDeletion: t } = this.logic.state, c = 28;
    return /* @__PURE__ */ e.createElement("div", { className: "deletionNoticeContainer" }, /* @__PURE__ */ e.createElement("main", null, !!o && !t && /* @__PURE__ */ e.createElement(l, { type: o.type, className: "alert", onDismiss: () => this.setState({ alert: null }) }, o.element), /* @__PURE__ */ e.createElement("p", { className: "title" }, /* @__PURE__ */ e.createElement(n, { i18nKey: "AccountDeletionNoticePage.title" }, "Account deletion in-progress")), /* @__PURE__ */ e.createElement("div", { className: "content" }, /* @__PURE__ */ e.createElement(n, { i18nKey: "AccountDeletionNoticePage.content" }, "Your account will be deleted ", /* @__PURE__ */ e.createElement("strong", { className: "text-[color:rgb(var(--od-rgba-text))]" }, { deletionDays: c }, " days"), " after the day you requested for deletion. For more information, you can check your email related to the deletion request.")), /* @__PURE__ */ e.createElement("div", { className: "btnContainer" }, /* @__PURE__ */ e.createElement("button", { className: "btn big btnContinue", onClick: () => this.continueDeletion() }, /* @__PURE__ */ e.createElement(n, { i18nKey: "AccountDeletionNoticePage.button.keepDeleting" }, "Continue the Deletion")), /* @__PURE__ */ e.createElement("button", { className: "btn big btn-primary btnCancel", disabled: t, onClick: () => this.cancelDeletion() }, t && /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(r, { className: `${u.inline} spinner` }), /* @__PURE__ */ e.createElement(n, { i18nKey: "AccountDeletionNoticePage.form.processing" }, "Processing...")), !t && /* @__PURE__ */ e.createElement(n, { i18nKey: "AccountDeletionNoticePage.button.cancelDeletion" }, "Cancel Deletion")))));
  }
}
export {
  b as default
};
