@jpmorgan-payments/embedded-finance-components 0.5.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +245 -0
- package/dist/asset/docs/placeholder.pdf +0 -0
- package/dist/esm/ef-components.js +70336 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +1113 -0
- package/dist/mockServiceWorker.js +284 -0
- package/dist/umd/ef-components.js +358 -0
- package/package.json +169 -0
package/README.md
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# Embedded UI Components
|
|
2
|
+
|
|
3
|
+
## 🚧 Pre-release Version Notice
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
### ADA Compliance Disclaimer
|
|
8
|
+
|
|
9
|
+
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.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
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.
|
|
14
|
+
|
|
15
|
+
## Important Usage Notes
|
|
16
|
+
|
|
17
|
+
**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.
|
|
18
|
+
|
|
19
|
+
## Setup and Configuration
|
|
20
|
+
|
|
21
|
+
### EBComponentsProvider
|
|
22
|
+
|
|
23
|
+
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.
|
|
24
|
+
It is usign @tanstack/react-query for handling API calls and authentication as well as Orval generated types for the API requests and responses.
|
|
25
|
+
|
|
26
|
+
#### Key Props:
|
|
27
|
+
|
|
28
|
+
- `apiBaseUrl`: The base URL for API calls (required)
|
|
29
|
+
- `theme`: Customization options for the components' appearance (optional)
|
|
30
|
+
- `headers`: Custom headers for API requests (optional)
|
|
31
|
+
|
|
32
|
+
#### Usage:
|
|
33
|
+
|
|
34
|
+
```jsx
|
|
35
|
+
import { EBComponentsProvider } from '@jpmorgan-payments/embedded-finance-components';
|
|
36
|
+
|
|
37
|
+
const EmbeddedFinanceSection = () => {
|
|
38
|
+
return (
|
|
39
|
+
<EBComponentsProvider
|
|
40
|
+
apiBaseUrl="https://your-api-base-url.com"
|
|
41
|
+
theme={{
|
|
42
|
+
colorScheme: 'light',
|
|
43
|
+
variables: {
|
|
44
|
+
primaryColor: '#007bff',
|
|
45
|
+
fontFamily: 'Arial, sans-serif',
|
|
46
|
+
},
|
|
47
|
+
}}
|
|
48
|
+
headers={{
|
|
49
|
+
'Custom-Header': 'value',
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
{/* Your Embedded UI Components go here */}
|
|
53
|
+
</EBComponentsProvider>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Main Components
|
|
59
|
+
|
|
60
|
+
### 1. OnboardingWizard
|
|
61
|
+
|
|
62
|
+
The `OnboardingWizard` component implements the client onboarding process as described in the [Embedded Payments API documentation](https://developer.payments.jpmorgan.com/docs/embedded-finance-solutions/embedded-payments/how-to/onboard-a-client/onboard).
|
|
63
|
+
|
|
64
|
+
#### Main Features:
|
|
65
|
+
|
|
66
|
+
- Create a client profile
|
|
67
|
+
- Incremenrally update client's related parties
|
|
68
|
+
- Complete due diligence questions
|
|
69
|
+
- Handle client attestations
|
|
70
|
+
- Manage requests for additional documentation
|
|
71
|
+
- Check and display onboarding status
|
|
72
|
+
|
|
73
|
+
#### Usage:
|
|
74
|
+
|
|
75
|
+
```jsx
|
|
76
|
+
import {
|
|
77
|
+
EBComponentsProvider,
|
|
78
|
+
OnboardingWizard,
|
|
79
|
+
} from '@jpmorgan-payments/embedded-finance-components';
|
|
80
|
+
|
|
81
|
+
const OnboardingSection = () => {
|
|
82
|
+
const [clientId, setClientId] = useManageClientExternalState();
|
|
83
|
+
|
|
84
|
+
const handleClientCreation = ({ response, error }) => {
|
|
85
|
+
// Handle client creation response or error
|
|
86
|
+
setClientId(response.clientId);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const handleClientKYCInitiation = ({ response, error }) => {
|
|
90
|
+
// Handle KYC initiation response or error
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<EBComponentsProvider apiBaseUrl="https://your-api-base-url.com">
|
|
95
|
+
<OnboardingWizard
|
|
96
|
+
title="Client Onboarding"
|
|
97
|
+
clientId={clientId}
|
|
98
|
+
onClientCreation={handleClientCreation}
|
|
99
|
+
onClientKYCInitiation={handleClientKYCInitiation}
|
|
100
|
+
/>
|
|
101
|
+
</EBComponentsProvider>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
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.
|
|
107
|
+
|
|
108
|
+
### 2. LinkedAccountWidget
|
|
109
|
+
|
|
110
|
+
The `LinkedAccountWidget` component facilitates the process of adding a client's linked account, as described in the [Add Linked Account API documentation](https://developer.payments.jpmorgan.com/docs/embedded-finance-solutions/embedded-payments/how-to/add-linked-account).
|
|
111
|
+
|
|
112
|
+
#### Main Features:
|
|
113
|
+
|
|
114
|
+
- Add and manage external linked bank accounts for clients
|
|
115
|
+
- Handle complex micro-deposits initiation logic
|
|
116
|
+
|
|
117
|
+
#### Usage:
|
|
118
|
+
|
|
119
|
+
```jsx
|
|
120
|
+
import {
|
|
121
|
+
EBComponentsProvider,
|
|
122
|
+
LinkedAccountWidget,
|
|
123
|
+
} from '@jpmorgan-payments/embedded-finance-components';
|
|
124
|
+
|
|
125
|
+
const LinkedAccountSection = () => {
|
|
126
|
+
return (
|
|
127
|
+
<EBComponentsProvider apiBaseUrl="https://your-api-base-url.com">
|
|
128
|
+
<LinkedAccountWidget variant="default" />
|
|
129
|
+
</EBComponentsProvider>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Please refer to the LinkedAccountProps interface in the codebase for more details.
|
|
135
|
+
|
|
136
|
+
## Theming
|
|
137
|
+
|
|
138
|
+
The `EBComponentsProvider` accepts a `theme` prop that allows for extensive customization of the components' appearance. The theme object can include the following properties:
|
|
139
|
+
|
|
140
|
+
- `colorScheme`: 'dark' | 'light' | 'system'
|
|
141
|
+
- `variables`: An object containing various theme variables
|
|
142
|
+
- `light`: Light theme-specific variables
|
|
143
|
+
- `dark`: Dark theme-specific variables
|
|
144
|
+
|
|
145
|
+
### Theme Design Tokens
|
|
146
|
+
|
|
147
|
+
Here's a table of available theme design tokens that can be used in the `variables`, `light`, and `dark` properties:
|
|
148
|
+
|
|
149
|
+
| Token Name | Description |
|
|
150
|
+
| -------------------------- | -------------------------------------- |
|
|
151
|
+
| fontFamily | Main font family for text |
|
|
152
|
+
| backgroundColor | Background color of the main container |
|
|
153
|
+
| foregroundColor | Main text color |
|
|
154
|
+
| primaryColor | Primary brand color |
|
|
155
|
+
| primaryColorHover | Hover state of primary color |
|
|
156
|
+
| primaryForegroundColor | Text color on primary background |
|
|
157
|
+
| secondaryColor | Secondary brand color |
|
|
158
|
+
| secondaryForegroundColor | Text color on secondary background |
|
|
159
|
+
| destructiveColor | Color for destructive actions |
|
|
160
|
+
| destructiveForegroundColor | Text color on destructive background |
|
|
161
|
+
| mutedColor | Color for muted elements |
|
|
162
|
+
| mutedForegroundColor | Text color on muted background |
|
|
163
|
+
| accentColor | Accent color for highlights |
|
|
164
|
+
| accentForegroundColor | Text color on accent background |
|
|
165
|
+
| cardColor | Background color for card elements |
|
|
166
|
+
| cardForegroundColor | Text color for card elements |
|
|
167
|
+
| popoverColor | Background color for popovers |
|
|
168
|
+
| popoverForegroundColor | Text color for popovers |
|
|
169
|
+
| borderRadius | Default border radius for elements |
|
|
170
|
+
| buttonBorderRadius | Border radius specifically for buttons |
|
|
171
|
+
| borderColor | Color for borders |
|
|
172
|
+
| inputColor | Background color for input fields |
|
|
173
|
+
| ringColor | Color for focus rings |
|
|
174
|
+
| zIndexOverlay | z-index for overlay elements |
|
|
175
|
+
|
|
176
|
+
## Installation
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
npm install @jpmorgan-payments/embedded-finance-components
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
or
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
yarn add @jpmorgan-payments/embedded-finance-components
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Contributing
|
|
189
|
+
|
|
190
|
+
### Recommended VSCode plugins:
|
|
191
|
+
|
|
192
|
+
- Prettier
|
|
193
|
+
- Tailwind CSS Intellisense
|
|
194
|
+
|
|
195
|
+
### Recommended VS Code Settings
|
|
196
|
+
|
|
197
|
+
#### `files.associations`
|
|
198
|
+
|
|
199
|
+
Use the `files.associations` setting to tell VS Code to always open `.css` files in Tailwind CSS mode:
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
"files.associations": {
|
|
204
|
+
"\*.css": "tailwindcss"
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
#### `editor.quickSuggestions`
|
|
210
|
+
|
|
211
|
+
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:
|
|
212
|
+
|
|
213
|
+
```"editor.quickSuggestions": {
|
|
214
|
+
"strings": "on"
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Guidelines
|
|
219
|
+
|
|
220
|
+
1. Create a new component in `./src/core`
|
|
221
|
+
2. Export it in `./src/index.tsx`
|
|
222
|
+
3. Also add it to `./src/vanilla/componentRegistry.ts`
|
|
223
|
+
|
|
224
|
+
## npm scripts
|
|
225
|
+
|
|
226
|
+
## Build and dev scripts
|
|
227
|
+
|
|
228
|
+
- `dev` – start development server
|
|
229
|
+
- `build` – build production version of the app
|
|
230
|
+
- `preview` – locally preview production build
|
|
231
|
+
|
|
232
|
+
### Testing scripts
|
|
233
|
+
|
|
234
|
+
- `typecheck` – checks TypeScript types
|
|
235
|
+
- `lint` – runs ESLint
|
|
236
|
+
- `prettier:check` – checks files with Prettier
|
|
237
|
+
- `vitest` – runs vitest tests
|
|
238
|
+
- `vitest:watch` – starts vitest watch
|
|
239
|
+
- `test` – runs `vitest`, `prettier:check`, `lint` and `typecheck` scripts
|
|
240
|
+
|
|
241
|
+
### Other scripts
|
|
242
|
+
|
|
243
|
+
- `storybook` – starts storybook dev server
|
|
244
|
+
- `storybook:build` – build production storybook bundle to `storybook-static`
|
|
245
|
+
- `prettier:write` – formats all files with Prettier
|
|
Binary file
|