IS-11406 Extract haapi-react-sdk into its own npm workspace library#219
Open
aleixsuau wants to merge 1 commit into
Open
IS-11406 Extract haapi-react-sdk into its own npm workspace library#219aleixsuau wants to merge 1 commit into
aleixsuau wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request extracts haapi-react-sdk from inside haapi-react-app into a standalone npm workspace (src/haapi-react-sdk), and wires up tooling + CI so the SDK can be linted/typechecked/tested independently while the app consumes it as a workspace dependency.
Changes:
- Introduces a new
@curity/haapi-react-sdkworkspace with its own TypeScript, ESLint, Prettier, and Vitest configuration. - Moves/organizes HAAPI Stepper code (feature/ui/util/data-access) into the SDK workspace and adds tests for core UI/behavior.
- Updates the app and CI to depend on and validate the new SDK workspace (workspaces registration, dependency, workflow path triggers + steps).
Reviewed changes
Copilot reviewed 15 out of 114 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/haapi-react-sdk/package.json | New SDK workspace package manifest (deps/peers/scripts/engines). |
| src/haapi-react-sdk/tsconfig.json | SDK TS config (bundler resolution, strict settings, test types). |
| src/haapi-react-sdk/eslint.config.js | SDK ESLint flat config with typed rules and React plugins. |
| src/haapi-react-sdk/.prettierrc | SDK Prettier configuration. |
| src/haapi-react-sdk/.prettierignore | SDK Prettier ignore list. |
| src/haapi-react-sdk/vitest.config.ts | SDK Vitest configuration (jsdom, setup file, globals). |
| src/haapi-react-sdk/setupTests.ts | SDK test setup (jest-dom + dialog mocks). |
| src/haapi-react-sdk/vite-env.d.ts | Vite client type references for the SDK workspace. |
| src/haapi-react-sdk/haapi-stepper/README.md | Updates SDK documentation to reflect extraction + host stylesheet. |
| src/haapi-react-sdk/haapi-stepper/util/index.ts | SDK util barrel exports. |
| src/haapi-react-sdk/haapi-stepper/util/generic-render-interceptor.tsx | Shared interceptor utility for customizing render pipelines. |
| src/haapi-react-sdk/haapi-stepper/util/isQrCodeLink.ts | Helper to detect QR-code links by subtype. |
| src/haapi-react-sdk/haapi-stepper/util/isMobileDevice.ts | Mobile device detection helper. |
| src/haapi-react-sdk/haapi-stepper/util/useRefCallBack.tsx | Stable callback ref hook to avoid stale closures. |
| src/haapi-react-sdk/haapi-stepper/util/useThrowErrorToAppErrorBoundary.ts | Hook to rethrow async errors during render for boundaries. |
| src/haapi-react-sdk/haapi-stepper/util/types/helpers.ts | Utility type helpers. |
| src/haapi-react-sdk/haapi-stepper/util/tests/mocks.ts | Test factories for steps/actions/links/messages and helpers. |
| src/haapi-react-sdk/haapi-stepper/ui/index.ts | SDK UI barrel exports. |
| src/haapi-react-sdk/haapi-stepper/ui/spinner/Spinner.tsx | Spinner UI component. |
| src/haapi-react-sdk/haapi-stepper/ui/spinner/spinner.module.css | Spinner CSS module styles. |
| src/haapi-react-sdk/haapi-stepper/ui/messages/HaapiStepperMessageUI.tsx | Default message rendering rules (heading/userCode/userName). |
| src/haapi-react-sdk/haapi-stepper/ui/messages/HaapiStepperMessagesUI.tsx | Messages list component with render interception. |
| src/haapi-react-sdk/haapi-stepper/ui/messages/defaultHaapiStepperMessageElementFactory.tsx | Default message element factory. |
| src/haapi-react-sdk/haapi-stepper/ui/links/HaapiStepperLinkUI.tsx | Link UI (button vs QR-code figure/button). |
| src/haapi-react-sdk/haapi-stepper/ui/links/defaultHaapiStepperLinkElementFactory.tsx | Default link element factory. |
| src/haapi-react-sdk/haapi-stepper/ui/links/HaapiStepperQrCodeLinkDialog.tsx | QR-code dialog behavior (open/focus/close/refresh on link updates). |
| src/haapi-react-sdk/haapi-stepper/ui/links/HaapiStepperLinksUI.tsx | Links list component with dialog integration + interception. |
| src/haapi-react-sdk/haapi-stepper/ui/links/HaapiStepperLinkUI.spec.tsx | Tests for link rendering and click behavior. |
| src/haapi-react-sdk/haapi-stepper/ui/links/HaapiStepperLinksUI.spec.tsx | Tests for link list rendering, interception, and QR dialog behavior. |
| src/haapi-react-sdk/haapi-stepper/ui/icons/authenticator-icons.ts | Authenticator type → icon mapping via @curity/ui-kit-icons. |
| src/haapi-react-sdk/haapi-stepper/ui/actions/HaapiStepperActionsUI.tsx | Actions list component with subtype-specific interceptors. |
| src/haapi-react-sdk/haapi-stepper/ui/actions/defaultHaapiStepperActionElementFactory.tsx | Default action element factory (form/selector/client-operation). |
| src/haapi-react-sdk/haapi-stepper/ui/actions/HaapiStepperActionsUI.spec.tsx | Tests for actions rendering and interceptor behavior. |
| src/haapi-react-sdk/haapi-stepper/feature/index.ts | Feature barrel exports for public SDK surface. |
| src/haapi-react-sdk/haapi-stepper/feature/steps/typings.ts | Shared step UI prop typings to avoid runtime cycles. |
| src/haapi-react-sdk/haapi-stepper/feature/steps/step-element-factories.tsx | Factories for loading/error/messages/actions/links elements. |
| src/haapi-react-sdk/haapi-stepper/feature/steps/HaapiStepperStepUI.tsx | Step UI composition entry point. |
| src/haapi-react-sdk/haapi-stepper/feature/steps/HaapiStepperStepUI.spec.tsx | Step UI behavior tests. |
| src/haapi-react-sdk/haapi-stepper/feature/viewnames/viewname.types.ts | Enum of viewNames with built-in UIs. |
| src/haapi-react-sdk/haapi-stepper/feature/viewnames/viewname-built-in-uis.ts | Built-in viewName UI registry + resolver. |
| src/haapi-react-sdk/haapi-stepper/feature/viewnames/typings.ts | Props for built-in viewName UIs. |
| src/haapi-react-sdk/haapi-stepper/feature/viewnames/BankIdViewNameBuiltInUI.tsx | Built-in BankID UI (QR link placement tweaks). |
| src/haapi-react-sdk/haapi-stepper/feature/viewnames/index.ts | Viewnames barrel exports. |
| src/haapi-react-sdk/haapi-stepper/feature/stepper/HaapiStepper.tsx | Main Stepper component implementation (state, effects, nextStep pipeline). |
| src/haapi-react-sdk/haapi-stepper/feature/stepper/HaapiStepper.spec.tsx | Stepper behavior tests. |
| src/haapi-react-sdk/haapi-stepper/feature/stepper/haapi-stepper.types.ts | Public types for stepper API/data helpers/interceptors. |
| src/haapi-react-sdk/haapi-stepper/feature/stepper/HaapiStepperContext.tsx | Stepper context definition. |
| src/haapi-react-sdk/haapi-stepper/feature/stepper/HaapiStepperHook.ts | Hook to read stepper context (use). |
| src/haapi-react-sdk/haapi-stepper/feature/stepper/HaapiStepperErrorNotifier.tsx | Toast-like error notifier for app/input errors. |
| src/haapi-react-sdk/haapi-stepper/feature/stepper/HaapiStepperErrorNotifier.spec.tsx | Tests for error notifier behavior. |
| src/haapi-react-sdk/haapi-stepper/feature/stepper/data-formatters/format-next-step-data.ts | Formats steps with dataHelpers and action/link/message IDs. |
| src/haapi-react-sdk/haapi-stepper/feature/stepper/data-formatters/problem-step.ts | Formats problem steps into app vs input errors. |
| src/haapi-react-sdk/haapi-stepper/feature/stepper/data-formatters/continue-same-step.ts | Handles continue-same-step formatting/merging. |
| src/haapi-react-sdk/haapi-stepper/feature/stepper/step-handlers/authentication-or-registration-step.ts | Handler for auth/registration step logic (WebAuthn auto-start). |
| src/haapi-react-sdk/haapi-stepper/feature/stepper/step-handlers/polling-step.ts | Handler for polling steps (interval, BankID auto-start, poll action). |
| src/haapi-react-sdk/haapi-stepper/feature/stepper/step-handlers/completed-step.ts | Handler for completion step auto-redirect behavior. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/selector/HaapiStepperSelectorUI.tsx | Selector action UI (renders nested form options). |
| src/haapi-react-sdk/haapi-stepper/feature/actions/form/HaapiStepperFormContext.ts | Form context + use hook. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/form/HaapiStepperFormHook.ts | Form state hook (Map values, get/set helpers). |
| src/haapi-react-sdk/haapi-stepper/feature/actions/form/HaapiStepperFormHook.spec.ts | Tests for form state behavior. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/form/HaapiStepperFormUI.tsx | Form UI with interceptors/composition patterns and submit handling. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/form/HaapiStepperFormSubmitButton.tsx | Submit button component (label/icon/class computation). |
| src/haapi-react-sdk/haapi-stepper/feature/actions/form/HaapiStepperFormSubmitButton.spec.tsx | Submit button tests. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/form/HaapiStepperFormValidationErrorInputWrapper.tsx | Wrapper to render field-level validation errors from stepper input errors. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/form/fields/HaapiStepperFormFieldUI.tsx | Field type switch (text/password/select/checkbox). |
| src/haapi-react-sdk/haapi-stepper/feature/actions/form/fields/HaapiStepperTextFormFieldUI.tsx | Text/username field UI. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/form/fields/HaapiStepperPasswordFormFieldUI.tsx | Password UI with visibility toggle. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/form/fields/HaapiStepperSelectFormFieldUI.tsx | Select field UI. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/form/fields/HaapiStepperCheckboxFormFieldUI.tsx | Checkbox field UI. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/form/fields/defaultHaapiStepperFormFieldElementFactory.tsx | Default field factory (wraps with validation error wrapper). |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/HaapiStepperClientOperationUI.tsx | Client-operation action UI (availability gate, progress). |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/HaapiStepperClientOperationUI.spec.tsx | Client-operation UI tests (WebAuthn gating, progress, splits). |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/useIsClientOperationAvailable.ts | Runtime availability logic for client operations. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/client-operations.ts | Dispatch + execution for client operations (WebAuthn/EBF/BankID). |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/typings.ts | Shared client-operation result typing. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/helpers.ts | Helper to synthesize HaapiStepperError for client-side failures. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/webauthn/index.ts | WebAuthn operation exports. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/webauthn/typings.ts | WebAuthn error/operation enums. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/webauthn/utils.ts | WebAuthn guards/splitting/auto-start requirements helpers. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/webauthn/useIsWebAuthnPlatformAuthenticatorAvailable.ts | Hook to resolve platform authenticator availability. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/webauthn/auto-start.ts | Auto-start logic for WebAuthn operations. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/webauthn/webauthn.ts | WebAuthn registration/authentication runners. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/external-browser-flow/index.ts | External browser flow operation exports. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/external-browser-flow/typings.ts | External browser flow error enum. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/external-browser-flow/external-browser-flow.ts | External browser flow runner implementation. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/external-browser-flow/external-browser-flow.spec.ts | External browser flow tests. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/bankid/index.ts | BankID operation exports. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/bankid/utils.ts | BankID operation type guard. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/bankid/open-bankid-app.ts | BankID app launch helper. |
| src/haapi-react-sdk/haapi-stepper/feature/actions/client-operation/operations/bankid/bankid.ts | BankID runner implementation. |
| src/haapi-react-sdk/haapi-stepper/data-access/index.ts | Data-access barrel exports. |
| src/haapi-react-sdk/haapi-stepper/data-access/useHaapiFetch.ts | Hook wrapping HAAPI driver with single-config contract. |
| src/haapi-react-sdk/haapi-stepper/data-access/useHaapiFetch.spec.ts | Tests for HAAPI fetch hook behavior and single-config constraint. |
| src/haapi-react-sdk/haapi-stepper/data-access/haapi-fetch-request.ts | Executes HAAPI fetch requests and validates response media type. |
| src/haapi-react-sdk/haapi-stepper/data-access/haapi-fetch-utils.ts | Builds request URL/init from HAAPI action + payload. |
| src/haapi-react-sdk/haapi-stepper/data-access/haapi-fetch-utils.spec.ts | Tests for request-building behavior across media types/methods. |
| src/haapi-react-sdk/haapi-stepper/data-access/types/index.ts | Types barrel exports. |
| src/haapi-react-sdk/haapi-stepper/data-access/types/media.types.ts | Media type enum. |
| src/haapi-react-sdk/haapi-stepper/data-access/types/haapi-fetch.types.ts | HAAPI fetch action/payload types. |
| src/haapi-react-sdk/haapi-stepper/data-access/types/haapi-form.types.ts | Form field/action model typing. |
| src/haapi-react-sdk/haapi-stepper/data-access/types/haapi-action.types.ts | HAAPI action typing (including client-operation shapes). |
| src/haapi-react-sdk/haapi-stepper/data-access/types/haapi-step.types.ts | HAAPI step typing (including polling/completed/problem). |
| src/haapi-react-app/package.json | App now depends on the extracted @curity/haapi-react-sdk workspace. |
| src/haapi-react-app/vite.config.ts | Removes in-app SDK alias now that SDK is a workspace dependency. |
| src/haapi-react-app/previewer/vite.config.ts | Removes previewer SDK alias now that SDK is a workspace dependency. |
| src/haapi-react-app/tsconfig.app.json | Removes TS path alias for the previously in-app SDK path. |
| src/haapi-react-app/setupTests.ts | Removes dialog mocks now owned by the SDK’s test setup. |
| src/haapi-react-app/.prettierignore | Formatting-only update. |
| package.json | Registers src/haapi-react-sdk in root workspaces. |
| .github/workflows/lwa-github-ci-workflow.yml | Adds SDK path triggers and SDK lint/typecheck/test/format steps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
267a4dd to
b18d03d
Compare
Move the SDK out of the app into a standalone workspace at src/haapi-react-sdk with its own lint/test/typecheck tooling (no build). The app consumes it transparently via the npm workspace symlink — no Vite alias or tsconfig paths. CI gains SDK steps + a path trigger. App setupTests slimmed (dialog mocks now SDK-only). 312 tests preserved. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
b18d03d to
9303435
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira: https://curity.atlassian.net/browse/IS-11406
Extracts the
haapi-react-sdkfolder (previously nested insidehaapi-react-app) into a standalone npm workspace library.Changes
git mv src/haapi-react-app/src/haapi-react-sdk → src/haapi-react-sdk.package.json(@curity/haapi-react-sdk; depshaapi-web-driver+ui-kit-icons; peerreact/react-dom; scriptslint/test/typecheck; no build),tsconfig.json,eslint.config.js,vitest.config.ts,setupTests.ts,vite-env.d.ts,.prettierrc,.prettierignore.src/haapi-react-sdkin the rootworkspaces; app declares@curity/haapi-react-sdkas a dependency.src/haapi-react-sdk/**path trigger + SDK prettier/lint/typecheck/test steps.Out of scope
Built
dist/publishable packaging (exports/.d.ts); moving the.haapi-*global CSS into the SDK.