Developing with the Universal Access Responsive Web Application
Find out how to use the provided development resources to customize the IBM® Universal Access Responsive
Web Application reference application and build your
custom application.
Starter pack and packages
Using the IBM Universal Access Responsive Web Application starter pack and packages, and Social Program Management Design System packages, as your starting point, you can customize Universal Access for your organization.
Sample application project structure
The project structure is based on the Facebook create-react-app
.
Developing compliantly
Follow these guidelines to protect your project from making customization changes that are incompatible with the base product, or have the potential to incur upgrade impacts.
Enforce code style with ESlint
To help you to run static code analysis on your code, the spm-eslint-config package contains an ESLint configuration with predefined coding style rules and an EditorConfig configuration file.
Universal Access UI coding conventions
The universal-access-ui
package is responsible for the presentation of the UI in the application. Coding conventions ensure that the UI code is separated by responsibilities, which gives benefits such as easier maintenance. Features, Components, and Messages are coded to render each page of the application.
The sampleApplication feature
The sample feature illustrates the principles, tools, and technologies for developing features in the application. It implements a simple Apply for Benefits workflow that complies with the coding conventions.
Manage state with React Hooks
React Hooks enable you to use state, execute effects, and other React features without writing a class. You can use hooks to subscribe to the Redux store and dispatch actions, without having to wrap your components in connect()
.
Redux in Universal Access
Redux is used as a client-side store to store data that is retrieved by IBM Cúram Social Program Management APIs and data that is used to present a consistent user experience.
Error handling with a React higher-order component (HOC)
You can use the withErrorBoundary
function as a higher-order component (HOC) to handle API errors on features. You can then focus on implementing components and delegate the error handling to the function. Additionally, this approach reduces the amount of code that is needed to implement the component and its tests.
Connectivity handling
By default, a connectivity handler prevents data loss in IEG forms and provides offline detection for the rest of the application. You see a warning message when you are disconnected, giving you a chance to check your internet connectivity. You see a success message when you recover connectivity. You can choose to prevent data loss in pages outside IEG forms by implementing the connectivity handler for other pages in the application.
Developing with routes
Routes define the valid endpoints for navigation in your application. Your application consists of a network of routes that can be traversed by your users to access the application's pages.
Connecting to Universal Access REST APIs
You must connect your web application to IBM Cúram Social Program Management Universal Access REST APIs. You can use the RESTService
utility, and the mock server API service or SPM APIs to help you to develop and test your REST API connections.
Developing toast notifications
A toast as a computing term refers to a graphical control element that communicates certain events to the user without forcing them to react to the notification immediately. In the Universal Access Responsive Web Application , we use the design system Alert
component as a base to represent our toast notifications and allow capability to display these notifications independent of the main display content in any function within the application.
Localization
You can add languages to the application, and apply regional settings for calendar and date formats, and for currencies.
Customizing the application
As a developer, use these simple scenarios to learn how customize the IBM Universal Access Responsive Web Application .
Implementing page view analytics
You can implement page view analytics in your application to collect citizen page views for analysis. Using the included page view JavaScript functions, you can start tracking page views by implementing a callback to send tracking data to a library of your choice for analysis. In this example, the data is sent to the Google global site tag (gtag.js) JavaScript tagging framework.
Implementing a test environment
Use the test-framework package to set up your IBM Universal Access Responsive Web Application test environment for testing with Test Cafe, Jest, and Enzyme. Then, use this guidance and the provided helper files to write end-to-end tests, unit tests, or snapshot tests for your project. You can configure the default test environment to suit your project requirements as needed.
React environment variable reference
A full list of Universal Access React environment variables categorized by function. You can set environmental variables in .env files in the root directory of your application. If you omit environment variables, either they are not set or the default values apply.