From 7d5d77a461e75860859d40d20a547cb85c458308 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Thu, 24 Sep 2020 11:39:22 -0400 Subject: [PATCH] LG-3427: Update doc auth ID support texts (#4228) * Support string tagName for formatHTML handler * Support variables substitution in i18n strings * Update doc auth ID support texts * Remove unused string idv.messages.jurisdiction.no_id * Remove unused "No ID" error screen * Remove unnecessary HTML suffix for plaintext use_cac string * Extract getServiceProvider to conditionally create SP object See: https://github.com/18F/identity-idp/pull/4228/files#r492903440 * Support including attributes in match in formatHTML **Why**: Improved reuse of strings between server-side and client-side * Substitute no_other_id_help_bold with no_other_id_help_bold_html * Remove link "Full list of accepted IDs" --- .../idv/jurisdiction_errors_controller.rb | 10 ----- .../components/mobile-intro-step.jsx | 25 ++++++++++-- .../context/service-provider.js | 12 ++++++ .../document-capture/hooks/use-i18n.js | 31 ++++++++++++--- .../packages/document-capture/index.js | 1 + app/javascript/packs/document-capture.jsx | 29 +++++++++----- .../idv/capture_doc/document_capture.html.erb | 7 +++- .../idv/doc_auth/document_capture.html.erb | 7 +++- app/views/idv/doc_auth/upload.html.erb | 37 ++++++++++-------- .../idv/jurisdiction_errors/no_id.html.erb | 13 ------- .../idv/shared/_document_capture.html.erb | 2 + config/js_locale_strings.yml | 3 +- config/locales/doc_auth/en.yml | 6 ++- config/locales/doc_auth/es.yml | 6 ++- config/locales/doc_auth/fr.yml | 7 +++- config/locales/idv/en.yml | 4 -- config/locales/idv/es.yml | 6 --- config/locales/idv/fr.yml | 6 --- config/routes.rb | 1 - spec/features/idv/cac/use_cac_step_spec.rb | 2 +- .../context/service-provider-spec.js | 11 ++++++ .../document-capture/hooks/use-i18n-spec.jsx | 39 ++++++++++++++++++- .../idv/doc_auth/upload.html.erb_spec.rb | 35 +++++++++++++++++ .../no_id.html.erb_spec.rb | 34 ---------------- 24 files changed, 217 insertions(+), 117 deletions(-) delete mode 100644 app/controllers/idv/jurisdiction_errors_controller.rb create mode 100644 app/javascript/packages/document-capture/context/service-provider.js delete mode 100644 app/views/idv/jurisdiction_errors/no_id.html.erb create mode 100644 spec/javascripts/packages/document-capture/context/service-provider-spec.js delete mode 100644 spec/views/idv/jurisdiction_errors/no_id.html.erb_spec.rb diff --git a/app/controllers/idv/jurisdiction_errors_controller.rb b/app/controllers/idv/jurisdiction_errors_controller.rb deleted file mode 100644 index b82726d66bb..00000000000 --- a/app/controllers/idv/jurisdiction_errors_controller.rb +++ /dev/null @@ -1,10 +0,0 @@ -module Idv - class JurisdictionErrorsController < ApplicationController - include IdvSession - - before_action :confirm_two_factor_authenticated - before_action :confirm_idv_needed - - def no_id; end - end -end diff --git a/app/javascript/packages/document-capture/components/mobile-intro-step.jsx b/app/javascript/packages/document-capture/components/mobile-intro-step.jsx index 8cb6585177a..d49907efa2d 100644 --- a/app/javascript/packages/document-capture/components/mobile-intro-step.jsx +++ b/app/javascript/packages/document-capture/components/mobile-intro-step.jsx @@ -1,16 +1,33 @@ -import React from 'react'; +import React, { useContext } from 'react'; +import ServiceProviderContext from '../context/service-provider'; import useI18n from '../hooks/use-i18n'; function MobileIntroStep() { - const { t } = useI18n(); + const { t, formatHTML } = useI18n(); + const serviceProvider = useContext(ServiceProviderContext); return ( <>

{t('doc_auth.info.document_capture_intro_acknowledgment')}

- {t('idv.messages.jurisdiction.no_id')} + {formatHTML(t('doc_auth.info.id_worn_html'), { + strong: 'strong', + })} +

+ {serviceProvider && ( +

+ {formatHTML( + t('doc_auth.info.no_other_id_help_bold_html', { sp_name: serviceProvider.name }), + { + strong: 'strong', + a: ({ children }) => {children}, + }, + )} +

+ )} +

+ {t('doc_auth.tips.document_capture_header_text')}

-

{t('doc_auth.tips.document_capture_header_text')}