Rename doc_auth_selfie_capture config to doc_auth_selfie_capture_enabled#9782
Rename doc_auth_selfie_capture config to doc_auth_selfie_capture_enabled#9782
doc_auth_selfie_capture config to doc_auth_selfie_capture_enabled#9782Conversation
…nabled` The `doc_auth_selfie_capture` is a JSON hash that was intended to manage multiple configs for document selfie capture. Prior to this commit it contains a single value: `enabled`. Using an unstructured hash this way means we do not get many of the benefits of using IdentityConfig e.g. type valudation for configs and warnings/errors when configs are missing. This commit moves the enabled config from `doc_auth_selfie_capture` to `doc_auth_selfie_capture_enabled` and deletes the `doc_auth_selfie_capture` config. Future configs for selfie capture can use the `doc_auth_selfie_capture` prefix. [skip changelog]
|
Before this gets merged I am going to look at the application.yml files in deployed envs to make sure that |
| doc_auth_selfie_capture: { | ||
| enabled: IdentityConfig.store.doc_auth_selfie_capture_enabled, | ||
| }, |
There was a problem hiding this comment.
It'd also be nice to update this in the JavaScript code as well. Currently we bypass type-checking on this data attribute and perform a JSON.parse without error checking. I feel like we could get rid of that function altogether if we passed through the individual value.
diff --git a/app/javascript/packs/document-capture.tsx b/app/javascript/packs/document-capture.tsx
index 1a27313ef..d5df599ec 100644
--- a/app/javascript/packs/document-capture.tsx
+++ b/app/javascript/packs/document-capture.tsx
@@ -31,2 +31,3 @@ interface AppRootData {
acuantVersion: string;
+ docAuthSelfieCaptureEnabled: 'true' | 'false';
flowPath: FlowPath;
@@ -54,8 +55,2 @@ function getServiceProvider() {
-function getSelfieCaptureEnabled() {
- const { docAuthSelfieCapture } = appRoot.dataset;
- const docAuthSelfieCaptureObject = docAuthSelfieCapture ? JSON.parse(docAuthSelfieCapture) : {};
- return !!docAuthSelfieCaptureObject?.enabled;
-}
-
function getMetaContent(name): string | null {
@@ -95,2 +90,3 @@ const {
acuantVersion,
+ docAuthSelfieCaptureEnabled,
flowPath,
@@ -112,2 +108,4 @@ const {
+const selfieCaptureEnabled = docAuthSelfieCaptureEnabled === 'true';
+
let parsedUsStatesTerritories = [];
@@ -144,3 +142,3 @@ const App = composeComponents(
passiveLivenessOpenCVSrc: acuantVersion && `/acuant/${acuantVersion}/opencv.min.js`,
- passiveLivenessSrc: getSelfieCaptureEnabled()
+ passiveLivenessSrc: selfieCaptureEnabled
? acuantVersion && `/acuant/${acuantVersion}/AcuantPassiveLiveness.min.js`
@@ -194,3 +192,3 @@ const App = composeComponents(
exitQuestionSectionEnabled: String(uiExitQuestionSectionEnabled) === 'true',
- selfieCaptureEnabled: getSelfieCaptureEnabled(),
+ selfieCaptureEnabled,
},
diff --git a/app/views/idv/shared/_document_capture.html.erb b/app/views/idv/shared/_document_capture.html.erb
index d82035650..a33b0a70c 100644
--- a/app/views/idv/shared/_document_capture.html.erb
+++ b/app/views/idv/shared/_document_capture.html.erb
@@ -38,5 +38,3 @@
us_states_territories: us_states_territories,
- doc_auth_selfie_capture: {
- enabled: IdentityConfig.store.doc_auth_selfie_capture_enabled,
- },
+ doc_auth_selfie_capture_enabled: IdentityConfig.store.doc_auth_selfie_capture_enabled,
skip_doc_auth: skip_doc_auth,There was a problem hiding this comment.
I'll tag in @charleyf here since updating that portion of this seems firmly within the Timnit portion of this effort
charleyf
left a comment
There was a problem hiding this comment.
Approving based on our discussion in Slack. I just went and verified that the way getSelfieCaptureEnabled is written on the FE makes it so that I don't see a failure mode where we accidentally turn the feature on (my primary concern).
|
This looks good, thank you, @jmhooper! |
The
doc_auth_selfie_captureis a JSON hash that was intended to manage multiple configs for document selfie capture. Prior to this commit it contains a single value:enabled.Using an unstructured hash this way means we do not get many of the benefits of using IdentityConfig e.g. type validation for configs and warnings/errors when configs are missing.
This commit moves the enabled config from
doc_auth_selfie_capturetodoc_auth_selfie_capture_enabledand deletes thedoc_auth_selfie_captureconfig. Future configs for selfie capture can use thedoc_auth_selfie_captureprefix.