diff --git a/app/controllers/account_reset/cancel_controller.rb b/app/controllers/account_reset/cancel_controller.rb index eaa67e3c7db..40ffc79b18d 100644 --- a/app/controllers/account_reset/cancel_controller.rb +++ b/app/controllers/account_reset/cancel_controller.rb @@ -41,7 +41,10 @@ def handle_invalid_token(result) def handle_success sign_out if current_user - flash[:success] = t('two_factor_authentication.account_reset.successful_cancel') + flash[:success] = t( + 'two_factor_authentication.account_reset.successful_cancel', + app_name: APP_NAME, + ) end def token diff --git a/app/controllers/idv/review_controller.rb b/app/controllers/idv/review_controller.rb index 044bd8bc965..b6ea95031ed 100644 --- a/app/controllers/idv/review_controller.rb +++ b/app/controllers/idv/review_controller.rb @@ -88,7 +88,7 @@ def init_profile UserAlerts::AlertUserAboutAccountVerified.call( user: current_user, date_time: event.created_at, - app: decorated_session.sp_name, + sp_name: decorated_session.sp_name, disavowal_token: event.disavowal_token, ) end diff --git a/app/controllers/users/email_confirmations_controller.rb b/app/controllers/users/email_confirmations_controller.rb index aa1cb7f2fa9..6931428ec7c 100644 --- a/app/controllers/users/email_confirmations_controller.rb +++ b/app/controllers/users/email_confirmations_controller.rb @@ -68,7 +68,7 @@ def message_for_already_confirmed_user if email_address_already_confirmed_by_current_user? t('devise.confirmations.already_confirmed', action: nil) elsif user_signed_in? - t('devise.confirmations.confirmed_but_remove_from_other_account') + t('devise.confirmations.confirmed_but_remove_from_other_account', app_name: APP_NAME) else action_text = t('devise.confirmations.sign_in') t('devise.confirmations.already_confirmed', action: action_text) diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index db6b3eab3e5..f43b0b09d81 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -65,7 +65,7 @@ def timeout sign_out flash[:info] = t( 'notices.session_timedout', - app: APP_NAME, + app_name: APP_NAME, minutes: IdentityConfig.store.session_timeout_in_minutes, ) redirect_to root_url(request_id: request_id) diff --git a/app/controllers/users/verify_account_controller.rb b/app/controllers/users/verify_account_controller.rb index b299c3c7c44..8a6e9ca0e24 100644 --- a/app/controllers/users/verify_account_controller.rb +++ b/app/controllers/users/verify_account_controller.rb @@ -33,7 +33,7 @@ def create UserAlerts::AlertUserAboutAccountVerified.call( user: current_user, date_time: event.created_at, - app: decorated_session.sp_name, + sp_name: decorated_session.sp_name, disavowal_token: event.disavowal_token, ) flash[:success] = t('account.index.verification.success') diff --git a/app/decorators/service_provider_session_decorator.rb b/app/decorators/service_provider_session_decorator.rb index 2d37f8c2a51..8a37ecfe328 100644 --- a/app/decorators/service_provider_session_decorator.rb +++ b/app/decorators/service_provider_session_decorator.rb @@ -21,7 +21,9 @@ def custom_alert(section) return if sp.help_text.nil? language = I18n.locale.to_s alert = sp.help_text.dig(section, language) - format(alert, sp_name: sp_name, sp_create_link: sp_create_link) if alert.present? + if alert.present? + format(alert, sp_name: sp_name, sp_create_link: sp_create_link, app_name: APP_NAME) + end end def sp_logo diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index 3a7422f39e5..9577e4a3d1b 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -151,9 +151,9 @@ def connected_apps def delete_account_bullet_key if identity_verified? - I18n.t('users.delete.bullet_2_loa3', app: APP_NAME) + I18n.t('users.delete.bullet_2_loa3', app_name: APP_NAME) else - I18n.t('users.delete.bullet_2_loa1', app: APP_NAME) + I18n.t('users.delete.bullet_2_loa1', app_name: APP_NAME) end end diff --git a/app/javascript/packages/document-capture/components/selfie-capture.jsx b/app/javascript/packages/document-capture/components/selfie-capture.jsx index 60ca20fd71f..cf025d69d8d 100644 --- a/app/javascript/packages/document-capture/components/selfie-capture.jsx +++ b/app/javascript/packages/document-capture/components/selfie-capture.jsx @@ -4,6 +4,7 @@ import { useState, useEffect, useCallback, + useContext, useMemo, useImperativeHandle, } from 'react'; @@ -14,6 +15,7 @@ import useIfStillMounted from '../hooks/use-if-still-mounted'; import useInstanceId from '../hooks/use-instance-id'; import useFocusFallbackRef from '../hooks/use-focus-fallback-ref'; import './selfie-capture.scss'; +import AppContext from '../context/app'; /** @typedef {import('react').ReactNode} ReactNode */ @@ -152,6 +154,8 @@ function SelfieCapture({ value, onChange, errorMessage, className }, ref) { const labelId = `selfie-capture-label-${instanceId}`; + const { appName } = useContext(AppContext); + return ( <>
{t('doc_auth.instructions.document_capture_selfie_consent_blocked')}
- {t('doc_auth.instructions.document_capture_selfie_consent_blocked_action')} + {t('doc_auth.instructions.document_capture_selfie_consent_blocked', { + app_name: appName, + })} +
++ {t('doc_auth.instructions.document_capture_selfie_consent_blocked_action', { + app_name: appName, + })}
> ) : ( diff --git a/app/javascript/packages/document-capture/context/app.js b/app/javascript/packages/document-capture/context/app.js new file mode 100644 index 00000000000..0dfa69a61b4 --- /dev/null +++ b/app/javascript/packages/document-capture/context/app.js @@ -0,0 +1,13 @@ +import { createContext } from 'react'; + +/** + * @typedef AppContext + * + * @prop {string} appName name of the application (probably Login.gov) + */ + +const AppContext = createContext(/** @type {AppContext} */ ({ appName: '' })); + +AppContext.displayName = 'AppContext'; + +export default AppContext; diff --git a/app/javascript/packages/document-capture/context/index.js b/app/javascript/packages/document-capture/context/index.js index ebb651bca38..69c6662d2ce 100644 --- a/app/javascript/packages/document-capture/context/index.js +++ b/app/javascript/packages/document-capture/context/index.js @@ -1,3 +1,4 @@ +export { default as AppContext } from './app'; export { default as AssetContext } from './asset'; export { default as DeviceContext } from './device'; export { default as AcuantContext, Provider as AcuantContextProvider } from './acuant'; diff --git a/app/javascript/packs/document-capture.jsx b/app/javascript/packs/document-capture.jsx index 7e9c809f4c7..d2d16028432 100644 --- a/app/javascript/packs/document-capture.jsx +++ b/app/javascript/packs/document-capture.jsx @@ -1,5 +1,6 @@ import { render } from 'react-dom'; import { + AppContext, DocumentCapture, AssetContext, DeviceContext, @@ -133,39 +134,45 @@ loadPolyfills(['fetch', 'crypto', 'url']).then(async () => { const keepAlive = () => window.fetch(keepAliveEndpoint, { method: 'POST', headers: { 'X-CSRF-Token': csrf } }); + const appContext = { + appName: /** @type string */ (appRoot.dataset.appName), + }; + render( -<%= t('account_reset.confirm_delete_account.info_html', app: APP_NAME, email: email) %>
+<%= t('account_reset.confirm_delete_account.info_html', email: email) %>
<%= t('account_reset.confirm_delete_account.cta_html', link: link_to(t('account_reset.confirm_delete_account.link_text'), sign_up_email_path)) %>
diff --git a/app/views/account_reset/delete_account/show.html.erb b/app/views/account_reset/delete_account/show.html.erb index 14466afc2cd..03be192f4f3 100644 --- a/app/views/account_reset/delete_account/show.html.erb +++ b/app/views/account_reset/delete_account/show.html.erb @@ -4,7 +4,7 @@ <%= t('account_reset.delete_account.title') %>- <%= t('account_reset.delete_account.info', app: APP_NAME) %> + <%= t('account_reset.delete_account.info', app_name: APP_NAME) %>
- <%= t('account.connected_apps.description') %> + <%= t('account.connected_apps.description', app_name: APP_NAME) %>
<%= t( 'instructions.sp_handoff_bounced', + app_name: APP_NAME, sp_name: @sp_name, sp_link: @sp_link.blank? ? @sp_name : link_to(@sp_name, @sp_link), ) %> diff --git a/app/views/idv/cancel.html.erb b/app/views/idv/cancel.html.erb index 4a1526c612f..d3070ba9415 100644 --- a/app/views/idv/cancel.html.erb +++ b/app/views/idv/cancel.html.erb @@ -5,7 +5,7 @@
- <%= t('idv.messages.cancel', app: APP_NAME) %> + <%= t('idv.messages.cancel', app_name: APP_NAME) %>
<%= link_to t('forms.buttons.back'), idv_path %> diff --git a/app/views/idv/cancellations/destroy.html.erb b/app/views/idv/cancellations/destroy.html.erb index 1eb4f49b397..7fb76ce6add 100644 --- a/app/views/idv/cancellations/destroy.html.erb +++ b/app/views/idv/cancellations/destroy.html.erb @@ -3,7 +3,7 @@ title: t('titles.idv.cancelled'), heading: @hybrid_session ? t('idv.cancel.headings.confirmation.hybrid') : - t('headings.cancellations.confirmation'), + t('headings.cancellations.confirmation', app_name: APP_NAME), ) do %> <% if @hybrid_session %><%= t('doc_auth.instructions.switch_back') %>
@@ -11,8 +11,8 @@ <% else %>- <%= t('idv.messages.come_back_later', app: APP_NAME) %> + <%= t('idv.messages.come_back_later', app_name: APP_NAME) %> <% if decorated_session.sp_name.present? %> <%= t('idv.messages.come_back_later_sp_html', sp: decorated_session.sp_name) %> <% else %> - <%= t('idv.messages.come_back_later_no_sp_html', app: APP_NAME) %> + <%= t('idv.messages.come_back_later_no_sp_html', app_name: APP_NAME) %> <% end %>
<%= t( 'doc_auth.info.privacy_html', + app_name: APP_NAME, link: new_window_link_to( t('doc_auth.instructions.learn_more'), MarketingSite.security_and_privacy_practices_url, diff --git a/app/views/idv/phone_errors/_warning.html.erb b/app/views/idv/phone_errors/_warning.html.erb index 242731bb604..ccb0822efc8 100644 --- a/app/views/idv/phone_errors/_warning.html.erb +++ b/app/views/idv/phone_errors/_warning.html.erb @@ -16,7 +16,7 @@ locals: options: [ local_assigns[:contact_support_option] && { url: MarketingSite.contact_url, - text: t('idv.troubleshooting.options.contact_support', app: APP_NAME), + text: t('idv.troubleshooting.options.contact_support', app_name: APP_NAME), new_tab: true, }, FeatureManagement.enable_gpo_verification? && { diff --git a/app/views/idv/phone_errors/failure.html.erb b/app/views/idv/phone_errors/failure.html.erb index 57ebc61f7cc..bd75ad9db9c 100644 --- a/app/views/idv/phone_errors/failure.html.erb +++ b/app/views/idv/phone_errors/failure.html.erb @@ -14,7 +14,7 @@ }, { url: MarketingSite.contact_url, - text: t('idv.troubleshooting.options.contact_support', app: APP_NAME), + text: t('idv.troubleshooting.options.contact_support', app_name: APP_NAME), new_tab: true, }, ].select(&:present?), diff --git a/app/views/idv/review/new.html.erb b/app/views/idv/review/new.html.erb index 000890a9ae0..2548e53c99f 100644 --- a/app/views/idv/review/new.html.erb +++ b/app/views/idv/review/new.html.erb @@ -10,15 +10,15 @@ <% end %>
- <%= t('idv.messages.sessions.review_message') %> + <%= t('idv.messages.sessions.review_message', app_name: APP_NAME) %>
<%= new_window_link_to( - t('idv.messages.sessions.read_more_encrypt'), + t('idv.messages.sessions.read_more_encrypt', app_name: APP_NAME), MarketingSite.security_url, ) %> diff --git a/app/views/idv/session_errors/exception.html.erb b/app/views/idv/session_errors/exception.html.erb index f95c478568c..f5b5131cd7e 100644 --- a/app/views/idv/session_errors/exception.html.erb +++ b/app/views/idv/session_errors/exception.html.erb @@ -9,7 +9,7 @@ options: [ { url: MarketingSite.contact_url, - text: t('idv.troubleshooting.options.contact_support', app: APP_NAME), + text: t('idv.troubleshooting.options.contact_support', app_name: APP_NAME), new_tab: true, }, decorated_session.sp_name && { diff --git a/app/views/idv/session_errors/failure.html.erb b/app/views/idv/session_errors/failure.html.erb index 096067332c7..7070056b7b5 100644 --- a/app/views/idv/session_errors/failure.html.erb +++ b/app/views/idv/session_errors/failure.html.erb @@ -13,7 +13,7 @@ }, { url: MarketingSite.contact_url, - text: t('idv.troubleshooting.options.contact_support', app: APP_NAME), + text: t('idv.troubleshooting.options.contact_support', app_name: APP_NAME), new_tab: true, }, ].select(&:present?), diff --git a/app/views/idv/session_errors/throttled.html.erb b/app/views/idv/session_errors/throttled.html.erb index 6b9270c1daa..ba6e69c75b0 100644 --- a/app/views/idv/session_errors/throttled.html.erb +++ b/app/views/idv/session_errors/throttled.html.erb @@ -14,7 +14,7 @@ }, { url: MarketingSite.contact_url, - text: t('idv.troubleshooting.options.contact_support', app: APP_NAME), + text: t('idv.troubleshooting.options.contact_support', app_name: APP_NAME), new_tab: true, }, ].select(&:present?), diff --git a/app/views/idv/shared/_document_capture.html.erb b/app/views/idv/shared/_document_capture.html.erb index 6267968fbc1..e5d33a9ab26 100644 --- a/app/views/idv/shared/_document_capture.html.erb +++ b/app/views/idv/shared/_document_capture.html.erb @@ -17,6 +17,7 @@ session_id = flow_session[:document_capture_session_uuid] %> <%= tag.div id: 'document-capture-form', data: { + app_name: APP_NAME, liveness_required: liveness_checking_enabled?.presence, mock_client: (DocAuthRouter.doc_auth_vendor(discriminator: session_id) == 'mock').presence, document_capture_session_uuid: flow_session[:document_capture_session_uuid], diff --git a/app/views/layouts/account_side_nav.html.erb b/app/views/layouts/account_side_nav.html.erb index 1262437b6cc..bded646a8b4 100644 --- a/app/views/layouts/account_side_nav.html.erb +++ b/app/views/layouts/account_side_nav.html.erb @@ -16,10 +16,10 @@<%= link_to( - t('mailer.about', app: APP_NAME), + t('mailer.about', app_name: APP_NAME), MarketingSite.base_url, style: 'text-decoration: underline;', ).html_safe %> diff --git a/app/views/sign_up/registrations/_registration_heading.html.erb b/app/views/sign_up/registrations/_registration_heading.html.erb index db94f8b7dac..cae9f8d213a 100644 --- a/app/views/sign_up/registrations/_registration_heading.html.erb +++ b/app/views/sign_up/registrations/_registration_heading.html.erb @@ -1,3 +1,3 @@