@sheerid/jslib 1.131.0 → 1.132.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/es5/Tmetrix.bundle.js +4 -4
  2. package/es5/messages_ar.bundle.js +4 -4
  3. package/es5/messages_bg.bundle.js +4 -4
  4. package/es5/messages_cs.bundle.js +4 -4
  5. package/es5/messages_da.bundle.js +4 -4
  6. package/es5/messages_de.bundle.js +4 -4
  7. package/es5/messages_el.bundle.js +4 -4
  8. package/es5/messages_en-GB.bundle.js +4 -4
  9. package/es5/messages_es-ES.bundle.js +4 -4
  10. package/es5/messages_es.bundle.js +4 -4
  11. package/es5/messages_fi.bundle.js +4 -4
  12. package/es5/messages_fr-CA.bundle.js +4 -4
  13. package/es5/messages_fr.bundle.js +4 -4
  14. package/es5/messages_ga.bundle.js +4 -4
  15. package/es5/messages_hr.bundle.js +4 -4
  16. package/es5/messages_hu.bundle.js +4 -4
  17. package/es5/messages_id.bundle.js +4 -4
  18. package/es5/messages_it.bundle.js +4 -4
  19. package/es5/messages_iw.bundle.js +4 -4
  20. package/es5/messages_ja.bundle.js +4 -4
  21. package/es5/messages_ko.bundle.js +4 -4
  22. package/es5/messages_lo.bundle.js +4 -4
  23. package/es5/messages_lt.bundle.js +4 -4
  24. package/es5/messages_ms.bundle.js +4 -4
  25. package/es5/messages_nl.bundle.js +4 -4
  26. package/es5/messages_no.bundle.js +4 -4
  27. package/es5/messages_pl.bundle.js +4 -4
  28. package/es5/messages_pt-BR.bundle.js +4 -4
  29. package/es5/messages_pt.bundle.js +4 -4
  30. package/es5/messages_ru.bundle.js +4 -4
  31. package/es5/messages_sk.bundle.js +4 -4
  32. package/es5/messages_sl.bundle.js +4 -4
  33. package/es5/messages_sr.bundle.js +4 -4
  34. package/es5/messages_sv.bundle.js +4 -4
  35. package/es5/messages_th.bundle.js +4 -4
  36. package/es5/messages_tr.bundle.js +4 -4
  37. package/es5/messages_zh-HK.bundle.js +4 -4
  38. package/es5/messages_zh.bundle.js +4 -4
  39. package/manifest.json +48 -48
  40. package/package.json +1 -1
  41. package/sheerid-requestOrg.css +5 -5
  42. package/sheerid-requestOrg.css.map +1 -1
  43. package/sheerid-requestOrg.js +10 -10
  44. package/sheerid-requestOrg.js.map +1 -1
  45. package/sheerid-utils.js +8 -8
  46. package/sheerid-utils.js.map +1 -1
  47. package/sheerid.css +5 -5
  48. package/sheerid.css.map +1 -1
  49. package/sheerid.js +16 -16
  50. package/sheerid.js.map +1 -1
  51. package/sheerides6.js +88 -133
  52. package/sheerides6.js.map +1 -1
  53. package/src/components/DateComponent/DateComponent.d.ts +14 -0
  54. package/src/components/FormFields/ActiveDutyStartDate/ActiveDutyStartDateComponent.d.ts +2 -0
  55. package/src/components/FormFields/BirthDate/BirthDateComponent.d.ts +1 -11
  56. package/src/components/FormFields/DischargeDate/DischargeDateComponent.d.ts +1 -11
  57. package/src/lib/types/runtimeTypes.d.ts +1 -0
  58. package/src/lib/types/types.d.ts +15 -3
  59. package/types-reference.zip +0 -0
package/sheerides6.js CHANGED
@@ -667,6 +667,7 @@ var FieldIdEnum;
667
667
  FieldIdEnum["country"] = "country";
668
668
  FieldIdEnum["state"] = "state";
669
669
  FieldIdEnum["dischargeDate"] = "dischargeDate";
670
+ FieldIdEnum["activeDutyStartDate"] = "activeDutyStartDate";
670
671
  FieldIdEnum["docUpload"] = "docUpload";
671
672
  FieldIdEnum["status"] = "status";
672
673
  FieldIdEnum["statuses"] = "statuses";
@@ -3538,6 +3539,7 @@ const activeMilitaryPInfoReqEmpty = {
3538
3539
  ...withLocaleAndCountryEmpty,
3539
3540
  ...withFieldsToSkipValidationEmpty,
3540
3541
  ...blankOrganization,
3542
+ activeDutyStartDate: "",
3541
3543
  birthDate: "",
3542
3544
  status: undefined,
3543
3545
  metadata: {
@@ -3550,6 +3552,7 @@ const inactiveMilitaryPInfoReqEmpty = {
3550
3552
  ...withLocaleAndCountryEmpty,
3551
3553
  ...withFieldsToSkipValidationEmpty,
3552
3554
  ...blankOrganization,
3555
+ activeDutyStartDate: "",
3553
3556
  birthDate: "",
3554
3557
  dischargeDate: "",
3555
3558
  status: undefined,
@@ -3720,6 +3723,7 @@ const initialErrorStructure = {
3720
3723
  city: undefined,
3721
3724
  country: undefined,
3722
3725
  state: undefined,
3726
+ activeDutyStartDate: undefined,
3723
3727
  dischargeDate: undefined,
3724
3728
  docUpload: undefined,
3725
3729
  status: undefined,
@@ -4542,20 +4546,36 @@ const getStateValidationError = (value) => {
4542
4546
  return invalidError;
4543
4547
  }
4544
4548
  };
4549
+ const existsAndIsValidDate = (value) => value !== undefined && isValidDateFormat(value) && isValidDate(value);
4550
+ const isBeforeBirthdate = (value, vm) => {
4551
+ const date = new Date(value);
4552
+ const birthDate = new Date(vm.birthDate);
4553
+ return date < birthDate;
4554
+ };
4545
4555
  const getDischargeDateValidationError = (value, formValidationOptions) => {
4546
- const invalidDischargeDate = "invalidDischargeDate";
4547
- const futureDischargeDate = "futureDischargeDate";
4548
- const dischargeDateBeforeBirthDate = "dischargeDateBeforeBirthDate";
4549
- if (value === undefined || !isValidDateFormat(value) || !isValidDate(value)) {
4550
- return invalidDischargeDate;
4556
+ if (!existsAndIsValidDate(value)) {
4557
+ return "invalidDischargeDate";
4558
+ }
4559
+ if (isFutureDate(value)) {
4560
+ return "futureDischargeDate";
4561
+ }
4562
+ if (isBeforeBirthdate(value, formValidationOptions.viewModel)) {
4563
+ return "dischargeDateBeforeBirthDate";
4564
+ }
4565
+ };
4566
+ const getActiveDutyStartDateValidationError = (value, formValidationOptions) => {
4567
+ if (!value && !formValidationOptions.strictMilitaryValidationEnabled) {
4568
+ // a falsey value is valid unless strictMilitaryValidation is enabled.
4569
+ return;
4570
+ }
4571
+ if (!existsAndIsValidDate(value)) {
4572
+ return "invalidActiveDutyStartDate";
4551
4573
  }
4552
4574
  if (isFutureDate(value)) {
4553
- return futureDischargeDate;
4575
+ return "futureActiveDutyStartDate";
4554
4576
  }
4555
- const dischargeDate = new Date(value);
4556
- const birthDate = new Date(formValidationOptions.viewModel.birthDate);
4557
- if (dischargeDate < birthDate) {
4558
- return dischargeDateBeforeBirthDate;
4577
+ if (isBeforeBirthdate(value, formValidationOptions.viewModel)) {
4578
+ return "activeDutyStartDateBeforeBirthDate";
4559
4579
  }
4560
4580
  };
4561
4581
  const getSsnValidationError = (value) => {
@@ -4780,6 +4800,9 @@ const validateFieldById = (fieldId, value, formValidationOptions) => {
4780
4800
  case FieldIdEnum.dischargeDate:
4781
4801
  defaultValidator = getDischargeDateValidationError;
4782
4802
  return getValidationError(fieldId, value, defaultValidator, overriddenValidator, formValidationOptions);
4803
+ case FieldIdEnum.activeDutyStartDate:
4804
+ defaultValidator = getActiveDutyStartDateValidationError;
4805
+ return getValidationError(fieldId, value, defaultValidator, overriddenValidator, formValidationOptions);
4783
4806
  case FieldIdEnum.socialSecurityNumber:
4784
4807
  defaultValidator = getSsnValidationError;
4785
4808
  return getValidationError(fieldId, value, defaultValidator, overriddenValidator, formValidationOptions);
@@ -11863,6 +11886,7 @@ const activeMilitaryViewModelToRequest = (viewModel) => ({
11863
11886
  firstName: viewModel.firstName,
11864
11887
  lastName: viewModel.lastName,
11865
11888
  birthDate: viewModel.birthDate,
11889
+ activeDutyStartDate: viewModel.activeDutyStartDate || undefined,
11866
11890
  email: viewModel.email,
11867
11891
  phoneNumber: viewModel.phoneNumber,
11868
11892
  organization: viewModel.organization,
@@ -11876,6 +11900,7 @@ const inactiveMilitaryViewModelToRequest = (viewModel) => ({
11876
11900
  firstName: viewModel.firstName,
11877
11901
  lastName: viewModel.lastName,
11878
11902
  birthDate: viewModel.birthDate,
11903
+ activeDutyStartDate: viewModel.activeDutyStartDate || undefined,
11879
11904
  email: viewModel.email,
11880
11905
  phoneNumber: viewModel.phoneNumber,
11881
11906
  organization: viewModel.organization,
@@ -14877,6 +14902,7 @@ const verificationServiceReducer = (state = getInitialState(), action) => {
14877
14902
  maxAge: state.verificationResponse.maxAge || state.programTheme.config.maxAge,
14878
14903
  minAge: state.verificationResponse.minAge || state.programTheme.config.minAge,
14879
14904
  smsLoopEnabled: state.programTheme.smsLoopEnabled,
14905
+ strictMilitaryValidationEnabled: state.programTheme.strictMilitaryValidationEnabled,
14880
14906
  currentStep: state.verificationResponse.currentStep,
14881
14907
  viewModel: state.viewModel,
14882
14908
  },
@@ -16972,12 +16998,14 @@ const formatTwoDigitValues = (value) => {
16972
16998
  }
16973
16999
  };
16974
17000
 
16975
- const BirthDate = ({ onChange, intl, isErrored, isRequired = true, errorId, value, }) => {
16976
- const birthDateParts = value.split("-");
16977
- const birthDateYear = Number.parseInt(birthDateParts[0], 10) || undefined;
16978
- const birthDateMonth = Number.parseInt(birthDateParts[1], 10) || undefined;
16979
- const birthDateDay = Number.parseInt(birthDateParts[2], 10) || undefined;
16980
- const minBirthYear = 1900;
17001
+ const DateInput = ({ onChange, intl, isErrored, isRequired = true, value = "2000-01-01", errorMsg, label, fieldName, fieldId, mode = "date", }) => {
17002
+ const cssId = `sid-${fieldId}`;
17003
+ const dateParts = value.split("-");
17004
+ const dateYear = Number.parseInt(dateParts[0], 10) || undefined;
17005
+ const dateMonth = Number.parseInt(dateParts[1], 10) || undefined;
17006
+ // Default day to 1 if in month mode (where days are ignored) so that we return valid date strings.
17007
+ const dateDay = mode === "month" ? 1 : Number.parseInt(dateParts[2], 10) || undefined;
17008
+ const minYear = 1900;
16981
17009
  const thisYear = new Date().getFullYear();
16982
17010
  /* prettier-ignore */
16983
17011
  const months = [
@@ -16995,98 +17023,86 @@ const BirthDate = ({ onChange, intl, isErrored, isRequired = true, errorId, valu
16995
17023
  { value: "12", label: intl.formatHTMLMessage({ id: "dateTime.december", defaultMessage: "December" }) },
16996
17024
  ];
16997
17025
  const isDateFieldEmpty = (year, month, day) => (!day || day === "") && (!month || month === "") && (!year || year === "");
16998
- const updateBirthMonth = (month) => {
16999
- if (isDateFieldEmpty(birthDateYear, month, birthDateDay)) {
17026
+ const updateMonth = (month) => {
17027
+ if (isDateFieldEmpty(dateYear, month, dateDay)) {
17000
17028
  onChange("");
17001
17029
  return;
17002
17030
  }
17003
17031
  if (month === "" || month === null) {
17004
- onChange(`${birthDateYear}--${birthDateDay}`);
17032
+ onChange(`${dateYear}--${dateDay}`);
17005
17033
  }
17006
17034
  const newVal = Number.parseInt(month, 10);
17007
17035
  if (typeof newVal === "number" && newVal >= 1 && newVal <= 12) {
17008
- onChange(`${birthDateYear}-${formatTwoDigitValues(month)}-${formatTwoDigitValues(birthDateDay)}`);
17036
+ onChange(`${dateYear}-${formatTwoDigitValues(month)}-${formatTwoDigitValues(dateDay)}`);
17009
17037
  }
17010
17038
  else {
17011
- logger.warn(`Value '${newVal}' is an invalid birth month`);
17039
+ logger.warn(`Value '${newVal}' is an invalid month`);
17012
17040
  }
17013
17041
  };
17014
- const updateBirthDay = (day) => {
17015
- if (isDateFieldEmpty(birthDateYear, birthDateMonth, day)) {
17042
+ const updateDay = (day) => {
17043
+ if (isDateFieldEmpty(dateYear, dateMonth, day)) {
17016
17044
  onChange("");
17017
17045
  return;
17018
17046
  }
17019
17047
  if (day === "") {
17020
- onChange(`${birthDateYear}-${birthDateMonth}-`);
17048
+ onChange(`${dateYear}-${dateMonth}-`);
17021
17049
  }
17022
17050
  const newVal = Number.parseInt(day, 10);
17023
17051
  if (typeof newVal === "number" && newVal >= 1 && newVal <= 31) {
17024
- onChange(`${birthDateYear}-${formatTwoDigitValues(birthDateMonth)}-${formatTwoDigitValues(newVal)}`);
17052
+ onChange(`${dateYear}-${formatTwoDigitValues(dateMonth)}-${formatTwoDigitValues(newVal)}`);
17025
17053
  }
17026
17054
  else {
17027
- logger.warn(`Value '${newVal}' is an invalid birth day`);
17055
+ logger.warn(`Value '${newVal}' is an invalid day`);
17028
17056
  }
17029
17057
  };
17030
17058
  const updateBirthYear = (year) => {
17031
- if (isDateFieldEmpty(year, birthDateMonth, birthDateDay)) {
17059
+ if (isDateFieldEmpty(year, dateMonth, dateDay)) {
17032
17060
  onChange("");
17033
17061
  return;
17034
17062
  }
17035
17063
  if (year === "") {
17036
- onChange(`-${birthDateMonth}-${birthDateDay}`);
17064
+ onChange(`-${dateMonth}-${dateDay}`);
17037
17065
  }
17038
17066
  const newVal = Number.parseInt(year, 10);
17039
17067
  if (typeof newVal === "number" && newVal >= 1 && newVal <= thisYear) {
17040
- onChange(`${newVal}-${formatTwoDigitValues(birthDateMonth)}-${formatTwoDigitValues(birthDateDay)}`);
17068
+ onChange(`${newVal}-${formatTwoDigitValues(dateMonth)}-${formatTwoDigitValues(dateDay)}`);
17041
17069
  }
17042
17070
  else {
17043
- logger.warn(`Value '${newVal}' is an invalid birth year`);
17071
+ logger.warn(`Value '${newVal}' is an invalid year`);
17044
17072
  }
17045
17073
  };
17046
- const getBirthDate = () => {
17047
- if (!birthDateDay && !birthDateMonth && !birthDateYear) {
17074
+ const getDate = () => {
17075
+ if (!dateDay && !dateMonth && !dateYear) {
17048
17076
  onChange("");
17049
17077
  }
17050
17078
  else {
17051
- onChange(`${birthDateYear}-${formatTwoDigitValues(birthDateMonth)}-${formatTwoDigitValues(birthDateDay)}`);
17079
+ onChange(`${dateYear}-${formatTwoDigitValues(dateMonth)}-${formatTwoDigitValues(dateDay)}`);
17052
17080
  }
17053
17081
  };
17054
- const monthFieldId = "sid-birthdate__month";
17055
- const fieldLabelId = "sid-birthdate-label";
17056
- const errMsg = errorId ? (React.createElement("div", { className: "sid-field-error" },
17057
- React.createElement(FormattedHTMLMessage, { id: `errorId.${errorId}`, defaultMessage: "Invalid birth date" }))) : (React.createElement("div", { className: "sid-field-error" },
17058
- React.createElement(FormattedHTMLMessage, { id: "errorId.invalidBirthDate", defaultMessage: "Invalid birth date" })));
17059
- const birthDateDayRef = useRef(null);
17060
- const birthDateYearRef = useRef(null);
17061
- // NOTE: Dependency array omitted to account for use of resetRef(), as useEffect with dep arr
17062
- // will only trigger on initial render leaving the refs empty, this replicates prior version
17063
- // where ref callback would trigger with each re-render
17064
- useEffect(() => {
17065
- setRef("birthDateDay", birthDateDayRef.current);
17066
- setRef("birthDateYear", birthDateYearRef.current);
17067
- });
17068
- return (React.createElement("div", { className: "sid-field sid-birthdate" },
17082
+ const monthFieldId = `${cssId}__month`;
17083
+ const fieldLabelId = `${cssId}-label`;
17084
+ const wrappedErrMsg = React.createElement("div", { className: "sid-field-error" }, errorMsg);
17085
+ return (React.createElement("div", { className: `sid-field ${cssId}` },
17069
17086
  React.createElement("div", { className: "sid-l-space-top-md" }),
17070
- React.createElement(FieldLabel, { text: React.createElement(FormattedHTMLMessage, { id: "birthDate", defaultMessage: "Date of birth" }), htmlForLabel: monthFieldId, id: fieldLabelId, displayClasses: "sid-field__label-with-explanation", isRequired: isRequired },
17087
+ React.createElement(FieldLabel, { text: label, htmlForLabel: monthFieldId, id: fieldLabelId, displayClasses: "sid-field__label-with-explanation", isRequired: isRequired },
17071
17088
  React.createElement(FormattedHTMLMessage, { id: "verificationPurposesOnly", defaultMessage: "Used for verification purposes only" })),
17072
- React.createElement("div", { className: "sid-birthdate__inputs" },
17073
- React.createElement(InputSelectComponent, { className: "sid-birthdate__month", fieldId: "birthDate", inputId: monthFieldId, fieldLabelId: fieldLabelId, isErrored: isErrored, options: months, onChange: (choice) => {
17089
+ React.createElement("div", { className: `${cssId}__inputs sid-date__inputs` },
17090
+ React.createElement(InputSelectComponent, { className: `${cssId}__month sid-date__month`, fieldId: fieldName, inputId: monthFieldId, fieldLabelId: fieldLabelId, isErrored: isErrored, options: months, onChange: (choice) => {
17074
17091
  if (choice) {
17075
- updateBirthMonth(choice.value);
17092
+ updateMonth(choice.value);
17076
17093
  }
17077
17094
  else {
17078
17095
  // clear the birth month
17079
- updateBirthMonth(null);
17096
+ updateMonth(null);
17080
17097
  }
17081
- }, placeholder: intl.formatHTMLMessage({ id: "dateTime.month", defaultMessage: "Month" }), suppressPlaceholder: false, value: birthDateMonth ? months[birthDateMonth - 1] : undefined, isRequired: isRequired, buttonRef: "inputSelectButtonBirthDate" }),
17082
- React.createElement("input", { className: `sid-birthdate__day sid-text-input sid-text-input--required ${isErrored ? "sid-text-input--error" : ""}`, id: "sid-birthdate-day", min: 1, max: 31, name: "sid-birthdate-day", onChange: (e) => updateBirthDay(e.target.value), onBlur: getBirthDate, pattern: "\\d*", placeholder: intl.formatHTMLMessage({ id: "dateTime.day", defaultMessage: "Day" }), "aria-label": intl.formatHTMLMessage({ id: "dateTime.day", defaultMessage: "Day" }), "aria-labelledby": "sid-birthdate", "aria-required": isRequired, ref: birthDateDayRef, type: "text", value: birthDateDay || "" }),
17083
- React.createElement("input", { className: `sid-birthdate__year sid-text-input sid-text-input--required ${isErrored ? "sid-text-input--error" : ""}`, id: "sid-birthdate-year", name: "sid-birthdate-year", type: "text", min: minBirthYear, max: thisYear, value: birthDateYear || "", pattern: "\\d*", placeholder: intl.formatHTMLMessage({ id: "dateTime.year", defaultMessage: "Year" }), "aria-label": intl.formatHTMLMessage({ id: "dateTime.year", defaultMessage: "Year" }), "aria-labelledby": "sid-birthdate", "aria-required": isRequired, ref: birthDateYearRef, onChange: (e) => updateBirthYear(e.target.value), onBlur: getBirthDate })),
17084
- isErrored ? errMsg : null));
17098
+ }, placeholder: intl.formatHTMLMessage({ id: "dateTime.month", defaultMessage: "Month" }), suppressPlaceholder: false, value: dateMonth ? months[dateMonth - 1] : undefined, isRequired: isRequired, buttonRef: "inputSelectButtonBirthDate" }),
17099
+ mode === "date" && (React.createElement(InputTextComponent, { className: `${cssId}__day sid-date__day sid-text-input sid-text-input--required ${isErrored ? "sid-text-input--error" : ""}`, id: `${fieldId}-day`, isErrored: isErrored, min: 1, max: 31, name: `${cssId}-day`, onChange: (e) => updateDay(e.target.value), onBlur: getDate, pattern: "\\d*", placeholder: intl.formatHTMLMessage({ id: "dateTime.day", defaultMessage: "Day" }), "aria-label": intl.formatHTMLMessage({ id: "dateTime.day", defaultMessage: "Day" }), "aria-labelledby": cssId, "aria-required": isRequired, refId: `${fieldName}Day`, type: "text", value: dateDay || "" })),
17100
+ React.createElement(InputTextComponent, { className: `${cssId}__year sid-date__year sid-text-input sid-text-input--required ${isErrored ? "sid-text-input--error" : ""}`, id: `${fieldId}-year`, name: `${cssId}-year`, type: "text", isErrored: isErrored, min: minYear, max: thisYear, value: dateYear || "", pattern: "\\d*", placeholder: intl.formatHTMLMessage({ id: "dateTime.year", defaultMessage: "Year" }), "aria-label": intl.formatHTMLMessage({ id: "dateTime.year", defaultMessage: "Year" }), "aria-labelledby": cssId, "aria-required": isRequired, refId: `${fieldName}Year`, onChange: (e) => updateBirthYear(e.target.value), onBlur: getDate })),
17101
+ isErrored ? wrappedErrMsg : null));
17085
17102
  };
17086
- BirthDate.defaultProps = {
17087
- value: "2000-01-01",
17088
- };
17089
- const BirthDateComponent = injectIntl(BirthDate);
17103
+ const DateComponent = injectIntl(DateInput);
17104
+
17105
+ const BirthDateComponent = ({ onChange, isErrored, isRequired = true, errorId, value = "2000-01-01", }) => (React.createElement(DateComponent, { value: value, label: React.createElement(FormattedHTMLMessage, { id: "birthDate", defaultMessage: "Date of birth" }), onChange: onChange, fieldId: "birthdate", fieldName: "birthDate", isErrored: isErrored, isRequired: isRequired, errorMsg: errorId ? (React.createElement(FormattedHTMLMessage, { id: `errorId.${errorId}`, defaultMessage: "Invalid birth date" })) : (React.createElement(FormattedHTMLMessage, { id: "errorId.invalidBirthDate", defaultMessage: "Invalid birth date" })) }));
17090
17106
 
17091
17107
  function replaceCustomTags(text, tagmap) {
17092
17108
  if (typeof text !== "string")
@@ -18065,6 +18081,8 @@ const BranchOfService = ({ autoFocus, onChange, value, isErrored, organizations,
18065
18081
  };
18066
18082
  const BranchOfServiceComponent = injectIntl(BranchOfService);
18067
18083
 
18084
+ const ActiveDutyStartDateComponent = ({ onChange, isErrored, errorId = "invalidActiveDutyStartDate", value = "2000-01-01", }) => (React.createElement(DateComponent, { value: value, label: React.createElement(FormattedHTMLMessage, { id: "activeDutyStartDate", defaultMessage: "Active Duty Start Date" }), onChange: onChange, fieldName: "activeDutyStartDate", fieldId: "sid-active-duty-start-date", isErrored: isErrored, isRequired: true, errorMsg: React.createElement(FormattedHTMLMessage, { id: `errorId.${errorId}`, defaultMessage: "Invalid start date" }) }));
18085
+
18068
18086
  /**
18069
18087
  * TODO - preamble
18070
18088
  */
@@ -18142,6 +18160,10 @@ const StepActiveMilitaryPersonalInfo = ({ intl, verificationService, }) => {
18142
18160
  updateActiveMilitaryViewModel("birthDate", newValue);
18143
18161
  updateFieldValidationErrorsByFieldId("birthDate", newValue, verificationService);
18144
18162
  }, value: viewModel.birthDate }),
18163
+ verificationService.programTheme.strictMilitaryValidationEnabled && (React.createElement(ActiveDutyStartDateComponent, { isErrored: !!fieldValidationErrors.activeDutyStartDate, errorId: fieldValidationErrors.activeDutyStartDate, onChange: (newValue) => {
18164
+ updateActiveMilitaryViewModel("activeDutyStartDate", newValue);
18165
+ updateFieldValidationErrorsByFieldId("activeDutyStartDate", newValue, verificationService);
18166
+ }, value: viewModel.activeDutyStartDate })),
18145
18167
  React.createElement(EmailComponent, { value: viewModel.email, isErrored: !!fieldValidationErrors.email, explanation: React.createElement(FormattedHTMLMessage, { id: "emailExplanation", defaultMessage: "Personal email address is recommended" }), onChange: (newValue) => {
18146
18168
  updateActiveMilitaryViewModel("email", newValue);
18147
18169
  updateFieldValidationErrorsByFieldId("email", newValue, verificationService);
@@ -18170,78 +18192,7 @@ const StepActiveMilitaryPersonalInfo = ({ intl, verificationService, }) => {
18170
18192
  };
18171
18193
  const StepActiveMilitaryPersonalInfoComponent = injectIntl(StepActiveMilitaryPersonalInfo);
18172
18194
 
18173
- const DischargeDate = ({ onChange, intl, isErrored, value, }) => {
18174
- const dischargeDateParts = value.split("-");
18175
- const dischargeDateYear = Number.parseInt(dischargeDateParts[0], 10) || undefined;
18176
- const dischargeDateMonth = Number.parseInt(dischargeDateParts[1], 10) || undefined;
18177
- const dischargeDateDay = 1;
18178
- const minDischargeYear = 1900;
18179
- const thisYear = new Date().getFullYear();
18180
- const inputId = "sid-discharge-date";
18181
- /* prettier-ignore */
18182
- const months = [
18183
- { value: "1", label: intl.formatHTMLMessage({ id: "dateTime.january", defaultMessage: "January" }), },
18184
- { value: "2", label: intl.formatHTMLMessage({ id: "dateTime.february", defaultMessage: "February" }), },
18185
- { value: "3", label: intl.formatHTMLMessage({ id: "dateTime.march", defaultMessage: "March" }), },
18186
- { value: "4", label: intl.formatHTMLMessage({ id: "dateTime.april", defaultMessage: "April" }), },
18187
- { value: "5", label: intl.formatHTMLMessage({ id: "dateTime.may", defaultMessage: "May" }) },
18188
- { value: "6", label: intl.formatHTMLMessage({ id: "dateTime.june", defaultMessage: "June" }) },
18189
- { value: "7", label: intl.formatHTMLMessage({ id: "dateTime.july", defaultMessage: "July" }) },
18190
- { value: "8", label: intl.formatHTMLMessage({ id: "dateTime.august", defaultMessage: "August" }), },
18191
- { value: "9", label: intl.formatHTMLMessage({ id: "dateTime.september", defaultMessage: "September" }), },
18192
- { value: "10", label: intl.formatHTMLMessage({ id: "dateTime.october", defaultMessage: "October" }), },
18193
- { value: "11", label: intl.formatHTMLMessage({ id: "dateTime.november", defaultMessage: "November" }), },
18194
- { value: "12", label: intl.formatHTMLMessage({ id: "dateTime.december", defaultMessage: "December" }), },
18195
- ];
18196
- const updateDischargeMonth = (month) => {
18197
- if (month === "" || month === null) {
18198
- onChange(`${dischargeDateYear}--${dischargeDateDay}`);
18199
- }
18200
- const newVal = Number.parseInt(month, 10);
18201
- if (typeof newVal === "number" && newVal >= 1 && newVal <= 12) {
18202
- onChange(`${dischargeDateYear}-${formatTwoDigitValues(month)}-${formatTwoDigitValues(dischargeDateDay)}`);
18203
- }
18204
- else {
18205
- logger.warn(`Value '${newVal}' is an invalid discharge month`);
18206
- }
18207
- };
18208
- const updateDischargeYear = (year) => {
18209
- if (year === "") {
18210
- onChange(`-${dischargeDateMonth}-${dischargeDateDay}`);
18211
- }
18212
- const newVal = Number.parseInt(year, 10);
18213
- if (typeof newVal === "number" && newVal >= 1 && newVal <= thisYear) {
18214
- onChange(`${newVal}-${formatTwoDigitValues(dischargeDateMonth)}-${formatTwoDigitValues(dischargeDateDay)}`);
18215
- }
18216
- else {
18217
- logger.warn(`Value '${newVal}' is an invalid discharge year`);
18218
- }
18219
- };
18220
- const getDischargeDate = () => {
18221
- onChange(`${dischargeDateYear}-${formatTwoDigitValues(dischargeDateMonth)}-${formatTwoDigitValues(dischargeDateDay)}`);
18222
- };
18223
- return (React.createElement("div", { className: `sid-field ${inputId}` },
18224
- React.createElement("div", { className: "sid-l-space-top-md" }),
18225
- React.createElement(FieldLabel, { text: React.createElement(FormattedHTMLMessage, { id: "dischargeDate", defaultMessage: "Discharge date" }), htmlForLabel: `${inputId}__month`, id: `${inputId}-label`, displayClasses: "sid-field__label-with-explanation" },
18226
- React.createElement(FormattedHTMLMessage, { id: "verificationPurposesOnly", defaultMessage: "Used for verification purposes only" })),
18227
- React.createElement("div", { className: `${inputId}__inputs` },
18228
- React.createElement(InputSelectComponent, { className: `${inputId}__month`, fieldId: "dischargeDate", inputId: `${inputId}__month`, fieldLabelId: `${inputId}-label`, isErrored: isErrored, options: months, onChange: (choice) => {
18229
- if (choice) {
18230
- updateDischargeMonth(choice.value);
18231
- }
18232
- else {
18233
- // clear the discharge month
18234
- updateDischargeMonth(null);
18235
- }
18236
- }, placeholder: intl.formatHTMLMessage({ id: "dateTime.month", defaultMessage: "Month" }), suppressPlaceholder: false, value: dischargeDateMonth ? months[dischargeDateMonth - 1] : undefined, buttonRef: "inputSelectButtonDischargeDate", isRequired: true }),
18237
- React.createElement(InputTextComponent, { className: `${inputId}__year`, id: "discharge-date-year", isErrored: isErrored, max: thisYear, min: minDischargeYear, onBlur: getDischargeDate, onChange: (e) => updateDischargeYear(e.target.value), pattern: "\\d*", placeholder: intl.formatHTMLMessage({ id: "dateTime.year", defaultMessage: "Year" }), hidePlaceholder: false, refId: "dischargeDateYear", required: true, value: dischargeDateYear || "", "aria-labelledby": "sid-discharge-date-label" })),
18238
- isErrored ? (React.createElement("div", { className: "sid-field-error" },
18239
- React.createElement(FormattedHTMLMessage, { id: "errorId.invalidDischargeDate", defaultMessage: "Invalid discharge date" }))) : null));
18240
- };
18241
- DischargeDate.defaultProps = {
18242
- value: "2000-01-01",
18243
- };
18244
- const DischargeDateComponent = injectIntl(DischargeDate);
18195
+ const DischargeDateComponent = ({ onChange, isErrored, value = "2000-01-01", }) => (React.createElement(DateComponent, { mode: "month", value: value, label: React.createElement(FormattedHTMLMessage, { id: "dischargeDate", defaultMessage: "Discharge date" }), onChange: onChange, fieldName: "dischargeDate", fieldId: "discharge-date", isErrored: isErrored, isRequired: true, errorMsg: React.createElement(FormattedHTMLMessage, { id: "errorId.invalidDischargeDate", defaultMessage: "Invalid discharge date" }) }));
18245
18196
 
18246
18197
  /**
18247
18198
  * TODO - preamble
@@ -18317,6 +18268,10 @@ const StepInactiveMilitaryPersonalInfo = ({ intl, verificationService, }) => {
18317
18268
  updateInactiveMilitaryViewModel("birthDate", newValue);
18318
18269
  updateFieldValidationErrorsByFieldId("birthDate", newValue, verificationService);
18319
18270
  }, value: viewModel.birthDate }),
18271
+ verificationService.programTheme.strictMilitaryValidationEnabled && (React.createElement(ActiveDutyStartDateComponent, { isErrored: !!fieldValidationErrors.activeDutyStartDate, onChange: (newValue) => {
18272
+ updateInactiveMilitaryViewModel("activeDutyStartDate", newValue);
18273
+ updateFieldValidationErrorsByFieldId("activeDutyStartDate", newValue, verificationService);
18274
+ }, value: viewModel.activeDutyStartDate })),
18320
18275
  React.createElement(DischargeDateComponent, { isErrored: !!fieldValidationErrors.dischargeDate, onChange: (newValue) => {
18321
18276
  updateInactiveMilitaryViewModel("dischargeDate", newValue);
18322
18277
  updateFieldValidationErrorsByFieldId("dischargeDate", newValue, verificationService);