UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

306 lines (304 loc) • 10.3 kB
/** * VERSION: 2.154.0-alpha.1 * BUILD_TIMESTAMP: 1763401626706 * BUILD_DATE: Mon Nov 17 2025 17:47:06 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: 73f4468155aaed0f31ab0d59dc3394018b939b6d */ import { k as j, aA as E, V as i, l as x, aB as N, j as t, N as f, m as F, O as R, x as P, a2 as T, f as o, ae as V, ag as O, o as d, aC as q, a4 as B, T as k, U as z, a5 as A, aD as L, aE as w, E as W, n as U, Y as _, W as H, ac as K, au as $, av as G, X, Z as Y, _ as Z, $ as J, p as Q, r as S, aF as v, aG as aa } from "./es6-OV3Jb0XZ.js"; import y from "react"; import { injectIntl as ea, FormattedHTMLMessage as h } from "react-intl"; import { g as sa } from "./VerificationApiUtils-D1kGTZ4A.js"; const ta = ({ intl: m, verificationService: e }) => { const s = e.viewModel, g = e.previousViewModel, { fieldValidationErrors: l } = e, p = e.verificationResponse, I = j(p), [u, M] = y.useState([]), C = E(e, m), b = s.localeChoice.value, c = R(), n = (a, r) => { e.updateViewModel( v(a, r, e, C) ); }, D = () => { const a = S(s, () => { }); x.info("StepMilitaryStatusComponent submitting form"), e.submitStep( i.collectMilitaryStatus, a, e.previousVerificationResponse || e.verificationResponse ); }; return (s.status && g && g.status !== s.status || s.status && e.verificationResponse.currentStep === i.collectMilitaryStatus) && D(), y.useEffect(() => { (async () => { if (e.verificationResponse.currentStep === i.collectInactiveMilitaryPersonalInfo && s.countryChoice?.value === "US") try { const a = await sa( p.verificationId, i.collectInactiveMilitaryPersonalInfo, s ); M(a?.fieldsToCollect?.optional?.map((r) => r.key)); } catch (a) { x.error( `Failed to determine fields to collect: ${a}`, i.collectInactiveMilitaryPersonalInfo ); } })(); }, [e.verificationResponse.currentStep, s.countryChoice]), y.useEffect(() => { s.countryChoice?.value !== "US" && M([]); }, [s.countryChoice]), N(), /* @__PURE__ */ t.jsxs( f, { verificationService: e, step: p.currentStep, className: "sid-military-personal-info-container", children: [ /* @__PURE__ */ t.jsx( F, { verificationService: e, classNameIdentifier: "inactive-military-personal-info" } ), /* @__PURE__ */ t.jsxs(t.Fragment, { children: [ /* @__PURE__ */ t.jsx(P, { verificationService: e }), /* @__PURE__ */ t.jsx( T, { verificationService: e, disabled: o("country")?.disabled } ), C ? /* @__PURE__ */ t.jsx( V, { segmentId: "military", value: { value: s.status, label: O(m, s.status, aa) }, isErrored: !!l.status, errorId: "invalidMilitaryStatus", options: C, disabled: o("status")?.disabled, onChange: (a) => { n("status", a ? a.value : ""), d( "status", a ? a.value : "", e ); } } ) : null, /* @__PURE__ */ t.jsx( q, { isErrored: !!l.organization, onChange: (a) => { B(a, e), d("organization", a, e); }, value: { value: e.viewModel.organization.id, label: e.viewModel.organization.name }, verificationService: e, disabled: o("organization")?.disabled } ), /* @__PURE__ */ t.jsxs("div", { className: "sid-names", children: [ /* @__PURE__ */ t.jsx( k, { value: s.firstName, isErrored: !!l.firstName, disabled: o("firstName")?.disabled, onChange: (a) => { n("firstName", a), d("firstName", a, e); } } ), /* @__PURE__ */ t.jsx( z, { value: s.lastName, isErrored: !!l.lastName, disabled: o("lastName")?.disabled, onChange: (a) => { n("lastName", a), d("lastName", a, e); } } ) ] }), /* @__PURE__ */ t.jsx( A, { errorId: l.birthDate, locale: b, onChange: (a) => { n("birthDate", a), d("birthDate", a, e); }, value: s.birthDate, disabled: o("birthDate")?.disabled } ), e.programTheme.strictMilitaryValidationEnabled && /* @__PURE__ */ t.jsx( L, { errorId: l.activeDutyStartDate, locale: b, onChange: (a) => { n("activeDutyStartDate", a), d( "activeDutyStartDate", a, e ); }, value: s.activeDutyStartDate, disabled: o("activeDutyStartDate")?.disabled } ), /* @__PURE__ */ t.jsx( w, { mode: e.programTheme.transitionalMilitaryValidityDays ? "date" : "month", errorId: l.dischargeDate, onChange: (a) => { n("dischargeDate", a), d("dischargeDate", a, e); }, value: s.dischargeDate, locale: b, disabled: o("dischargeDate")?.disabled } ), /* @__PURE__ */ t.jsx( W, { value: s.email, isErrored: !!l.email, explanation: /* @__PURE__ */ t.jsx( h, { id: "emailExplanation", defaultMessage: "Personal email address is recommended" } ), onChange: (a) => { n("email", a), d("email", a, e); }, onKeyDown: (a) => U(a), disabled: o("email")?.disabled } ), e.programTheme.isSmsNotifierConfigured || e.programTheme.smsLoopEnabled ? /* @__PURE__ */ t.jsx( _, { isRequired: !!e.programTheme.smsLoopEnabled, value: s.phoneNumber, isErrored: !!l.phoneNumber, onChange: (a) => { n("phoneNumber", a), d("phoneNumber", a, e); }, selectedCountryCode: s.countryChoice && s.countryChoice.value, disabled: o("phoneNumber")?.disabled } ) : null, u.includes("address1") && /* @__PURE__ */ t.jsx( H, { value: s.address1, isErrored: !!l.address1, errorId: l.address1, disabled: o("address1")?.disabled, onChange: (a) => { n("address1", a), d("address1", a, e); }, isRequired: o("address1")?.requireIfOptional } ), u.includes("city") && /* @__PURE__ */ t.jsx( K, { value: s.city, isErrored: !!l.city, errorId: l.city, disabled: o("city")?.disabled, onChange: (a) => { n("city", a), d("city", a, e); }, isRequired: o("city")?.requireIfOptional } ), u.includes("state") && /* @__PURE__ */ t.jsx( $, { options: G(e.programTheme, m), value: s.state || void 0, isErrored: !!l.state, onChange: async (a) => { const r = a ? a.value : void 0; n("state", r), d("state", r, e); }, label: /* @__PURE__ */ t.jsx(h, { id: "state", defaultMessage: "State" }), disabled: o("state")?.disabled, isRequired: o("state")?.requireIfOptional } ), u.includes("postalCode") && /* @__PURE__ */ t.jsx( X, { required: o("postalCode")?.requireIfOptional, isErrored: !!l.postalCode, onChange: (a) => { n("postalCode", a), d("postalCode", a, e); }, value: s.postalCode, disabled: o("postalCode")?.disabled } ), c.customFormFields.map((a) => /* @__PURE__ */ t.jsx(Y, { config: a, verificationService: e })), /* @__PURE__ */ t.jsx( Z, { verificationService: e, isErrored: !!l.marketConsentValue, onChange: (a) => { n("metadata", { ...e.viewModel.metadata, marketConsentValue: a }), d( "marketConsentValue", a, e ); }, viewModel: s, disabled: o("marketConsentValue")?.disabled } ), /* @__PURE__ */ t.jsx(J, { verificationService: e, suffix: "CollectAboveSubmit" }), /* @__PURE__ */ t.jsx( Q, { step: i.collectInactiveMilitaryPersonalInfo, verificationService: e, viewModel: s, failedInstantMatch: I, buttonText: /* @__PURE__ */ t.jsx( h, { id: "step.personalInfo.submitButtonText", defaultMessage: "Verify My Military Status" } ) } ) ] }) ] } ); }, ra = ea( ta ); export { ta as StepInactiveMilitaryPersonalInfo, ra as StepInactiveMilitaryPersonalInfoComponent, ra as default };