UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

135 lines (133 loc) 5.44 kB
/** * VERSION: 2.230.0-alpha.0 * BUILD_TIMESTAMP: 1778694684677 * BUILD_DATE: Wed May 13 2026 17:51:24 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: 7af1c105d5485ac4ed1190c56d492bb4590667a9 */ import { i as g, g as E, j as e, F as u, b as v, E as p, r as P, V as a, K as C, s as T, M as x, N as F, l as L } from "../sheerid.js"; import { F as h } from "./FormFieldText-CaWtYVur.js"; import { u as N, C as S, a as _ } from "./useMetrics-wq7yrL0b.js"; const j = ({ value: s, isErrored: t, onChange: o, explanation: r = "", intl: c, onKeyDown: d = () => { }, onBlur: m = () => { }, placeholder: n = "", disabled: b = !1 }) => E("email")?.hidden ? null : /* @__PURE__ */ e.jsx( h, { fieldId: "email", value: s, onChange: o, type: "email", autoComplete: "email", placeholder: n || c.formatHTMLMessage({ id: "emailAddressPlaceholder", defaultMessage: "Email" }), label: /* @__PURE__ */ e.jsx(u, { id: "emailAddress", defaultMessage: "Email address" }), errorMessage: t && /* @__PURE__ */ e.jsx(u, { id: "errorId.invalidEmail", defaultMessage: "Invalid email" }), explanation: r, showPlaceholderAndHideLabel: !!n, onKeyDown: (l) => d(l), onBlur: (l) => m(l), disabled: b } ), R = g(j), w = { collectStudentPersonalInfo: "sid-student--submit", collectSeniorPersonalInfo: "sid-senior-submit", collectTeacherPersonalInfo: "sid-teacher-submit", collectMoverPersonalInfo: "sid-mover-submit", collectInactiveMilitaryPersonalInfo: "sid-inactive-military-submit sid-military-submit", collectActiveMilitaryPersonalInfo: "sid-active-military-personal-submit sid-military-submit", collectMilitaryStatus: "", collectMemberPersonalInfo: "sid-member-submit", collectMedicalProfessionalPersonalInfo: "sid-medical-submit", collectLowIncomePersonalInfo: "sid-low-income-submit", collectLicensedProfessionalPersonalInfo: "sid-licensed-professional-submit", collectHybridIdentityPersonalInfo: "sid-hybrid-identity-submit", collectGeneralIdentityPersonalInfo: "sid-general-identity-submit", collectDriverLicensePersonalInfo: "sid-drivers-license-submit", collectFirstResponderPersonalInfo: "sid-first-responder-personal-info-submit", collectEmployeePersonalInfo: "sid-employment-submit", collectAgePersonalInfo: "sid-age-personal-info-submit", collectIdentifier: "sid-identifier-submit", collectPersonalInfo: "sid-personal-info-submit" }, A = { collectStudentPersonalInfo: "sid-student-submit-btn", collectSeniorPersonalInfo: "sid-senior-submit-btn", collectTeacherPersonalInfo: "sid-teacher-submit-btn", collectMoverPersonalInfo: "sid-mover-submit-btn", collectInactiveMilitaryPersonalInfo: "sid-inactive-military-submit-btn sid-military-submit-btn", collectActiveMilitaryPersonalInfo: "sid-active-military-personal-submit-btn sid-military-submit-btn", collectMilitaryStatus: "", collectMemberPersonalInfo: "sid-member-submit-btn", collectMedicalProfessionalPersonalInfo: "sid-medical-submit-btn", collectLowIncomePersonalInfo: "sid-low-income-submit-btn", collectLicensedProfessionalPersonalInfo: "sid-licensed-professional-submit-btn", collectHybridIdentityPersonalInfo: "sid-hybrid-identity-submit-btn", collectGeneralIdentityPersonalInfo: "sid-general-identity-submit-btn", collectDriverLicensePersonalInfo: "sid-drivers-license-submit-btn", collectFirstResponderPersonalInfo: "sid-first-responder-submit-btn", collectEmployeePersonalInfo: "sid-employment-submit-btn", collectAgePersonalInfo: "sid-age-personal-info-btn", collectIdentifier: "sid-identifier-submit-btn", collectPersonalInfo: "sid-personal-info-submit-btn" }, O = [ a.collectMoverPersonalInfo, a.collectStudentPersonalInfo, a.collectEmployeePersonalInfo ], U = ({ step: s, verificationService: t, viewModel: o, buttonText: r, failedInstantMatch: c = !1 }) => { const { userDidConvert: d, getTimeOnForm: m } = N({ segment: t.verificationResponse.segment, programId: t.programId }); v.useEffect(() => { const i = { eventName: p.COLLECT_STARTED, params: {} }; P(i); }, []); const n = () => { try { const i = { eventName: p.COLLECT_SUBMITTED, params: { [F.EVENT_DURATION]: m().duration } }; P(i); } catch { L.warn("Unable to measure time on form"); } d(S, _); }, b = w[s], f = A[s], l = O.includes(s) ? "sid-submit-wrapper__collect-info" : "sid-submit-btn-collect-info", y = c ? /* @__PURE__ */ e.jsx(u, { id: "tryAgain", defaultMessage: "Try Again" }) : r, M = s === a.collectEmployeePersonalInfo ? { className: "sid-employment-submit-btn__text" } : {}, I = !C(o, t.formValidationOptions); return /* @__PURE__ */ e.jsx("div", { className: "sid-form-region sid-submit-wrapper sid-l-space-top-md", children: /* @__PURE__ */ e.jsx("div", { className: `${b} sid-submit`, children: /* @__PURE__ */ e.jsx( "button", { id: l, onClick: () => x(o, t, s, n), type: "submit", className: `sid-btn ${f} sid-btn--dark sid-l-full-width ${I ? "sid-btn--disabled-like" : ""}`, "aria-labelledby": "verify-status-text", ref: (i) => T("submitButton", i), "aria-disabled": I, "data-testid": "submit-button", children: /* @__PURE__ */ e.jsx("span", { id: "verify-status-text", ...M, children: y }) } ) }) }); }; export { R as E, U as P };