UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

308 lines (306 loc) • 11 kB
/** * VERSION: 2.113.0-alpha.0 * BUILD_TIMESTAMP: 1750184680813 * BUILD_DATE: Tue Jun 17 2025 18:24:40 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: 896154e79f58fffa6d52f3ed37f2db760a63df88 */ import { k as J, aI as X, V as i, l as W, aJ as Y, j as t, M as Z, m as $, N as G, w as Q, a1 as S, f as o, ab as v, ap as aa, u as d, aK as sa, a3 as ea, O as ta, T as oa, a4 as la, aL as da, aM as na, E as ra, n as ia, X as ua, U as ma, a9 as pa, ai as Ca, aj as ba, W as ha, Y as ya, Z as ga, _ as Ma, o as xa, q as Ia, aN as ja, aO as Da } from "./es6-B9qAIX4x.js"; import y from "react"; import { injectIntl as ca, FormattedHTMLMessage as g } from "react-intl"; import { g as Ea } from "./VerificationApiUtils-BRTuXm1B.js"; const Na = ({ intl: p, verificationService: s }) => { var I, j, D, c, E, N, f, F, R, P, O, T, q, V, k, B, L, w, z; const e = s.viewModel, M = s.previousViewModel, { fieldValidationErrors: l } = s, C = s.verificationResponse, K = J(C), [m, x] = y.useState([]), b = X(s, p), h = e.localeChoice.value, U = G(), n = (a, r) => { s.updateViewModel( ja(a, r, s, b) ); }, _ = () => { const a = Ia(e, () => { }); W.info("StepMilitaryStatusComponent submitting form"), s.submitStep( i.collectMilitaryStatus, a, s.previousVerificationResponse || s.verificationResponse ); }; return (e.status && M && M.status !== e.status || e.status && s.verificationResponse.currentStep === i.collectMilitaryStatus) && _(), y.useEffect(() => { (async () => { var a, r, A; if (s.verificationResponse.currentStep === i.collectInactiveMilitaryPersonalInfo && ((a = e.countryChoice) == null ? void 0 : a.value) === "US") try { const u = await Ea( C.verificationId, i.collectInactiveMilitaryPersonalInfo, e ); x((A = (r = u == null ? void 0 : u.fieldsToCollect) == null ? void 0 : r.optional) == null ? void 0 : A.map((H) => H.key)); } catch (u) { W.error( `Failed to determine fields to collect: ${u}`, i.collectInactiveMilitaryPersonalInfo ); } })(); }, [s.verificationResponse.currentStep, e.countryChoice]), y.useEffect(() => { var a; ((a = e.countryChoice) == null ? void 0 : a.value) !== "US" && x([]); }, [e.countryChoice]), Y(), /* @__PURE__ */ t.jsxs( Z, { verificationService: s, step: C.currentStep, className: "sid-military-personal-info-container", children: [ /* @__PURE__ */ t.jsx( $, { verificationService: s, classNameIdentifier: "inactive-military-personal-info" } ), /* @__PURE__ */ t.jsxs(t.Fragment, { children: [ /* @__PURE__ */ t.jsx(Q, { verificationService: s }), /* @__PURE__ */ t.jsx( S, { verificationService: s, disabled: (I = o("country")) == null ? void 0 : I.disabled } ), b ? /* @__PURE__ */ t.jsx( v, { segmentId: "military", value: { value: e.status, label: aa(p, e.status, Da) }, isErrored: !!l.status, errorId: "invalidMilitaryStatus", options: b, disabled: (j = o("status")) == null ? void 0 : j.disabled, onChange: (a) => { n("status", a ? a.value : ""), d( "status", a ? a.value : "", s ); } } ) : null, /* @__PURE__ */ t.jsx( sa, { isErrored: !!l.organization, onChange: (a) => { ea(a, s), d("organization", a, s); }, value: { value: s.viewModel.organization.id, label: s.viewModel.organization.name }, verificationService: s, disabled: (D = o("organization")) == null ? void 0 : D.disabled } ), /* @__PURE__ */ t.jsxs("div", { className: "sid-names", children: [ /* @__PURE__ */ t.jsx( ta, { value: e.firstName, isErrored: !!l.firstName, disabled: (c = o("firstName")) == null ? void 0 : c.disabled, onChange: (a) => { n("firstName", a), d("firstName", a, s); } } ), /* @__PURE__ */ t.jsx( oa, { value: e.lastName, isErrored: !!l.lastName, disabled: (E = o("lastName")) == null ? void 0 : E.disabled, onChange: (a) => { n("lastName", a), d("lastName", a, s); } } ) ] }), /* @__PURE__ */ t.jsx( la, { errorId: l.birthDate, locale: h, onChange: (a) => { n("birthDate", a), d("birthDate", a, s); }, value: e.birthDate, disabled: (N = o("birthDate")) == null ? void 0 : N.disabled } ), s.programTheme.strictMilitaryValidationEnabled && /* @__PURE__ */ t.jsx( da, { errorId: l.activeDutyStartDate, locale: h, onChange: (a) => { n("activeDutyStartDate", a), d( "activeDutyStartDate", a, s ); }, value: e.activeDutyStartDate, disabled: (f = o("activeDutyStartDate")) == null ? void 0 : f.disabled } ), /* @__PURE__ */ t.jsx( na, { errorId: l.dischargeDate, onChange: (a) => { n("dischargeDate", a), d("dischargeDate", a, s); }, value: e.dischargeDate, locale: h, disabled: (F = o("dischargeDate")) == null ? void 0 : F.disabled } ), /* @__PURE__ */ t.jsx( ra, { value: e.email, isErrored: !!l.email, explanation: /* @__PURE__ */ t.jsx( g, { id: "emailExplanation", defaultMessage: "Personal email address is recommended" } ), onChange: (a) => { n("email", a), d("email", a, s); }, onKeyDown: (a) => ia(a), disabled: (R = o("email")) == null ? void 0 : R.disabled } ), s.programTheme.isSmsNotifierConfigured || s.programTheme.smsLoopEnabled ? /* @__PURE__ */ t.jsx( ua, { isRequired: !!s.programTheme.smsLoopEnabled, value: e.phoneNumber, isErrored: !!l.phoneNumber, onChange: (a) => { n("phoneNumber", a), d("phoneNumber", a, s); }, selectedCountryCode: e.countryChoice && e.countryChoice.value, disabled: (P = o("phoneNumber")) == null ? void 0 : P.disabled } ) : null, m.includes("address1") && /* @__PURE__ */ t.jsx( ma, { value: e.address1, isErrored: !!l.address1, errorId: l.address1, disabled: (O = o("address1")) == null ? void 0 : O.disabled, onChange: (a) => { n("address1", a), d("address1", a, s); }, isRequired: (T = o("address1")) == null ? void 0 : T.requireIfOptional } ), m.includes("city") && /* @__PURE__ */ t.jsx( pa, { value: e.city, isErrored: !!l.city, errorId: l.city, disabled: (q = o("city")) == null ? void 0 : q.disabled, onChange: (a) => { n("city", a), d("city", a, s); }, isRequired: (V = o("city")) == null ? void 0 : V.requireIfOptional } ), m.includes("state") && /* @__PURE__ */ t.jsx( Ca, { options: ba(s.programTheme, p), value: e.state || void 0, isErrored: !!l.state, onChange: async (a) => { const r = a ? a.value : void 0; n("state", r), d("state", r, s); }, label: /* @__PURE__ */ t.jsx(g, { id: "state", defaultMessage: "State" }), disabled: (k = o("state")) == null ? void 0 : k.disabled, isRequired: (B = o("state")) == null ? void 0 : B.requireIfOptional } ), m.includes("postalCode") && /* @__PURE__ */ t.jsx( ha, { required: (L = o("postalCode")) == null ? void 0 : L.requireIfOptional, isErrored: !!l.postalCode, onChange: (a) => { n("postalCode", a), d("postalCode", a, s); }, value: e.postalCode, disabled: (w = o("postalCode")) == null ? void 0 : w.disabled } ), U.customFormFields.map((a) => /* @__PURE__ */ t.jsx(ya, { config: a, verificationService: s })), /* @__PURE__ */ t.jsx( ga, { verificationService: s, isErrored: !!l.marketConsentValue, onChange: (a) => { n("metadata", { ...s.viewModel.metadata, marketConsentValue: a }), d( "marketConsentValue", a, s ); }, viewModel: e, disabled: (z = o("marketConsentValue")) == null ? void 0 : z.disabled } ), /* @__PURE__ */ t.jsx(Ma, { verificationService: s, suffix: "CollectAboveSubmit" }), /* @__PURE__ */ t.jsx( xa, { step: i.collectInactiveMilitaryPersonalInfo, verificationService: s, viewModel: e, failedInstantMatch: K, buttonText: /* @__PURE__ */ t.jsx( g, { id: "step.personalInfo.submitButtonText", defaultMessage: "Verify My Military Status" } ) } ) ] }) ] } ); }, Oa = ca( Na ); export { Na as StepInactiveMilitaryPersonalInfo, Oa as StepInactiveMilitaryPersonalInfoComponent, Oa as default };