@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
303 lines (301 loc) • 10.2 kB
JavaScript
/**
* VERSION: 2.154.0-alpha.1
* BUILD_TIMESTAMP: 1763401515326
* BUILD_DATE: Mon Nov 17 2025 17:45:15 GMT+0000 (Coordinated Universal Time)
* BUILD_COMMIT: 73f4468155aaed0f31ab0d59dc3394018b939b6d
*/
import { i as D, h as E, R as y, ap as N, V as i, d as F, l as x, aq as R, j as t, x as f, P, y as T, z as V, Y as q, a as o, a9 as O, ab as k, k as d, ar as B, as as z, _ as L, B as w, D as A, $ as H, at as K, au as W, E as U, f as $, c as h, J as G, G as J, a7 as Y, aj as _, ak as Q, H as X, K as Z, M as S, N as v, m as aa, o as sa, av as ea } from "../sheerid.js";
const ta = ({
intl: m,
verificationService: s
}) => {
const e = s.viewModel, g = s.previousViewModel, { fieldValidationErrors: l } = s, p = s.verificationResponse, I = E(p), [u, M] = y.useState([]), C = N(s, m), b = e.localeChoice.value, c = T(), n = (a, r) => {
s.updateViewModel(
ea(a, r, s, C)
);
}, j = () => {
const a = sa(e, () => {
});
x.info("StepMilitaryStatusComponent submitting form"), s.submitStep(
i.collectMilitaryStatus,
a,
s.previousVerificationResponse || s.verificationResponse
);
};
return (e.status && g && g.status !== e.status || e.status && s.verificationResponse.currentStep === i.collectMilitaryStatus) && j(), y.useEffect(() => {
(async () => {
if (s.verificationResponse.currentStep === i.collectInactiveMilitaryPersonalInfo && e.countryChoice?.value === "US")
try {
const a = await F(
p.verificationId,
i.collectInactiveMilitaryPersonalInfo,
e
);
M(a?.fieldsToCollect?.optional?.map((r) => r.key));
} catch (a) {
x.error(
`Failed to determine fields to collect: ${a}`,
i.collectInactiveMilitaryPersonalInfo
);
}
})();
}, [s.verificationResponse.currentStep, e.countryChoice]), y.useEffect(() => {
e.countryChoice?.value !== "US" && M([]);
}, [e.countryChoice]), R(), /* @__PURE__ */ t.jsxs(
f,
{
verificationService: s,
step: p.currentStep,
className: "sid-military-personal-info-container",
children: [
/* @__PURE__ */ t.jsx(
P,
{
verificationService: s,
classNameIdentifier: "inactive-military-personal-info"
}
),
/* @__PURE__ */ t.jsxs(t.Fragment, { children: [
/* @__PURE__ */ t.jsx(V, { verificationService: s }),
/* @__PURE__ */ t.jsx(
q,
{
verificationService: s,
disabled: o("country")?.disabled
}
),
C ? /* @__PURE__ */ t.jsx(
O,
{
segmentId: "military",
value: {
value: e.status,
label: k(m, e.status, B)
},
isErrored: !!l.status,
errorId: "invalidMilitaryStatus",
options: C,
disabled: o("status")?.disabled,
onChange: (a) => {
n("status", a ? a.value : ""), d(
"status",
a ? a.value : "",
s
);
}
}
) : null,
/* @__PURE__ */ t.jsx(
z,
{
isErrored: !!l.organization,
onChange: (a) => {
L(a, s), d("organization", a, s);
},
value: {
value: s.viewModel.organization.id,
label: s.viewModel.organization.name
},
verificationService: s,
disabled: o("organization")?.disabled
}
),
/* @__PURE__ */ t.jsxs("div", { className: "sid-names", children: [
/* @__PURE__ */ t.jsx(
w,
{
value: e.firstName,
isErrored: !!l.firstName,
disabled: o("firstName")?.disabled,
onChange: (a) => {
n("firstName", a), d("firstName", a, s);
}
}
),
/* @__PURE__ */ t.jsx(
A,
{
value: e.lastName,
isErrored: !!l.lastName,
disabled: o("lastName")?.disabled,
onChange: (a) => {
n("lastName", a), d("lastName", a, s);
}
}
)
] }),
/* @__PURE__ */ t.jsx(
H,
{
errorId: l.birthDate,
locale: b,
onChange: (a) => {
n("birthDate", a), d("birthDate", a, s);
},
value: e.birthDate,
disabled: o("birthDate")?.disabled
}
),
s.programTheme.strictMilitaryValidationEnabled && /* @__PURE__ */ t.jsx(
K,
{
errorId: l.activeDutyStartDate,
locale: b,
onChange: (a) => {
n("activeDutyStartDate", a), d(
"activeDutyStartDate",
a,
s
);
},
value: e.activeDutyStartDate,
disabled: o("activeDutyStartDate")?.disabled
}
),
/* @__PURE__ */ t.jsx(
W,
{
mode: s.programTheme.transitionalMilitaryValidityDays ? "date" : "month",
errorId: l.dischargeDate,
onChange: (a) => {
n("dischargeDate", a), d("dischargeDate", a, s);
},
value: e.dischargeDate,
locale: b,
disabled: o("dischargeDate")?.disabled
}
),
/* @__PURE__ */ t.jsx(
U,
{
value: e.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, s);
},
onKeyDown: (a) => $(a),
disabled: o("email")?.disabled
}
),
s.programTheme.isSmsNotifierConfigured || s.programTheme.smsLoopEnabled ? /* @__PURE__ */ t.jsx(
G,
{
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: o("phoneNumber")?.disabled
}
) : null,
u.includes("address1") && /* @__PURE__ */ t.jsx(
J,
{
value: e.address1,
isErrored: !!l.address1,
errorId: l.address1,
disabled: o("address1")?.disabled,
onChange: (a) => {
n("address1", a), d("address1", a, s);
},
isRequired: o("address1")?.requireIfOptional
}
),
u.includes("city") && /* @__PURE__ */ t.jsx(
Y,
{
value: e.city,
isErrored: !!l.city,
errorId: l.city,
disabled: o("city")?.disabled,
onChange: (a) => {
n("city", a), d("city", a, s);
},
isRequired: o("city")?.requireIfOptional
}
),
u.includes("state") && /* @__PURE__ */ t.jsx(
_,
{
options: Q(s.programTheme, m),
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(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, s);
},
value: e.postalCode,
disabled: o("postalCode")?.disabled
}
),
c.customFormFields.map((a) => /* @__PURE__ */ t.jsx(Z, { config: a, verificationService: s })),
/* @__PURE__ */ t.jsx(
S,
{
verificationService: s,
isErrored: !!l.marketConsentValue,
onChange: (a) => {
n("metadata", {
...s.viewModel.metadata,
marketConsentValue: a
}), d(
"marketConsentValue",
a,
s
);
},
viewModel: e,
disabled: o("marketConsentValue")?.disabled
}
),
/* @__PURE__ */ t.jsx(v, { verificationService: s, suffix: "CollectAboveSubmit" }),
/* @__PURE__ */ t.jsx(
aa,
{
step: i.collectInactiveMilitaryPersonalInfo,
verificationService: s,
viewModel: e,
failedInstantMatch: I,
buttonText: /* @__PURE__ */ t.jsx(
h,
{
id: "step.personalInfo.submitButtonText",
defaultMessage: "Verify My Military Status"
}
)
}
)
] })
]
}
);
}, la = D(
ta
);
export {
ta as StepInactiveMilitaryPersonalInfo,
la as StepInactiveMilitaryPersonalInfoComponent,
la as default
};