@sheerid/jslib 1.145.0 → 1.146.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 (55) hide show
  1. package/__tests__/__helpers__/experimental/experimental-renderers.d.ts +21 -0
  2. package/es5/Tmetrix.bundle.js +4 -4
  3. package/es5/messages_ar.bundle.js +4 -4
  4. package/es5/messages_bg.bundle.js +4 -4
  5. package/es5/messages_cs.bundle.js +4 -4
  6. package/es5/messages_da.bundle.js +4 -4
  7. package/es5/messages_de.bundle.js +4 -4
  8. package/es5/messages_el.bundle.js +4 -4
  9. package/es5/messages_en-GB.bundle.js +4 -4
  10. package/es5/messages_es-ES.bundle.js +4 -4
  11. package/es5/messages_es.bundle.js +4 -4
  12. package/es5/messages_fi.bundle.js +4 -4
  13. package/es5/messages_fr-CA.bundle.js +4 -4
  14. package/es5/messages_fr.bundle.js +4 -4
  15. package/es5/messages_ga.bundle.js +4 -4
  16. package/es5/messages_hr.bundle.js +4 -4
  17. package/es5/messages_hu.bundle.js +4 -4
  18. package/es5/messages_id.bundle.js +4 -4
  19. package/es5/messages_it.bundle.js +4 -4
  20. package/es5/messages_iw.bundle.js +4 -4
  21. package/es5/messages_ja.bundle.js +4 -4
  22. package/es5/messages_ko.bundle.js +4 -4
  23. package/es5/messages_lo.bundle.js +4 -4
  24. package/es5/messages_lt.bundle.js +4 -4
  25. package/es5/messages_ms.bundle.js +4 -4
  26. package/es5/messages_nl.bundle.js +4 -4
  27. package/es5/messages_no.bundle.js +4 -4
  28. package/es5/messages_pl.bundle.js +4 -4
  29. package/es5/messages_pt-BR.bundle.js +4 -4
  30. package/es5/messages_pt.bundle.js +4 -4
  31. package/es5/messages_ru.bundle.js +4 -4
  32. package/es5/messages_sk.bundle.js +4 -4
  33. package/es5/messages_sl.bundle.js +4 -4
  34. package/es5/messages_sr.bundle.js +4 -4
  35. package/es5/messages_sv.bundle.js +4 -4
  36. package/es5/messages_th.bundle.js +4 -4
  37. package/es5/messages_tr.bundle.js +4 -4
  38. package/es5/messages_zh-HK.bundle.js +4 -4
  39. package/es5/messages_zh.bundle.js +4 -4
  40. package/localized-messages/en-US.json +1 -0
  41. package/manifest.json +43 -43
  42. package/package.json +1 -1
  43. package/sheerid-requestOrg.css +4 -4
  44. package/sheerid-requestOrg.js +10 -10
  45. package/sheerid-requestOrg.js.map +1 -1
  46. package/sheerid-utils.js +5 -5
  47. package/sheerid-utils.js.map +1 -1
  48. package/sheerid.css +4 -4
  49. package/sheerid.js +6 -6
  50. package/sheerid.js.map +1 -1
  51. package/sheerides6.js +39 -6
  52. package/sheerides6.js.map +1 -1
  53. package/src/lib/types/types.d.ts +1 -0
  54. package/src/lib/utils/stepComponentHelpers/stepComponentHelpers.d.ts +4 -0
  55. package/types-reference.zip +0 -0
package/sheerides6.js CHANGED
@@ -2581,6 +2581,7 @@ var enUSMessages = {
2581
2581
  "defaultMessages.step.docUpload.uploadInfo.licensedProfessional.validDate": "A currently valid date",
2582
2582
  "defaultMessages.step.docUpload.uploadInfo.lowIncome.fullName": "Your full name",
2583
2583
  "defaultMessages.step.docUpload.uploadInfo.lowIncome.validDate": "A valid date of issue (within the last 12 months) or date of expiry (must be valid)",
2584
+ "defaultMessages.step.docUpload.uploadInfo.lowIncome.ebtNumber": "EBT card number",
2584
2585
  "defaultMessages.step.docUpload.uploadInfo.medical.status": "Your medical professional status",
2585
2586
  "defaultMessages.step.docUpload.uploadInfo.medical.validDate": "A currently valid date",
2586
2587
  "defaultMessages.step.docUpload.uploadInfo.military.currentAffiliation": "Your current affiliation with the armed services",
@@ -5004,16 +5005,29 @@ const getStatusLabel = (intl, status, defaultMessages) => {
5004
5005
  }
5005
5006
  return intl.formatHTMLMessage({ id: status, defaultMessage: defaultMessages[status] });
5006
5007
  };
5008
+ // The jslib should not be the owner of this mapping,
5009
+ // DATA-3164 exists to find another way.
5010
+ const countryStatusAllowList = new Map([
5011
+ ["GB", ["ACTIVE_DUTY", "VETERAN", "RESERVIST"]],
5012
+ ]);
5007
5013
  const getAvailableMilitaryStatuses = (verificationService, intl) => {
5008
- const availableStatusesResponse = verificationService.verificationResponse.availableStatuses ||
5014
+ const availableStatusesFromResponse = verificationService.verificationResponse.availableStatuses ||
5009
5015
  (verificationService.previousVerificationResponse &&
5010
5016
  verificationService.previousVerificationResponse
5011
5017
  .availableStatuses);
5012
5018
  const availableStatuses = [];
5013
- if (!availableStatusesResponse) {
5019
+ // The country overrides in this function should be updated with DATA-3164
5020
+ const country = verificationService.viewModel &&
5021
+ verificationService.viewModel.countryChoice &&
5022
+ verificationService.viewModel.countryChoice.value;
5023
+ const countryAllowedStatuses = country && countryStatusAllowList.get(country);
5024
+ const availableStatusesForCountry = countryAllowedStatuses
5025
+ ? availableStatusesFromResponse.filter((status) => countryAllowedStatuses.includes(status))
5026
+ : availableStatusesFromResponse;
5027
+ if (!availableStatusesForCountry) {
5014
5028
  return null;
5015
5029
  }
5016
- availableStatusesResponse.forEach((status) => {
5030
+ availableStatusesForCountry.forEach((status) => {
5017
5031
  availableStatuses.push({
5018
5032
  value: status,
5019
5033
  label: getStatusLabel(intl, status, MilitaryStatusDefaultMessagesEnum),
@@ -5120,6 +5134,13 @@ const getAvailableCountryChoices = (programTheme, intl) => {
5120
5134
  }),
5121
5135
  }));
5122
5136
  };
5137
+ /**
5138
+ * @private
5139
+ */
5140
+ const getSortedCountryChoices = (programTheme, intl, locale) => {
5141
+ const localeAwareSorter = (a, b) => Intl.Collator(locale).compare(a.label, b.label);
5142
+ return getAvailableCountryChoices(programTheme, intl).sort(localeAwareSorter);
5143
+ };
5123
5144
  const getAvailableStateChoices = (programTheme, intl) => {
5124
5145
  const availableStates = getConfiguredStates(programTheme);
5125
5146
  return availableStates.map((stateCode) => ({
@@ -17354,7 +17375,8 @@ const BaseCountryComponentWrapper = ({ verificationService, viewModelDraftDecora
17354
17375
  if (nextFocusField) {
17355
17376
  logger.warn("nextFocusField prop is deprecated");
17356
17377
  }
17357
- const countryChoices = getAvailableCountryChoices(verificationService.programTheme, intl);
17378
+ const locale = getSafe(() => viewModel.localeChoice.value, "en-US");
17379
+ const countryChoices = getSortedCountryChoices(verificationService.programTheme, intl, locale);
17358
17380
  const countryQueryParam = getSafe(() => getQueryParam("country").toUpperCase());
17359
17381
  const defaultCountryChoice = getDefaultCountryChoice(countryChoices);
17360
17382
  const { fieldValidationErrors } = verificationService;
@@ -19577,6 +19599,12 @@ const StepError = ({ verificationService, errorId }) => {
19577
19599
  React.createElement(LinkExternal, { href: verificationResponse.redirectUrl, onClick: () => recordEvent(VerificationStepsEnum.error, verificationResponse.redirectUrl), className: "sid-btn sid-error-btn sid-btn-light" },
19578
19600
  React.createElement(FormattedHTMLMessage, { id: `step.error.errorId.${firstErrorId}.buttonText`, defaultMessage: verificationService.messages[`step.error.errorId.${firstErrorId}.buttonText`] }))));
19579
19601
  }
19602
+ else if (errorIds.includes("missingRequiredMetadata")) {
19603
+ // If there is not a button override AND the error is
19604
+ // `missingRequiredMetadata` don't show a button because clicking try again
19605
+ // is useless in that case.
19606
+ button = null;
19607
+ }
19580
19608
  // special cases
19581
19609
  if (errorIds.includes("verificationLimitExceeded")) {
19582
19610
  button = null;
@@ -21592,14 +21620,19 @@ const UploadInfoComponent = ({ verificationService }) => {
21592
21620
  React.createElement(FormattedHTMLMessage, { id: "step.docUpload.uploadInfo.licensedProfessional.licenseStatus", defaultMessage: "Your professional license and/or certification status" })),
21593
21621
  React.createElement("li", { className: "sid-upload-info-list__li" },
21594
21622
  React.createElement(FormattedHTMLMessage, { id: "step.docUpload.uploadInfo.identity.validDate", defaultMessage: "A currently valid date" })))));
21595
- case SegmentEnum.LOW_INCOME:
21623
+ case SegmentEnum.LOW_INCOME: {
21624
+ const viewModel = verificationService.viewModel;
21625
+ const isEbt = viewModel && viewModel.statuses && viewModel.statuses.includes("SNAP_BENEFITS");
21596
21626
  return (React.createElement("div", null,
21597
21627
  React.createElement(InstructionHeader, { id: "step.docUpload.uploadInstructions", defaultMessage: "Upload an official document that shows" }),
21598
21628
  React.createElement("ul", { className: "sid-upload-info-list" },
21599
21629
  React.createElement("li", { className: "sid-upload-info-list__li" },
21600
21630
  React.createElement(FormattedHTMLMessage, { id: "step.docUpload.uploadInfo.fullName", defaultMessage: "Your full name" })),
21601
21631
  React.createElement("li", { className: "sid-upload-info-list__li" },
21602
- React.createElement(FormattedHTMLMessage, { id: "step.docUpload.uploadInfo.lowIncome.validDate", defaultMessage: "The date when the document was issued (should be within the last 12 months) or the expiry date" })))));
21632
+ React.createElement(FormattedHTMLMessage, { id: "step.docUpload.uploadInfo.lowIncome.validDate", defaultMessage: "The date when the document was issued (should be within the last 12 months) or the expiry date" })),
21633
+ isEbt && (React.createElement("li", { className: "sid-upload-info-list__li" },
21634
+ React.createElement(FormattedHTMLMessage, { id: "step.docUpload.uploadInfo.lowIncome.ebtNumber", defaultMessage: "EBT card number" }))))));
21635
+ }
21603
21636
  case SegmentEnum.RECENT_MOVER:
21604
21637
  return (React.createElement("div", null,
21605
21638
  React.createElement(InstructionHeader, { id: "step.docUpload.uploadInstructions", defaultMessage: "Upload an official document that shows" }),