Skip to content

IS-11275 LWA: viewName built-in UIs (first: BankID wait UI)#150

Open
aleixsuau wants to merge 2 commits intointegration/IS-5161/login-web-appfrom
feature/IS-11275/viewname-default-render-interceptors
Open

IS-11275 LWA: viewName built-in UIs (first: BankID wait UI)#150
aleixsuau wants to merge 2 commits intointegration/IS-5161/login-web-appfrom
feature/IS-11275/viewname-default-render-interceptors

Conversation

@aleixsuau
Copy link
Copy Markdown

@aleixsuau aleixsuau commented Apr 29, 2026

Jira: https://curity.atlassian.net/browse/IS-11275

Summary

Adds the built-in viewName UIs feature. The first use case covered is the BankID view name (authenticator/bankid/wait/index) to display:

  • Persistent spinner while polling status is pending (independent of loading).
  • QR code link rendered above the actions.

Read added docs (ui-kit/src/login-web-app/src/haapi-stepper/README.md:117, and ui-kit/src/login-web-app/src/haapi-stepper/feature/steps/HaapiStepperStepUI.tsx:84) and tests (ui-kit/src/login-web-app/src/haapi-stepper/feature/steps/HaapiStepperStepUI.tsx:84) for more details.

Test plan

  • Manual smoke against a running BankID flow (spinner persists during `pending`, drops on `done`/`failed`; QR rendered above the action group)

Notes

  • This branch is on top of `feature/IS-11241/rename-haapistepper-ui-components` and depends on the renames there. Once IS-11241 lands on `integration/IS-5161/login-web-app`, this branch should rebase onto integration.
  • The opt-in default (`undefined`) means existing consumers don't visibly change after this lands; new built-ins are purely additive.

@aleixsuau aleixsuau marked this pull request as ready for review April 29, 2026 08:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Introduces an opt-in “viewName built-in UIs” mechanism for HaapiStepperStepUI, with an initial built-in UI implementation for the BankID polling view (authenticator/bankid/wait/index) to improve UX (persistent polling spinner + QR link positioning).

Changes:

  • Adds a viewName-to-built-in-UI registry (getViewNameBuiltInUI, enum + map) and integrates it into HaapiStepperStepUI behind the enableViewNameBuiltInUIs prop.
  • Implements BankIdViewNameBuiltInUI to show a polling-status-based spinner and render the QR link above actions.
  • Extends test mocks and adds unit tests + README docs covering the new opt-in behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/login-web-app/src/haapi-stepper/util/tests/mocks.ts Adds BankID polling step and QR link helpers for new tests.
src/login-web-app/src/haapi-stepper/feature/viewnames/viewname.types.ts Introduces enum of viewNames with built-in UIs.
src/login-web-app/src/haapi-stepper/feature/viewnames/viewname-built-in-uis.ts Adds registry + selection logic for built-in UIs.
src/login-web-app/src/haapi-stepper/feature/viewnames/index.ts Barrel exports for the new viewnames feature.
src/login-web-app/src/haapi-stepper/feature/viewnames/BankIdViewNameBuiltInUI.tsx BankID-specific built-in UI rendering.
src/login-web-app/src/haapi-stepper/feature/steps/HaapiStepperStepUI.tsx Integrates built-in UI selection via new enableViewNameBuiltInUIs prop.
src/login-web-app/src/haapi-stepper/feature/steps/HaapiStepperStepUI.spec.tsx Adds tests validating built-in UI opt-in + BankID behavior.
src/login-web-app/src/haapi-stepper/README.md Documents the new built-in UI feature and how to enable it.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/login-web-app/src/haapi-stepper/util/tests/mocks.ts
Comment on lines +28 to +42
export const BankIdViewNameBuiltInUI = ({ currentStep, nextStep }: HaapiStepperAPIWithRequiredCurrentStep) => {
const { messages, actions, links } = currentStep.dataHelpers;
const isQrLink = (link: HaapiStepperLink) => link.subtype?.startsWith('image/') ?? false;
const qrLink = links.find(isQrLink);
const nonQrLinks = links.filter(link => !isQrLink(link));
const isPollingPending =
currentStep.type === HAAPI_STEPS.POLLING && currentStep.properties.status === HAAPI_POLLING_STATUS.PENDING;

return (
<Well>
{isPollingPending && <Spinner width={48} height={48} mode="fullscreen" data-testid="bankid-spinner" />}
<HaapiStepperMessagesUI messages={messages} />
{qrLink && <HaapiStepperLinksUI links={[qrLink]} onClick={nextStep} />}
<HaapiStepperActionsUI actions={actions?.all} onAction={nextStep} />
{nonQrLinks.length > 0 && <HaapiStepperLinksUI links={nonQrLinks} onClick={nextStep} />}
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

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

This built-in UI renders a spinner only when status === PENDING, but (unlike the generic HaapiStepperStepUI shell) it does not render any loading indicator when loading === true. As a result, when the polling step transitions (e.g. status becomes DONE/FAILED and a next step is being fetched), users may see no spinner even though the stepper is loading.

Suggestion: incorporate the stepper loading flag here (the prop is available via HaapiStepperAPIWithRequiredCurrentStep) so that a spinner is shown when loading is true, in addition to the "pending" spinner behavior.

Copilot uses AI. Check for mistakes.
@aleixsuau aleixsuau force-pushed the feature/IS-11241/rename-haapistepper-ui-components branch from 429ab4c to 66b0634 Compare April 30, 2026 13:24
@aleixsuau aleixsuau changed the base branch from feature/IS-11241/rename-haapistepper-ui-components to integration/IS-5161/login-web-app May 7, 2026 09:40
aleixsuau and others added 2 commits May 7, 2026 11:47
Rename the six UI components (Actions, Link, Links, Messages, ClientOperation,
HaapiSelector) plus HaapiStepperForm and the message element factory to the
existing HaapiStepper<Name>UI convention. This disambiguates the React
components from the HAAPI data interfaces they render (HaapiStepperLink vs
HaapiStepperLinkUI, etc.), preventing import collisions and making it obvious
at a glance which layer is being referenced. Also fixes stale HaapiUIStep and
Form.tsx references in README and JSDoc.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aleixsuau aleixsuau force-pushed the feature/IS-11275/viewname-default-render-interceptors branch from 872d350 to e2ec03d Compare May 7, 2026 09:50

### ViewName built-in UIs

Some HAAPI viewNames (`step.metadata.viewName`) need a UI that the generic step rendering can't deliver well. For example, the **BankID** screen needs to render a spinner while the polling status is `pending`, not only while `loading` is true, and lifts the QR code above the actions.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we don't need to be so specific here. Maybe just say some UIs need more tailored behavior or so.
Also no need to have such details in the table below.

) => {
return createMockStep(HAAPI_STEPS.POLLING, {
metadata: {
templateArea: 'lwa',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Detail: perhaps avoid having template areas if they are not needed. This is just a side-effect of the local dev setup, but it could be misleading for people reading these tests.

Comment thread src/login-web-app/src/haapi-stepper/util/tests/mocks.ts

### ViewName built-in UIs

Some HAAPI viewNames (`step.metadata.viewName`) need a UI that the generic step rendering can't deliver well. For example, the **BankID** screen needs to render a spinner while the polling status is `pending`, not only while `loading` is true, and lifts the QR code above the actions.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Btw: I think that "render a spinner while the polling status is pending" should be the default behavior for any polling step. I see you considered it out of scope of this ticket - and I recall there was more to be discussed about loading indicators - but please don't forget about that.

*
* The HaapiStepperStepUI component also provides built-in UIs for specific HAAPI `viewName`s that require a more
* tailored UI than the generic step shell can provide (e.g. the BankID QR code step, which requires lifting
* the QR code up and showing a spinner while polling).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Again, I don't think this is needed as it makes it look like the default is flawed.

* - `false` or `undefined` to keep all built-ins disabled (every view renders through the
* generic shell).
*
* Composition: the matching viewName built-in UI is rendered after the `stepRenderInterceptor` has processed the
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

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.

4 participants