@tesouro/embedded-components-react 0.7.41 → 0.7.43
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 +110 -23
- package/dist/index.css +11 -0
- package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/mocks/acceptDisclosures.js +33 -28
- package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/mocks/labels.js +6 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/BankAccountOnboardingWidget.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/BusinessDetailsStep.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/PersonalDetailsStep.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/businessDetailsPanelMapping.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/personalDetailsPanelMapping.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/mocks/bankAccountOnboarding.js +40 -22
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/mocks/labels.js +14 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index.js +8 -10
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index17.js +274 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index18.js +30 -4
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index19.js +21 -272
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index20.js +65 -26
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index21.js +341 -21
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index22.js +27 -65
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index23.js +26 -341
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index24.js +72 -27
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index25.js +85 -26
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index26.js +8 -74
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index27.js +55 -83
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index28.js +7 -6
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index29.js +42 -37
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/mocks/expenseManagement.js +163 -140
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/mocks/labels.js +22 -16
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/mocks/labels.js +12 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/mocks/settings.js +255 -88
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/scenarios/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index30.js +0 -11
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index31.js +0 -64
package/README.md
CHANGED
|
@@ -8,52 +8,139 @@ This package is the public npm surface for Tesouro embedded React widgets.
|
|
|
8
8
|
apps (Vite, webpack, esbuild, Next.js). `react` and `react-dom` (v19) are peer
|
|
9
9
|
dependencies.
|
|
10
10
|
|
|
11
|
+
These steps put one widget on screen: a token route on your server, a provider
|
|
12
|
+
in the browser, and the widget itself. The examples use the Next.js App Router.
|
|
13
|
+
|
|
14
|
+
### Before you start
|
|
15
|
+
|
|
16
|
+
You need three credentials from Tesouro: a client ID, a client secret and a
|
|
17
|
+
widget secret. Authentication › User token in the
|
|
18
|
+
[Embedded Banking](https://docs.tesouro.com/embedded-banking/guides/authentication/user-token)
|
|
19
|
+
or [FinOps](https://docs.tesouro.com/finops/guides/authentication/user-token)
|
|
20
|
+
docs explains how to request them. All three stay on your server.
|
|
21
|
+
|
|
22
|
+
### 1. Install
|
|
23
|
+
|
|
11
24
|
```bash
|
|
12
25
|
npm install @tesouro/embedded-components-react
|
|
13
|
-
|
|
26
|
+
npm install @tesouro/embedded-components-widget-token
|
|
14
27
|
```
|
|
15
28
|
|
|
16
|
-
|
|
17
|
-
|
|
29
|
+
The second package mints widget tokens and handles your secrets, so only your
|
|
30
|
+
server imports it.
|
|
31
|
+
|
|
32
|
+
### 2. Add a token route
|
|
33
|
+
|
|
34
|
+
A widget acts as one of your users, authenticated by a short-lived widget token
|
|
35
|
+
that your server mints. This route handler, at `app/api/widget-token/route.ts`,
|
|
36
|
+
returns the `{ widgetToken, exp }` shape the provider in step 3 expects:
|
|
18
37
|
|
|
19
38
|
```ts
|
|
20
|
-
import '
|
|
39
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
40
|
+
import { configureCreateWidgetToken } from '@tesouro/embedded-components-widget-token';
|
|
41
|
+
|
|
42
|
+
const mintWidgetToken = configureCreateWidgetToken({
|
|
43
|
+
clientId: process.env.TESOURO_CLIENT_ID!,
|
|
44
|
+
clientSecret: process.env.TESOURO_CLIENT_SECRET!,
|
|
45
|
+
widgetSecret: process.env.TESOURO_WIDGET_SECRET!,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export async function POST(req: NextRequest) {
|
|
49
|
+
const session = await getSession(req);
|
|
50
|
+
if (!session) {
|
|
51
|
+
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const { widgetToken, exp } = await mintWidgetToken({
|
|
55
|
+
userId: session.userId,
|
|
56
|
+
userEmail: session.userEmail,
|
|
57
|
+
organizationReference: session.organizationReference,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return NextResponse.json(
|
|
61
|
+
{ widgetToken, exp },
|
|
62
|
+
{ headers: { 'Cache-Control': 'no-store' } },
|
|
63
|
+
);
|
|
64
|
+
}
|
|
21
65
|
```
|
|
22
66
|
|
|
23
|
-
|
|
67
|
+
`getSession` stands in for your own server-side session check. Take the user
|
|
68
|
+
and their `organizationReference` (your stable ID for the business they belong
|
|
69
|
+
to) from that session, never from the request: the route mints a valid token
|
|
70
|
+
for whatever identity it's given. Never expose the three credentials to the
|
|
71
|
+
browser, for example through a `NEXT_PUBLIC_` variable.
|
|
72
|
+
|
|
73
|
+
[`@tesouro/embedded-components-widget-token`](https://www.npmjs.com/package/@tesouro/embedded-components-widget-token)
|
|
74
|
+
documents the other options, including the token lifetime.
|
|
75
|
+
|
|
76
|
+
Backend not on Node? Build the token yourself: Authentication › User token in
|
|
77
|
+
the [Embedded Banking](https://docs.tesouro.com/embedded-banking/guides/authentication/user-token)
|
|
78
|
+
or [FinOps](https://docs.tesouro.com/finops/guides/authentication/user-token)
|
|
79
|
+
docs specifies its claims and encryption. Your route returns the same
|
|
80
|
+
`{ widgetToken, exp }`.
|
|
81
|
+
|
|
82
|
+
### 3. Add the provider
|
|
83
|
+
|
|
84
|
+
`RefreshingRootWidgetProvider` calls your route on mount, fetches a new token
|
|
85
|
+
shortly before `exp`, and shares the signed-in scope with every widget inside
|
|
86
|
+
it. It runs in the browser, so in the App Router it goes in a Client Component
|
|
87
|
+
that your root layout renders, such as `app/providers.tsx`. Import the
|
|
88
|
+
stylesheet there too: widgets render unstyled without it.
|
|
24
89
|
|
|
25
90
|
```tsx
|
|
91
|
+
'use client';
|
|
92
|
+
|
|
26
93
|
import '@tesouro/embedded-components-react/styles.css';
|
|
94
|
+
import type { ReactNode } from 'react';
|
|
27
95
|
import {
|
|
28
|
-
|
|
29
|
-
|
|
96
|
+
RefreshingRootWidgetProvider,
|
|
97
|
+
type WidgetTokenFetcher,
|
|
30
98
|
} from '@tesouro/embedded-components-react';
|
|
31
99
|
|
|
32
|
-
|
|
100
|
+
const fetcher: WidgetTokenFetcher = async () => {
|
|
101
|
+
const res = await fetch('/api/widget-token', { method: 'POST' });
|
|
102
|
+
if (!res.ok) throw new Error('Widget token request failed');
|
|
103
|
+
return res.json();
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export function Providers({ children }: { children: ReactNode }) {
|
|
33
107
|
return (
|
|
34
|
-
<
|
|
35
|
-
baseUrl="https://api.tesouro.com"
|
|
36
|
-
|
|
37
|
-
organizationId="org_…"
|
|
108
|
+
<RefreshingRootWidgetProvider
|
|
109
|
+
baseUrl="https://api.sandbox.tesouro.com"
|
|
110
|
+
fetcher={fetcher}
|
|
38
111
|
>
|
|
39
|
-
|
|
40
|
-
</
|
|
112
|
+
{children}
|
|
113
|
+
</RefreshingRootWidgetProvider>
|
|
41
114
|
);
|
|
42
115
|
}
|
|
43
116
|
```
|
|
44
117
|
|
|
45
|
-
`
|
|
46
|
-
|
|
47
|
-
|
|
118
|
+
Use `https://api.sandbox.tesouro.com` while you build and
|
|
119
|
+
`https://api.tesouro.com` in production.
|
|
120
|
+
|
|
121
|
+
### 4. Render a widget
|
|
122
|
+
|
|
123
|
+
Any widget inside the provider is ready to use:
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
import { BankAccountsWidget } from '@tesouro/embedded-components-react';
|
|
127
|
+
|
|
128
|
+
export default function AccountsPage() {
|
|
129
|
+
return <BankAccountsWidget />;
|
|
130
|
+
}
|
|
131
|
+
```
|
|
48
132
|
|
|
49
|
-
|
|
50
|
-
|
|
133
|
+
Browse the widgets for
|
|
134
|
+
[Embedded Banking](https://components.tesouro.com/components?product=embedded-banking)
|
|
135
|
+
or [FinOps](https://components.tesouro.com/components?product=finops). Every provider
|
|
136
|
+
and widget prop is typed in the shipped declarations, so your editor documents
|
|
137
|
+
them inline.
|
|
51
138
|
|
|
52
139
|
### Entry points
|
|
53
140
|
|
|
54
141
|
| Import path | What you get |
|
|
55
142
|
| ------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
56
|
-
| `@tesouro/embedded-components-react` | All widgets, `WidgetSuite`,
|
|
143
|
+
| `@tesouro/embedded-components-react` | All widgets, `WidgetSuite`, and the providers, including `RefreshingRootWidgetProvider`. |
|
|
57
144
|
| `@tesouro/embedded-components-react/styles.css` | The widget stylesheet. See [About the stylesheet](#about-the-stylesheet). |
|
|
58
145
|
| `@tesouro/embedded-components-react/core` | Framework-agnostic token utilities (`createWidgetTokenManager`). |
|
|
59
146
|
| `@tesouro/embedded-components-react/monite-sdk` | Legacy surface being removed, with no compatibility promise. See [below](#monite-sdk-entry-point). |
|
|
@@ -112,7 +199,7 @@ App-level provider. Resolves `baseUrl` / `widgetToken` / `organizationId` (falli
|
|
|
112
199
|
| `gatewayRouting` | `boolean` | Forces widget-gateway routing on (`true`) or off (`false`); unset, it applies automatically to known Tesouro API hosts. Falls back to `global.gatewayRouting`. |
|
|
113
200
|
| `linkComponent` | `LinkComponent` | Host link component widgets use for navigational links. Falls back to `global.linkComponent`. |
|
|
114
201
|
| `uiFramework` | `'shadcn' \| 'tecton' \| null` | UI framework for this tree; falls back to `global.uiFramework`, then `'shadcn'`. |
|
|
115
|
-
| `implementation` | `'native' \| 'monite' \| null` |
|
|
202
|
+
| `implementation` | `'native' \| 'monite' \| null` | Reserved for widgets with more than one build; no widget reads it today. Falls back to `global.implementation`, then `'native'`. |
|
|
116
203
|
| `analytics` | `boolean` | Enables anonymous analytics (default `true`); `false` disables capture and skips loading PostHog. |
|
|
117
204
|
| `unstable_initResponseOverride` | `WidgetInitResponse` | First-party hosts only: skips the init fetch and uses this object as `initResponse`. Embed integrations minting widget JWEs must leave this unset. |
|
|
118
205
|
| `disclosuresAcceptance` | `ReactNode` | Accept surface shown when the user owes disclosures; pass `<AcceptDisclosuresWidget />`. Cascades to nested providers. |
|
|
@@ -134,7 +221,7 @@ Mid-tree or standalone provider. With no props it is a transparent pass-through
|
|
|
134
221
|
| `gatewayRouting` | `boolean` | Forces widget-gateway routing on or off for this subtree's client; unset, it applies to known Tesouro API hosts. Inherits when omitted. |
|
|
135
222
|
| `linkComponent` | `LinkComponent` | Overrides the host link component for this subtree. Inherits when omitted. |
|
|
136
223
|
| `uiFramework` | `'shadcn' \| 'tecton' \| null` | Overrides the UI framework for this subtree; omitted or `null` inherits, defaulting to `'shadcn'`. |
|
|
137
|
-
| `implementation` | `'native' \| 'monite' \| null` |
|
|
224
|
+
| `implementation` | `'native' \| 'monite' \| null` | Reserved for widgets with more than one build; no widget reads it today. Omitted or `null` inherits, defaulting to `'native'`. |
|
|
138
225
|
| `errorFallback` | `ReactNode \| (props: FallbackProps) => ReactNode` | Custom error-boundary fallback: a node, or a function receiving `{ error, resetErrorBoundary }`. |
|
|
139
226
|
| `onError` | `(error: unknown, info: ErrorInfo) => void` | Telemetry hook, called once per caught error before the fallback renders. |
|
|
140
227
|
| `analytics` | `boolean` | Enables anonymous analytics (default `true`); honored only in standalone mode, ignored on a nested provider. |
|
|
@@ -169,7 +256,7 @@ Bundles `WidgetTokenRefreshProvider` + `RootWidgetProvider` and wires the live t
|
|
|
169
256
|
| `gatewayRouting` | `RootWidgetProvider` | Overrides widget-gateway routing; unset, it applies automatically for known Tesouro API hosts. |
|
|
170
257
|
| `linkComponent` | `RootWidgetProvider` | Component used in place of plain `<a>` tags inside widgets. |
|
|
171
258
|
| `uiFramework` | `RootWidgetProvider` | `'shadcn'` (default) or `'tecton'`; inherits down the provider cascade. |
|
|
172
|
-
| `implementation` | `RootWidgetProvider` |
|
|
259
|
+
| `implementation` | `RootWidgetProvider` | Reserved for widgets with more than one build; no widget reads it today. Inherits down the cascade. |
|
|
173
260
|
| `analytics` | `RootWidgetProvider` | Enables anonymous analytics (default `true`); set `false` to disable capture. |
|
|
174
261
|
| `unstable_initResponseOverride` | `RootWidgetProvider` | First-party hosts only. Skips the init fetch and supplies host-authored identity for the subtree. |
|
|
175
262
|
| `disclosuresAcceptance` | `RootWidgetProvider` | Accept surface shown when the user owes disclosures. Cascades to nested providers. |
|
package/dist/index.css
CHANGED
|
@@ -1674,11 +1674,22 @@
|
|
|
1674
1674
|
.ttw\:border-collapse {
|
|
1675
1675
|
border-collapse: collapse;
|
|
1676
1676
|
}
|
|
1677
|
+
.ttw\:border-separate {
|
|
1678
|
+
border-collapse: separate;
|
|
1679
|
+
}
|
|
1677
1680
|
.ttw\:border-spacing-0 {
|
|
1678
1681
|
--tw-border-spacing-x: 0px;
|
|
1679
1682
|
--tw-border-spacing-y: 0px;
|
|
1680
1683
|
border-spacing: var(--tw-border-spacing-x) var(--tw-border-spacing-y);
|
|
1681
1684
|
}
|
|
1685
|
+
.ttw\:border-spacing-x-6 {
|
|
1686
|
+
--tw-border-spacing-x: calc(var(--ttw-spacing) * 6);
|
|
1687
|
+
border-spacing: var(--tw-border-spacing-x) var(--tw-border-spacing-y);
|
|
1688
|
+
}
|
|
1689
|
+
.ttw\:border-spacing-y-2 {
|
|
1690
|
+
--tw-border-spacing-y: calc(var(--ttw-spacing) * 2);
|
|
1691
|
+
border-spacing: var(--tw-border-spacing-x) var(--tw-border-spacing-y);
|
|
1692
|
+
}
|
|
1682
1693
|
.ttw\:origin-\(--radix-dropdown-menu-content-transform-origin\) {
|
|
1683
1694
|
transform-origin: var(--radix-dropdown-menu-content-transform-origin);
|
|
1684
1695
|
}
|
|
@@ -1,62 +1,67 @@
|
|
|
1
1
|
import { A_DISCLOSURES_SET as e, A_DISCLOSURE_ACCEPTANCE as t, NO_DISCLOSURES_OWED as n } from "../../../../shared/data-access-mocks/dist/lib/fixtures.js";
|
|
2
|
-
import { IDENTITY as r,
|
|
3
|
-
import { ACCEPT_DISCLOSURES_LABELS as
|
|
2
|
+
import { IDENTITY as r, LOADING_DELAY_MS as i, endpoint as a, initRoute as o, json as s, problem as c, wait as l } from "../../../../shared/data-access-mocks/dist/mocks/scenarios/scenario.js";
|
|
3
|
+
import { ACCEPT_DISCLOSURES_LABELS as u } from "./labels.js";
|
|
4
4
|
//#region ../../libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/mocks/acceptDisclosures.js
|
|
5
|
-
var
|
|
5
|
+
var d = "/api/widget-gateway/disclosure-acceptance", f = `${r}/disclosures`, p = {
|
|
6
6
|
status: "INVITED",
|
|
7
7
|
disclosuresRequired: "REQUIRED",
|
|
8
8
|
disclosuresAccepted: !1,
|
|
9
9
|
vspName: "Example Payments",
|
|
10
10
|
bankName: "Example Bank"
|
|
11
|
-
},
|
|
11
|
+
}, m = {
|
|
12
12
|
status: "ACTIVE",
|
|
13
13
|
disclosuresAccepted: !0
|
|
14
14
|
};
|
|
15
15
|
if (!e.disclosures?.[0]) throw Error("A_DISCLOSURES_SET has no PERSON disclosure");
|
|
16
|
-
var
|
|
16
|
+
var h = (e) => ({
|
|
17
17
|
...e,
|
|
18
18
|
disclosures: e.disclosures?.map((e) => ({
|
|
19
19
|
...e,
|
|
20
20
|
accepted: !0
|
|
21
21
|
}))
|
|
22
|
-
}),
|
|
23
|
-
let
|
|
22
|
+
}), g = n, _ = ({ init: e, read: n, accept: r, acceptDelayMs: i }) => () => {
|
|
23
|
+
let c = !1, u = 0;
|
|
24
24
|
return [
|
|
25
|
-
(t) =>
|
|
25
|
+
(t) => o([], {
|
|
26
26
|
...e,
|
|
27
|
-
...
|
|
27
|
+
...c ? m : {}
|
|
28
28
|
})(t),
|
|
29
|
-
|
|
29
|
+
a("GET", f, () => {
|
|
30
30
|
let e = n();
|
|
31
|
-
return e instanceof Response ? e :
|
|
31
|
+
return e instanceof Response ? e : s(c ? h(e) : e);
|
|
32
32
|
}),
|
|
33
|
-
|
|
33
|
+
a("POST", d, async () => (i && await l(i), u += 1, r?.(u) || (c = !0, s(t))))
|
|
34
34
|
];
|
|
35
|
-
},
|
|
35
|
+
}, v = (e, t) => ({
|
|
36
36
|
key: e,
|
|
37
|
-
...
|
|
38
|
-
routes:
|
|
39
|
-
}),
|
|
40
|
-
|
|
41
|
-
init:
|
|
37
|
+
...u.scenarios[e],
|
|
38
|
+
routes: _(t)
|
|
39
|
+
}), y = [
|
|
40
|
+
v("default", {
|
|
41
|
+
init: p,
|
|
42
42
|
read: () => e
|
|
43
43
|
}),
|
|
44
|
-
|
|
44
|
+
v("nothing-owed", {
|
|
45
45
|
init: {
|
|
46
|
-
...
|
|
46
|
+
...p,
|
|
47
47
|
disclosuresRequired: "NOT_REQUIRED"
|
|
48
48
|
},
|
|
49
|
-
read: () =>
|
|
49
|
+
read: () => g
|
|
50
50
|
}),
|
|
51
|
-
|
|
52
|
-
init:
|
|
53
|
-
read: () =>
|
|
51
|
+
v("read-failed", {
|
|
52
|
+
init: p,
|
|
53
|
+
read: () => c(503, "Service Unavailable", "The disclosures service is unavailable.")
|
|
54
54
|
}),
|
|
55
|
-
|
|
56
|
-
init:
|
|
55
|
+
v("accept-failed", {
|
|
56
|
+
init: p,
|
|
57
57
|
read: () => e,
|
|
58
|
-
accept: (e) => e === 1 ?
|
|
58
|
+
accept: (e) => e === 1 ? c(503, "Service Unavailable", "Your acceptance could not be recorded right now. Try again in a moment.") : void 0
|
|
59
|
+
}),
|
|
60
|
+
v("accepting", {
|
|
61
|
+
init: p,
|
|
62
|
+
read: () => e,
|
|
63
|
+
acceptDelayMs: i
|
|
59
64
|
})
|
|
60
65
|
];
|
|
61
66
|
//#endregion
|
|
62
|
-
export {
|
|
67
|
+
export { d as DISCLOSURE_ACCEPTANCE, y as acceptDisclosuresScenarios };
|
|
@@ -10,11 +10,15 @@ var e = { scenarios: {
|
|
|
10
10
|
},
|
|
11
11
|
"read-failed": {
|
|
12
12
|
label: "Documents fail to load",
|
|
13
|
-
blurb: "The documents read fails with a 503, so the widget shows its own error
|
|
13
|
+
blurb: "The documents read fails with a 503, so the widget shows its own load error in place of the agreement. Try again re-issues the read, which fails again."
|
|
14
14
|
},
|
|
15
15
|
"accept-failed": {
|
|
16
16
|
label: "Accept fails",
|
|
17
|
-
blurb: "The acceptance write fails with a 503 on the first press. The error appears under Accept
|
|
17
|
+
blurb: "The acceptance write fails with a 503 on the first press. The widget’s own error appears under Accept and the form stays usable; press Accept again and it goes through."
|
|
18
|
+
},
|
|
19
|
+
accepting: {
|
|
20
|
+
label: "Accept in progress",
|
|
21
|
+
blurb: "The acceptance write is held. Tick the agreement and press Accept: the checkbox and Accept lock and Accept shows its busy state for as long as the write is outstanding."
|
|
18
22
|
}
|
|
19
23
|
} };
|
|
20
24
|
//#endregion
|
|
@@ -25,8 +25,8 @@ import { ADDITIONAL_OWNERS_LABELS_EN as fe } from "../../../../ui/dist/index6.js
|
|
|
25
25
|
import { interpolateBankName as pe } from "../../../../ui/dist/index8.js";
|
|
26
26
|
import { ApplicationStatusCard as me } from "../../../../ui/dist/index11.js";
|
|
27
27
|
import { ResultStep as he } from "../../../../ui/dist/index15.js";
|
|
28
|
-
import { UnsavedApplicationDialog as ge } from "../../../../ui/dist/
|
|
29
|
-
import { DeleteApplicationDialog as _e } from "../../../../ui/dist/
|
|
28
|
+
import { UnsavedApplicationDialog as ge } from "../../../../ui/dist/index27.js";
|
|
29
|
+
import { DeleteApplicationDialog as _e } from "../../../../ui/dist/index29.js";
|
|
30
30
|
import "../../../../ui/dist/index.js";
|
|
31
31
|
import { DEFAULT_LABELS as p } from "./labels.js";
|
|
32
32
|
import { OnboardingApplicationView as ve, applicationStatusNoticeFor as ye, hiddenViewReason as be, isNoticeView as xe, mergeApplicationStatusLabels as Se, onboardingApplicationViewFor as Ce } from "./applicationStatusView.js";
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import { BusinessDetailsPanel as e } from "../../../../ui/dist/
|
|
6
|
-
import { BusinessDisclosuresSection as t } from "../../../../ui/dist/
|
|
5
|
+
import { BusinessDetailsPanel as e } from "../../../../ui/dist/index20.js";
|
|
6
|
+
import { BusinessDisclosuresSection as t } from "../../../../ui/dist/index25.js";
|
|
7
7
|
import "../../../../ui/dist/index.js";
|
|
8
8
|
import { bankAccountOnboardingTestIds as n } from "./testIds.js";
|
|
9
9
|
import { ALWAYS_CHECK as r, buildBusinessDetailsPanelFieldsSchema as i, buildBusinessDetailsSchema as a, isTaxIdSatisfied as o } from "./stepSchemas.js";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import { AboutYouPanel as e } from "../../../../ui/dist/
|
|
5
|
+
import { AboutYouPanel as e } from "../../../../ui/dist/index24.js";
|
|
6
6
|
import "../../../../ui/dist/index.js";
|
|
7
7
|
import { bankAccountOnboardingTestIds as t } from "./testIds.js";
|
|
8
8
|
import { getMaxBirthDate as n } from "./fieldInput/maxBirthDate.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BUSINESS_DETAILS_LABELS_EN as e } from "../../../../ui/dist/index8.js";
|
|
2
|
-
import { BUSINESS_DETAILS_PANEL_LABELS_EN as t } from "../../../../ui/dist/
|
|
2
|
+
import { BUSINESS_DETAILS_PANEL_LABELS_EN as t } from "../../../../ui/dist/index19.js";
|
|
3
3
|
import "../../../../ui/dist/index.js";
|
|
4
4
|
import { maskIdentifierLast4 as n } from "./fieldInput/maskIdentifierLast4.js";
|
|
5
5
|
import { storedIdentifierFieldDisplay as r, usableStoredTaxIdLast4 as i } from "./fieldInput/storedIdentifier.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PERSONAL_DETAILS_LABELS_EN as e } from "../../../../ui/dist/index9.js";
|
|
2
|
-
import { ABOUT_YOU_PANEL_LABELS_EN as t } from "../../../../ui/dist/
|
|
2
|
+
import { ABOUT_YOU_PANEL_LABELS_EN as t } from "../../../../ui/dist/index23.js";
|
|
3
3
|
import "../../../../ui/dist/index.js";
|
|
4
4
|
import { maskIdentifierLast4 as n } from "./fieldInput/maskIdentifierLast4.js";
|
|
5
5
|
import { storedIdentifierFieldDisplay as r } from "./fieldInput/storedIdentifier.js";
|
|
@@ -28,44 +28,62 @@ var m = `${a}/bank-account-applications`, h = `${m}/:id`, g = `${a}/application-
|
|
|
28
28
|
submittedAt: null,
|
|
29
29
|
applicantFirstName: "Jordan",
|
|
30
30
|
applicantLastName: "Lee"
|
|
31
|
-
}, w = (
|
|
32
|
-
|
|
31
|
+
}, w = 864e5, T = (e) => (/* @__PURE__ */ new Date(Date.now() - e * w)).toISOString(), E = (e, t = {}) => ({
|
|
32
|
+
...S(x, e, null),
|
|
33
|
+
submittedAt: T(5),
|
|
34
|
+
updatedAt: T(e === "DENIED" ? 2 : 5),
|
|
35
|
+
...t
|
|
36
|
+
}), D = ({ draft: a, approves: d, others: f = [], settled: p, failsFirstSubmit: b = !1 }) => () => {
|
|
37
|
+
let x = a ?? null, C = p?.(), w = 0, T = "DRAFT", E = 0, D = "cs_demo_application_secret", k = () => C ? [C, ...f] : x ? (T === "SUBMITTED" && d && (E += 1, E > 2 && (T = "COMPLETE")), [S(x, T, T === "DRAFT" ? D : null), ...f]) : f;
|
|
33
38
|
return [
|
|
34
|
-
(e) => s([],
|
|
35
|
-
o("GET", g, () => c({ applications:
|
|
39
|
+
(e) => s([], T === "COMPLETE" ? y : v)(e),
|
|
40
|
+
o("GET", g, () => c({ applications: k() })),
|
|
36
41
|
o("GET", `${i}/disclosures`, () => c(n)),
|
|
37
42
|
o("POST", _, () => c(r)),
|
|
38
|
-
o("POST", m, () => (
|
|
39
|
-
...
|
|
40
|
-
clientSecret:
|
|
43
|
+
o("POST", m, () => (x = e, T = "DRAFT", c({
|
|
44
|
+
...x,
|
|
45
|
+
clientSecret: D
|
|
41
46
|
}, 201))),
|
|
42
|
-
o("GET", h, () =>
|
|
43
|
-
o("PATCH", h, () =>
|
|
44
|
-
o("POST", `${h}/submission`, () =>
|
|
45
|
-
...
|
|
46
|
-
status:
|
|
47
|
+
o("GET", h, () => x ? c(x) : O()),
|
|
48
|
+
o("PATCH", h, () => x ? c(x) : O()),
|
|
49
|
+
o("POST", `${h}/submission`, () => x ? (w += 1, b && w === 1 ? u(503, "Service Unavailable", "The application could not be submitted right now.") : (T = "SUBMITTED", E = 0, c({
|
|
50
|
+
...x,
|
|
51
|
+
status: T,
|
|
47
52
|
submittedAt: t.submittedAt
|
|
48
|
-
})) :
|
|
49
|
-
o("DELETE", h, () => (
|
|
53
|
+
}))) : O()),
|
|
54
|
+
o("DELETE", h, () => (T = "DELETED", l()))
|
|
50
55
|
];
|
|
51
|
-
},
|
|
56
|
+
}, O = () => u(404, "Not Found", "No such bank account application."), k = (e, t) => ({
|
|
52
57
|
key: e,
|
|
53
58
|
...p.scenarios[e],
|
|
54
|
-
routes:
|
|
55
|
-
}),
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
routes: D(t)
|
|
60
|
+
}), A = [
|
|
61
|
+
k("default", { approves: !0 }),
|
|
62
|
+
k("resume-draft", {
|
|
58
63
|
draft: x,
|
|
59
64
|
approves: !0
|
|
60
65
|
}),
|
|
61
|
-
|
|
66
|
+
k("under-review", {
|
|
62
67
|
draft: x,
|
|
63
68
|
approves: !1
|
|
64
69
|
}),
|
|
65
|
-
|
|
70
|
+
k("colleague-applied", {
|
|
66
71
|
approves: !0,
|
|
67
72
|
others: [C]
|
|
73
|
+
}),
|
|
74
|
+
k("submit-failed", {
|
|
75
|
+
draft: x,
|
|
76
|
+
approves: !0,
|
|
77
|
+
failsFirstSubmit: !0
|
|
78
|
+
}),
|
|
79
|
+
k("awaiting-review", {
|
|
80
|
+
approves: !1,
|
|
81
|
+
settled: () => E("SUBMITTED")
|
|
82
|
+
}),
|
|
83
|
+
k("denied", {
|
|
84
|
+
approves: !1,
|
|
85
|
+
settled: () => E("DENIED", { deniedAt: T(2) })
|
|
68
86
|
})
|
|
69
87
|
];
|
|
70
88
|
//#endregion
|
|
71
|
-
export {
|
|
89
|
+
export { A as bankAccountOnboardingScenarios };
|
|
@@ -13,8 +13,20 @@ var e = { scenarios: {
|
|
|
13
13
|
blurb: "The same prefilled draft, but the bank does not decide while the widget waits. Tick the disclosures, press Next twice and Submit: the widget polls every two seconds for about 30 seconds and then says the applicant is getting close and will be emailed."
|
|
14
14
|
},
|
|
15
15
|
"colleague-applied": {
|
|
16
|
-
label: "
|
|
17
|
-
blurb: "Another member of the organization already has an application in progress. The organization can hold only one, so the widget
|
|
16
|
+
label: "A colleague’s application in progress",
|
|
17
|
+
blurb: "Another member of the organization already has an application in progress. The organization can hold only one, so instead of the form the widget shows an “Application in progress” card explaining that only the person who started it can finish it."
|
|
18
|
+
},
|
|
19
|
+
"submit-failed": {
|
|
20
|
+
label: "Submission fails",
|
|
21
|
+
blurb: "The same prefilled draft, but the first submission fails with a 503. Tick the disclosures, press Next twice and Submit: the error appears above the footer buttons and everything entered stays in place. Press Submit again and it goes through."
|
|
22
|
+
},
|
|
23
|
+
"awaiting-review": {
|
|
24
|
+
label: "Returning while under review",
|
|
25
|
+
blurb: "The applicant submitted their application a few days ago and the bank has not decided yet. Instead of the form the widget shows an “Under review” card with the submission date and what happens next."
|
|
26
|
+
},
|
|
27
|
+
denied: {
|
|
28
|
+
label: "Application not approved",
|
|
29
|
+
blurb: "The bank denied the applicant’s application two days ago. Instead of the form the widget shows a “Not approved” card with the denial date; the card stops showing 30 days after the denial."
|
|
18
30
|
}
|
|
19
31
|
} };
|
|
20
32
|
//#endregion
|
package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index.js
CHANGED
|
@@ -6,15 +6,13 @@ import "./index10.js";
|
|
|
6
6
|
import { ApplicationStatusCard as a, ApplicationStatusTone as o } from "./index11.js";
|
|
7
7
|
import { ResultStep as s } from "./index15.js";
|
|
8
8
|
import { RESULT_LABELS_EN as c } from "./index16.js";
|
|
9
|
-
import "./
|
|
10
|
-
import "./
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
9
|
+
import { BUSINESS_DETAILS_PANEL_LABELS_EN as l } from "./index19.js";
|
|
10
|
+
import { BusinessDetailsPanel as u } from "./index20.js";
|
|
11
|
+
import { ABOUT_YOU_PANEL_LABELS_EN as d } from "./index23.js";
|
|
12
|
+
import { AboutYouPanel as f } from "./index24.js";
|
|
13
|
+
import { BusinessDisclosuresSection as p } from "./index25.js";
|
|
14
|
+
import "./index26.js";
|
|
15
|
+
import { UnsavedApplicationDialog as m } from "./index27.js";
|
|
16
16
|
import "./index28.js";
|
|
17
|
-
import {
|
|
18
|
-
import "./index30.js";
|
|
19
|
-
import { DeleteApplicationDialog as h } from "./index31.js";
|
|
17
|
+
import { DeleteApplicationDialog as h } from "./index29.js";
|
|
20
18
|
export { d as ABOUT_YOU_PANEL_LABELS_EN, e as ADDITIONAL_OWNERS_LABELS_EN, f as AboutYouPanel, t as AdditionalOwnersForm, a as ApplicationStatusCard, o as ApplicationStatusTone, n as BUSINESS_DETAILS_LABELS_EN, l as BUSINESS_DETAILS_PANEL_LABELS_EN, u as BusinessDetailsPanel, p as BusinessDisclosuresSection, h as DeleteApplicationDialog, i as PERSONAL_DETAILS_LABELS_EN, c as RESULT_LABELS_EN, s as ResultStep, m as UnsavedApplicationDialog, r as interpolateBankName };
|