0.5.53 • Published 9 months ago

@jpmorgan-payments/embedded-banking-components v0.5.53

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
9 months ago

Embedded UI Components

🚧 Pre-release Version Notice

Embedded UI Components and this guide is currently in draft form and under active development. Components are not ready for production use and may change significantly until version 1.x.x is released. Please consider this document as a work in progress.

ADA Compliance Disclaimer

While we strive to incorporate ADA (Americans with Disabilities Act) best practices, please note that developers are responsible for conducting their own comprehensive ADA testing to ensure full compliance with all applicable standards and regulations.

Overview

Embedded UI Components offer a seamless way to integrate sophisticated UI components into your existing applications, providing a plug-and-play solution for Embedded Finance features. These components implement complex API capabilities for client onboarding and account linking, simplifying the integration process for developers.

Important Usage Notes

All Embedded UI Components must be wrapped within the EBComponentsProvider. The EBComponentsProvider is specifically designed for these components and is not applicable to any other client components in your application.

Setup and Configuration

EBComponentsProvider

The EBComponentsProvider is a crucial wrapper component that must be placed at the top level of your Embedded UI Components implementation. It handles authentication, applies theming, and provides necessary context to all child Embedded UI Components. It is usign @tanstack/react-query for handling API calls and authentication as well as Orval generated types for the API requests and responses.

Key Props:

  • apiBaseUrl: The base URL for API calls (required)
  • theme: Customization options for the components' appearance (optional)
  • headers: Custom headers for API requests (optional)

Usage:

import { EBComponentsProvider } from '@jpmorgan-payments/embedded-banking-components';

const EmbeddedFinanceSection = () => {
  return (
    <EBComponentsProvider 
      apiBaseUrl="https://your-api-base-url.com"
      theme={{
        colorScheme: 'light',
        variables: {
          primaryColor: '#007bff',
          fontFamily: 'Arial, sans-serif',
        }
      }}
      headers={{
        'Custom-Header': 'value'
      }}
    >
      {/* Your Embedded UI Components go here */}
    </EBComponentsProvider>
  );
};

Main Components

1. OnboardingWizard

The OnboardingWizard component implements the client onboarding process as described in the Embedded Payments API documentation.

Main Features:

  • Create a client profile
  • Incremenrally update client's related parties
  • Complete due diligence questions
  • Handle client attestations
  • Manage requests for additional documentation
  • Check and display onboarding status

Usage:

import { EBComponentsProvider, OnboardingWizard } from '@jpmorgan-payments/embedded-banking-components';

const OnboardingSection = () => {
  const [clientId, setClientId] = useManageClientExternalState();

  const handleClientCreation = ({ response, error }) => {
    // Handle client creation response or error
    setClientId(response.clientId);
  };

  const handleClientKYCInitiation = ({ response, error }) => {
    // Handle KYC initiation response or error
  };

  return (
    <EBComponentsProvider apiBaseUrl="https://your-api-base-url.com">
      <OnboardingWizard
        title="Client Onboarding"
        clientId={clientId}
        onClientCreation={handleClientCreation}
        onClientKYCInitiation={handleClientKYCInitiation}
      />
    </EBComponentsProvider>
  );
};

OnboardingWizard could also accept products and jurisdictions as optional props to customize the onboarding process. Please refer to the OnboardingWizardProps interface in the codebase for more details.

2. LinkedAccountWidget

The LinkedAccountWidget component facilitates the process of adding a client's linked account, as described in the Add Linked Account API documentation.

Main Features:

  • Add and manage external linked bank accounts for clients
  • Handle complex micro-deposits initiation logic

Usage:

import { EBComponentsProvider, LinkedAccountWidget } from '@jpmorgan-payments/embedded-banking-components';

const LinkedAccountSection = () => {
  return (
    <EBComponentsProvider apiBaseUrl="https://your-api-base-url.com">
      <LinkedAccountWidget variant="default" />
    </EBComponentsProvider>
  );
};

Please refer to the LinkedAccountProps interface in the codebase for more details.

Theming

The EBComponentsProvider accepts a theme prop that allows for extensive customization of the components' appearance. The theme object can include the following properties:

  • colorScheme: 'dark' | 'light' | 'system'
  • variables: An object containing various theme variables
  • light: Light theme-specific variables
  • dark: Dark theme-specific variables

Theme Design Tokens

Here's a table of available theme design tokens that can be used in the variables, light, and dark properties:

Token NameDescription
fontFamilyMain font family for text
backgroundColorBackground color of the main container
foregroundColorMain text color
primaryColorPrimary brand color
primaryColorHoverHover state of primary color
primaryForegroundColorText color on primary background
secondaryColorSecondary brand color
secondaryForegroundColorText color on secondary background
destructiveColorColor for destructive actions
destructiveForegroundColorText color on destructive background
mutedColorColor for muted elements
mutedForegroundColorText color on muted background
accentColorAccent color for highlights
accentForegroundColorText color on accent background
cardColorBackground color for card elements
cardForegroundColorText color for card elements
popoverColorBackground color for popovers
popoverForegroundColorText color for popovers
borderRadiusDefault border radius for elements
buttonBorderRadiusBorder radius specifically for buttons
borderColorColor for borders
inputColorBackground color for input fields
ringColorColor for focus rings
zIndexOverlayz-index for overlay elements

Installation

npm install @jpmorgan-payments/embedded-banking-components

or

yarn add @jpmorgan-payments/embedded-banking-components

Contributing

Recommended VSCode plugins:

  • Prettier
  • Tailwind CSS Intellisense

Recommended VS Code Settings

files.associations

Use the files.associations setting to tell VS Code to always open .css files in Tailwind CSS mode:

"files.associations": {
"\*.css": "tailwindcss"
}

editor.quickSuggestions

By default VS Code will not trigger completions when editing "string" content, for example within JSX attribute values. Updating the editor.quickSuggestions setting may improve your experience:

  "strings": "on"
}

Guidelines

  1. Create a new component in ./src/core
  2. Export it in ./src/index.tsx
  3. Also add it to ./src/vanilla/componentRegistry.ts

npm scripts

Build and dev scripts

  • dev – start development server
  • build – build production version of the app
  • preview – locally preview production build

Testing scripts

  • typecheck – checks TypeScript types
  • lint – runs ESLint
  • prettier:check – checks files with Prettier
  • vitest – runs vitest tests
  • vitest:watch – starts vitest watch
  • test – runs vitest, prettier:check, lint and typecheck scripts

Other scripts

  • storybook – starts storybook dev server
  • storybook:build – build production storybook bundle to storybook-static
  • prettier:write – formats all files with Prettier
0.5.52

9 months ago

0.5.53

9 months ago

0.5.51

9 months ago

0.5.50

9 months ago

0.5.49

9 months ago

0.5.47

9 months ago

0.5.45

10 months ago

0.5.46

9 months ago

0.5.38

10 months ago

0.5.39

10 months ago

0.5.36

10 months ago

0.5.37

10 months ago

0.5.35

11 months ago

0.5.43

10 months ago

0.5.44

10 months ago

0.5.41

10 months ago

0.5.42

10 months ago

0.5.40

10 months ago

0.5.32

11 months ago

0.5.10

12 months ago

0.5.33

11 months ago

0.5.11

12 months ago

0.5.30

11 months ago

0.5.31

11 months ago

0.5.8

12 months ago

0.5.7

12 months ago

0.5.9

12 months ago

0.5.16

12 months ago

0.5.14

12 months ago

0.3.13

1 year ago

0.5.15

12 months ago

0.3.12

1 year ago

0.5.34

11 months ago

0.5.13

12 months ago

0.5.21

11 months ago

0.5.22

11 months ago

0.5.20

11 months ago

0.5.29

11 months ago

0.5.27

11 months ago

0.5.28

11 months ago

0.5.24

11 months ago

0.5.4

12 months ago

0.4.5

12 months ago

0.4.4

1 year ago

0.5.6

12 months ago

0.5.5

12 months ago

0.5.0

12 months ago

0.4.1

1 year ago

0.4.0

1 year ago

0.5.2

12 months ago

0.4.3

1 year ago

0.5.1

12 months ago

0.4.2

1 year ago

0.1.0

1 year ago