UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

309 lines (307 loc) • 11 kB
/** * WARNING: This file is intended to be used within MySheerID. * This file is not intended for use in other contexts and there are no guarantees about its behavior outside of MySheerID. */ /** * VERSION: 2.113.0-alpha.0 * BUILD_TIMESTAMP: 1750184650058 * BUILD_DATE: Tue Jun 17 2025 18:24:10 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: 896154e79f58fffa6d52f3ed37f2db760a63df88 */ import { i as Q, h as $, R as h, ax as J, V as i, c as X, l as W, ay as Y, j as t, t as Z, P as _, v as S, w as v, Q as aa, g as o, a2 as sa, ab as ea, u as d, az as ta, aA as oa, U as la, x as da, y as na, W as ra, aB as ia, aC as ua, E as ma, e as pa, b as g, D as Ca, z as ba, a0 as ya, a5 as ha, a6 as ga, B as Ma, G as xa, M as Ia, H as Da, f as ja, m as ca, aD as Ea } from "../_mysheerid-preview.js"; const Na = ({ intl: p, verificationService: s }) => { var I, D, j, c, E, N, f, F, R, P, T, V, q, B, O, z, k, w, A; const e = s.viewModel, M = s.previousViewModel, { fieldValidationErrors: l } = s, C = s.verificationResponse, H = $(C), [m, x] = h.useState([]), b = J(s, p), y = e.localeChoice.value, U = S(), n = (a, r) => { s.updateViewModel( Ea(a, r, s, b) ); }, K = () => { const a = ca(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) && K(), h.useEffect(() => { (async () => { var a, r, L; if (s.verificationResponse.currentStep === i.collectInactiveMilitaryPersonalInfo && ((a = e.countryChoice) == null ? void 0 : a.value) === "US") try { const u = await X( C.verificationId, i.collectInactiveMilitaryPersonalInfo, e ); x((L = (r = u == null ? void 0 : u.fieldsToCollect) == null ? void 0 : r.optional) == null ? void 0 : L.map((G) => G.key)); } catch (u) { W.error( `Failed to determine fields to collect: ${u}`, i.collectInactiveMilitaryPersonalInfo ); } })(); }, [s.verificationResponse.currentStep, e.countryChoice]), h.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(v, { verificationService: s }), /* @__PURE__ */ t.jsx( aa, { verificationService: s, disabled: (I = o("country")) == null ? void 0 : I.disabled } ), b ? /* @__PURE__ */ t.jsx( sa, { segmentId: "military", value: { value: e.status, label: ea(p, e.status, ta) }, isErrored: !!l.status, errorId: "invalidMilitaryStatus", options: b, disabled: (D = o("status")) == null ? void 0 : D.disabled, onChange: (a) => { n("status", a ? a.value : ""), d( "status", a ? a.value : "", s ); } } ) : null, /* @__PURE__ */ t.jsx( oa, { isErrored: !!l.organization, onChange: (a) => { la(a, s), d("organization", a, s); }, value: { value: s.viewModel.organization.id, label: s.viewModel.organization.name }, verificationService: s, disabled: (j = o("organization")) == null ? void 0 : j.disabled } ), /* @__PURE__ */ t.jsxs("div", { className: "sid-names", children: [ /* @__PURE__ */ t.jsx( da, { 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( na, { 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( ra, { errorId: l.birthDate, locale: y, 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( ia, { errorId: l.activeDutyStartDate, locale: y, onChange: (a) => { n("activeDutyStartDate", a), d( "activeDutyStartDate", a, s ); }, value: e.activeDutyStartDate, disabled: (f = o("activeDutyStartDate")) == null ? void 0 : f.disabled } ), /* @__PURE__ */ t.jsx( ua, { errorId: l.dischargeDate, onChange: (a) => { n("dischargeDate", a), d("dischargeDate", a, s); }, value: e.dischargeDate, locale: y, disabled: (F = o("dischargeDate")) == null ? void 0 : F.disabled } ), /* @__PURE__ */ t.jsx( ma, { 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) => pa(a), disabled: (R = o("email")) == null ? void 0 : R.disabled } ), s.programTheme.isSmsNotifierConfigured || s.programTheme.smsLoopEnabled ? /* @__PURE__ */ t.jsx( Ca, { 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( ba, { value: e.address1, isErrored: !!l.address1, errorId: l.address1, disabled: (T = o("address1")) == null ? void 0 : T.disabled, onChange: (a) => { n("address1", a), d("address1", a, s); }, isRequired: (V = o("address1")) == null ? void 0 : V.requireIfOptional } ), m.includes("city") && /* @__PURE__ */ t.jsx( ya, { 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: (B = o("city")) == null ? void 0 : B.requireIfOptional } ), m.includes("state") && /* @__PURE__ */ t.jsx( ha, { options: ga(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: (O = o("state")) == null ? void 0 : O.disabled, isRequired: (z = o("state")) == null ? void 0 : z.requireIfOptional } ), m.includes("postalCode") && /* @__PURE__ */ t.jsx( Ma, { required: (k = o("postalCode")) == null ? void 0 : k.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(xa, { config: a, verificationService: s })), /* @__PURE__ */ t.jsx( Ia, { verificationService: s, isErrored: !!l.marketConsentValue, onChange: (a) => { n("metadata", { ...s.viewModel.metadata, marketConsentValue: a }), d( "marketConsentValue", a, s ); }, viewModel: e, disabled: (A = o("marketConsentValue")) == null ? void 0 : A.disabled } ), /* @__PURE__ */ t.jsx(Da, { verificationService: s, suffix: "CollectAboveSubmit" }), /* @__PURE__ */ t.jsx( ja, { step: i.collectInactiveMilitaryPersonalInfo, verificationService: s, viewModel: e, failedInstantMatch: H, buttonText: /* @__PURE__ */ t.jsx( g, { id: "step.personalInfo.submitButtonText", defaultMessage: "Verify My Military Status" } ) } ) ] }) ] } ); }, Fa = Q( Na ); export { Na as StepInactiveMilitaryPersonalInfo, Fa as StepInactiveMilitaryPersonalInfoComponent, Fa as default };