
/**
 *   VERSION: 2.239.0-alpha.0
 *   BUILD_TIMESTAMP: 1780012993002
 *   BUILD_DATE: Fri May 29 2026 00:03:13 GMT+0000 (Coordinated Universal Time)
 *   BUILD_COMMIT: 3344b6c0fd9fa858907db310cfb1ef5e0d224da2
 */
import { R as n, v as _, U as C, W as w, j as e, L as y, M as V, F as a, i as v, l as g, V as f, n as T, X as A } from "../sheerid.js";
const P = 1e4, I = ({ intl: o, verificationService: s }) => {
  const t = s.verificationResponse, { programId: h } = s, { verificationId: d } = t, { canResendEmailLoop: L } = t, x = t.cancelUrl, i = s.viewModel, m = s.previousViewModel || void 0, M = s.previousVerificationResponse || void 0, [c, p] = n.useState(""), r = _(() => m.email), b = () => {
    g.info("StepEmailLoopComponent submitting form"), s.submitStep(
      f.emailLoop,
      i,
      s.verificationResponse
    );
  };
  n.useEffect(() => {
    C(s);
  }, []), n.useEffect(() => {
    i.emailToken && b();
  }, [i.emailToken]), w(() => {
    s.fetchExistingVerificationRequest(
      h,
      d,
      M,
      m,
      !1
    );
  }, P);
  const j = async (l) => {
    const u = await A.getResendNewEmailCode(l);
    if (u) {
      const k = {
        id: "step.emailLoop.successResend",
        defaultMessage: "Email re-sent successfully."
      }, R = {
        id: "step.emailLoop.errors.resend",
        defaultMessage: "Error sending email"
      }, N = u.status === 204 ? o.formatHTMLMessage(k) : o.formatHTMLMessage(R);
      p(N);
    } else
      p(
        o.formatHTMLMessage({
          id: "step.emailLoop.errors.resend",
          defaultMessage: "Error sending email"
        })
      );
  }, E = async () => {
    g.info("StepEmailLoopComponent submitting form after skipping email loop");
    const l = T(i, () => {
    });
    s.submitStep(
      f.cancelEmailLoop,
      l,
      s.verificationResponse
    );
  };
  return /* @__PURE__ */ e.jsxs("div", { className: "sid-header sid-l-horz-center", children: [
    /* @__PURE__ */ e.jsx("div", { className: "sid-email-loop-logo-container sid-l-horz-center", children: /* @__PURE__ */ e.jsx(
      y,
      {
        verificationService: s,
        fallbackLogo: /* @__PURE__ */ e.jsx(
          "img",
          {
            className: "sid-email-loop-logo sid-l-lead-image",
            alt: "",
            src: "https://assets-resources.sheerid.com/common/images/2018/icons/doc-pending.svg"
          }
        )
      }
    ) }),
    /* @__PURE__ */ e.jsx(V, { align: "center", children: /* @__PURE__ */ e.jsx(
      a,
      {
        id: "step.emailLoop.title",
        defaultMessage: "Check your email",
        tagName: "h1"
      }
    ) }),
    /* @__PURE__ */ e.jsx("div", { className: "sid-header__subtitle", children: r ? /* @__PURE__ */ e.jsx(
      a,
      {
        id: "step.emailLoop.subtitleWithEmail",
        defaultMessage: "An email has been sent to {email} with a personalized link to complete the verification process.",
        values: { email: r }
      }
    ) : /* @__PURE__ */ e.jsx(
      a,
      {
        id: "step.emailLoop.subtitleWithoutEmail",
        defaultMessage: "An email has been sent to your email account with a personalized link to complete the verification process."
      }
    ) }),
    /* @__PURE__ */ e.jsx("div", { className: "sid-l-space-top-md" }),
    /* @__PURE__ */ e.jsx("div", { className: "sid-header__subtitle-two sid-l-space-top-md", children: /* @__PURE__ */ e.jsx(
      a,
      {
        id: "step.emailLoop.subtitle2",
        defaultMessage: "Please check for an email from us (verify@sheerid.com) for all the details."
      }
    ) }),
    x && /* @__PURE__ */ e.jsxs("div", { className: "sid-skip-email sid-l-space-top-lg", children: [
      /* @__PURE__ */ e.jsx(
        a,
        {
          id: "step.emailLoop.skipEmail",
          defaultMessage: "Unable to retrieve this email? Click "
        }
      ),
      " ",
      /* @__PURE__ */ e.jsx(
        "button",
        {
          type: "button",
          onClick: () => E(),
          className: "sid-incorrect-number__refresh-link sid-h-btn-link-like",
          children: /* @__PURE__ */ e.jsx(a, { id: "step.emailLoop.skipEmailCTA", defaultMessage: "here" })
        }
      ),
      " ",
      /* @__PURE__ */ e.jsx(a, { id: "step.emailLoop.skipEmail2", defaultMessage: " to proceed." })
    ] }),
    L && /* @__PURE__ */ e.jsx("div", { className: "sid-header__resend-btn sid-l-space-top-md sid-submit sid-l-horz-center", children: /* @__PURE__ */ e.jsx(
      "button",
      {
        id: "sid-resend-email",
        onClick: () => j(d),
        type: "submit",
        className: "sid-btn sid-btn--light sid-resend-email-btn sid-submit__cancel",
        "aria-label": "re-send",
        children: /* @__PURE__ */ e.jsx(a, { id: "step.emailLoop.resendButton", defaultMessage: "Re-send" })
      }
    ) }),
    c && /* @__PURE__ */ e.jsx("div", { className: "sid-resent-email-loop-email-message", children: /* @__PURE__ */ e.jsx("p", { children: c }) }),
    /* @__PURE__ */ e.jsx("div", { className: "sid-l-space-top-xl" })
  ] });
}, z = v(I);
export {
  I as EmailLoopPending,
  z as EmailLoopPendingComponent,
  z as default
};
