@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
305 lines (303 loc) • 10.8 kB
JavaScript
/**
* VERSION: 2.130.0-alpha.4
* BUILD_TIMESTAMP: 1759000305348
* BUILD_DATE: Sat Sep 27 2025 19:11:45 GMT+0000 (Coordinated Universal Time)
* BUILD_COMMIT: be6ef87ab40e8747994d32363389cf39e36a4326
*/
import { i as X, h as $, R as h, ay as J, V as i, c as Q, l as W, az as Y, j as t, v as Z, P as _, w as S, x as v, T as aa, g as o, a3 as sa, ac as ea, f as d, aA as ta, aB as oa, W as la, y as da, z as na, X as ra, aC as ia, aD as ua, E as ma, e as pa, b as g, G as Ca, B as ba, a1 as ya, a6 as ha, a7 as ga, D as Ma, H as xa, M as Ia, I as ca, k as Da, n as ja, aE as Ea } from "../sheerid.js";
const Na = ({
intl: p,
verificationService: s
}) => {
var I, c, D, j, 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, K = S(), n = (a, r) => {
s.updateViewModel(
Ea(a, r, s, b)
);
}, U = () => {
const a = ja(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) && U(), 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 Q(
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: (c = o("status")) == null ? void 0 : c.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: (D = o("organization")) == null ? void 0 : D.disabled
}
),
/* @__PURE__ */ t.jsxs("div", { className: "sid-names", children: [
/* @__PURE__ */ t.jsx(
da,
{
value: e.firstName,
isErrored: !!l.firstName,
disabled: (j = o("firstName")) == null ? void 0 : j.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
}
),
K.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(ca, { suffix: "CollectAboveSubmit" }),
/* @__PURE__ */ t.jsx(
Da,
{
step: i.collectInactiveMilitaryPersonalInfo,
verificationService: s,
viewModel: e,
failedInstantMatch: H,
buttonText: /* @__PURE__ */ t.jsx(
g,
{
id: "step.personalInfo.submitButtonText",
defaultMessage: "Verify My Military Status"
}
)
}
)
] })
]
}
);
}, Fa = X(
Na
);
export {
Na as StepInactiveMilitaryPersonalInfo,
Fa as StepInactiveMilitaryPersonalInfoComponent,
Fa as default
};