Skip to content

LG-4381: Log Acuant SDK load on frontend#4849

Merged
aduth merged 2 commits intomainfrom
aduth-lg-4381-log-acuant-failure
Mar 29, 2021
Merged

LG-4381: Log Acuant SDK load on frontend#4849
aduth merged 2 commits intomainfrom
aduth-lg-4381-log-acuant-failure

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Mar 29, 2021

Why: To better understand issues that users may be having in completing the document capture step of the IAL2 flow, we should have insight into potential Acuant SDK load failures.

The details of the errors weren't known prior to starting the task. Documented here, they appear to be largely misconfiguration issues, ones which we likely won't often encounter. More interesting may be the sorts of errors that could be expected after Acuant SDK loads, and when the user attempts to start capture. This could be part of the discovery work involved in LG-4390.

**Why**: To better understand issues that users may be having in completing the document capture step of the IAL2 flow, we should have insight into potential Acuant SDK load failures.
@aduth aduth requested a review from amathews-fs March 29, 2021 13:26

render(
<DeviceContext.Provider value={device}>
<AcuantContextProvider
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes only move up the analytics provider. It's easier to see using "Hide whitespace changes" setting in GitHub:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related: Following a prior similar comment about moving to some flattened, "composed" provider implementation, I explored this a bit. I think it may help improve diffs in review, though I think the general readability does suffer a bit, at least in the explored implementation.

function ComposeComponents({ components, children }) {
  return components.reduceRight(
    (result, [Provider, props]) => (
      // eslint-disable-next-line react/jsx-props-no-spreading
      <Provider {...props}>{result}</Provider>
    ),
    children
  );
}
render(
  <ComposeComponents
    components={[
      [DeviceContext.Provider, { value: device }],
      [AnalyticsContext.Provider, { value: { addPageAction, noticeError } }],
      [
        AcuantContextProvider,
        {
          credentials: getMetaContent("acuant-sdk-initialization-creds"),
          endpoint: getMetaContent("acuant-sdk-initialization-endpoint"),
        },
      ],
      [
        UploadContextProvider,
        {
          endpoint: /** @type {string} */ (appRoot.getAttribute(
            "data-endpoint"
          )),
          statusEndpoint: /** @type {string} */ (appRoot.getAttribute(
            "data-status-endpoint"
          )),
          statusPollInterval:
            Number(appRoot.getAttribute("data-status-poll-interval-ms")) ||
            undefined,
          method: isAsyncForm ? "PUT" : "POST",
          csrf,
          isMockClient,
          backgroundUploadURLs,
          backgroundUploadEncryptKey,
          formData,
        },
      ],
      [I18nContext.Provider, { value: i18n.strings }],
      [ServiceProviderContext.Provider, { value: getServiceProvider() }],
      [AssetContext.Provider, { value: assets }],
    ]}
  >
    <DocumentCapture isAsyncForm={isAsyncForm} onStepChange={keepAlive} />
  </ComposeComponents>,
  appRoot
);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree -- a little diff noise here and there seems easier than trying to mentally unpack the loop

Copy link
Contributor

@mitchellhenke mitchellhenke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼 👍🏼 👍🏼

Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aduth aduth merged commit 0efaa3a into main Mar 29, 2021
@aduth aduth deleted the aduth-lg-4381-log-acuant-failure branch March 29, 2021 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants