@tesouro/embedded-components-react 0.11.222 → 0.11.224

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.
Files changed (21) hide show
  1. package/README.md +12 -2
  2. package/dist/index.d.ts +14 -2
  3. package/dist/lib/BankAccountOnboardingWidget.d.ts +12 -0
  4. package/dist/lib/WidgetProvider.d.ts +2 -2
  5. package/dist/lib/WidgetSuite.d.ts +12 -0
  6. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index.js +2 -1
  7. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index13.js +17 -0
  8. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/BankAccountOnboardingWidget.js +335 -321
  9. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/labels.js +9 -1
  10. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/testIds.js +2 -0
  11. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/analytics/events.js +2 -1
  12. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/deviceProfiling/DeviceProfiling.js +50 -0
  13. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/deviceProfiling/deviceProfilingPage.js +119 -0
  14. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/deviceProfiling/index.js +1 -0
  15. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/deviceProfiling/useDeviceProfiling.js +88 -0
  16. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/mocks/bankAccountOnboarding.js +57 -54
  17. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  18. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/index.js +3 -2
  19. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/csp.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/loadScript.js +17 -0
  21. package/package.json +1 -1
package/README.md CHANGED
@@ -189,7 +189,8 @@ ancestor `.dark` class, and you can set the widget font with `--ttw-font-family`
189
189
 
190
190
  The widgets run inside your page, so your Content Security Policy has to allow
191
191
  the origins they reach. Each is first-party Tesouro infrastructure or a URL you
192
- pass in; nothing is loaded from a third-party CDN.
192
+ pass in, except Alloy's, which bank account onboarding reaches only for a bank
193
+ that requires device profiling.
193
194
 
194
195
  This section covers the bundled install. For the hosted build, follow the
195
196
  loader guide's
@@ -201,6 +202,8 @@ instead.
201
202
  | Your `baseUrl`, e.g. `https://api.tesouro.com` | `connect-src` | Every API call. Use `https://api.sandbox.tesouro.com` in sandbox. |
202
203
  | `https://widgets.tesouro.com` | `script-src`; `blob:` in `worker-src` recommended | The pdf.js worker behind PDF previews in Bill Pay and Expenses. pdf.js loads a cross-origin worker through a blob wrapper; without `blob:` it falls back to the main thread, so previews still render, slower on large files. To skip this origin, self-host the worker the package ships at `@tesouro/embedded-components-react/pdf.worker.min.mjs` and call `configureCsp()`. |
203
204
  | `https://z.tesouro.com` | `connect-src` | Anonymous usage analytics. Not contacted when the provider has `analytics={false}`. |
205
+ | `https://scripts.alloy.com` | `script-src` | Alloy's device-profiling SDK, which `BankAccountOnboardingWidget` loads for a bank that requires it. The tag carries your page's nonce. The SDK then adds the scripts of the fraud vendors the bank enables in Alloy; ask the bank for their origins. |
206
+ | `https://docv-prod-api.alloy.co` | `connect-src`, `frame-src` | Alloy's API, called by its SDK, for the same banks. |
204
207
  | The file URLs the API returns | `img-src`, `connect-src` | Receipt images and PDF documents a user opens; the API tells you the host for your environment. |
205
208
 
206
209
  **You usually need no setup.** The widgets find your CSP nonce on the page,
@@ -224,6 +227,7 @@ Both settings apply to the whole page.
224
227
  | ----------------------------------------- | -------------------------------------------------------------------------- |
225
228
  | No CSP, or one without nonces | Nothing |
226
229
  | Strict, allowing `widgets.tesouro.com` | Add `https://widgets.tesouro.com` to `script-src` |
230
+ | Strict, with an allow-list `script-src` | Add `https://scripts.alloy.com` if a bank you serve profiles devices |
227
231
  | Strict, hosting everything on your origin | Self-host the PDF worker (below) and call `configureCsp({ pdfWorkerSrc })` |
228
232
 
229
233
  **Self-hosting the PDF worker.** Copy the worker the package ships into your
@@ -246,7 +250,13 @@ it. If it is blocked, dialogs still open but the page behind them can scroll.
246
250
 
247
251
  If your policy blocks one of these, only that feature is affected: a PDF
248
252
  preview reports a load error, analytics is dropped. The rest of the widget
249
- still renders.
253
+ still renders. Device profiling is the exception: for a bank that requires it,
254
+ onboarding cannot start while Alloy is blocked, by your policy or by the
255
+ applicant's ad blocker, and shows a message asking them to allow it.
256
+
257
+ **Do not load Alloy yourself on a page that shows onboarding.** The widget
258
+ starts Alloy's SDK with the bank's configuration; finding one already on the
259
+ page, it shows that blocked message instead of reinitializing yours.
250
260
 
251
261
  ### Theming
252
262
 
package/dist/index.d.ts CHANGED
@@ -1439,8 +1439,8 @@ declare function themeToCss(tokens: Readonly<ThemeTokens>, selector?: string): s
1439
1439
 
1440
1440
  interface CspConfig {
1441
1441
  /**
1442
- * Nonce for the one `<style>` tag the widgets add at runtime (the dialog
1443
- * scroll lock). Found on the page when not set. `null` clears an override.
1442
+ * Nonce for the `<style>` and `<script>` tags the widgets add at runtime.
1443
+ * Found on the page when not set. `null` clears an override.
1444
1444
  */
1445
1445
  nonce?: string | null;
1446
1446
  /**
@@ -2269,6 +2269,18 @@ interface BankAccountOnboardingWidgetLabels {
2269
2269
  shellFdicDisclaimer: string;
2270
2270
  /** The card shown instead of the form for an existing application. */
2271
2271
  applicationStatus: ApplicationStatusLabels;
2272
+ /** Shown in place of the form while the browser check runs, or once it fails. */
2273
+ deviceProfiling: {
2274
+ /** Hidden status text while the check runs. */
2275
+ loading: string;
2276
+ blockedTitle: string;
2277
+ /** For a check the browser blocked: names the setting to change. */
2278
+ blockedDescription: string;
2279
+ /** Title and body for a check the page itself prevents, which no setting fixes. */
2280
+ unavailableTitle: string;
2281
+ unavailableDescription: string;
2282
+ retry: string;
2283
+ };
2272
2284
  }
2273
2285
 
2274
2286
  /**
@@ -1221,6 +1221,18 @@ interface BankAccountOnboardingWidgetLabels {
1221
1221
  shellFdicDisclaimer: string;
1222
1222
  /** The card shown instead of the form for an existing application. */
1223
1223
  applicationStatus: ApplicationStatusLabels;
1224
+ /** Shown in place of the form while the browser check runs, or once it fails. */
1225
+ deviceProfiling: {
1226
+ /** Hidden status text while the check runs. */
1227
+ loading: string;
1228
+ blockedTitle: string;
1229
+ /** For a check the browser blocked: names the setting to change. */
1230
+ blockedDescription: string;
1231
+ /** Title and body for a check the page itself prevents, which no setting fixes. */
1232
+ unavailableTitle: string;
1233
+ unavailableDescription: string;
1234
+ retry: string;
1235
+ };
1224
1236
  }
1225
1237
 
1226
1238
  /**
@@ -1018,8 +1018,8 @@ interface WidgetTokenManager {
1018
1018
 
1019
1019
  interface CspConfig {
1020
1020
  /**
1021
- * Nonce for the one `<style>` tag the widgets add at runtime (the dialog
1022
- * scroll lock). Found on the page when not set. `null` clears an override.
1021
+ * Nonce for the `<style>` and `<script>` tags the widgets add at runtime.
1022
+ * Found on the page when not set. `null` clears an override.
1023
1023
  */
1024
1024
  nonce?: string | null;
1025
1025
  /**
@@ -1387,6 +1387,18 @@ interface BankAccountOnboardingWidgetLabels {
1387
1387
  shellFdicDisclaimer: string;
1388
1388
  /** The card shown instead of the form for an existing application. */
1389
1389
  applicationStatus: ApplicationStatusLabels;
1390
+ /** Shown in place of the form while the browser check runs, or once it fails. */
1391
+ deviceProfiling: {
1392
+ /** Hidden status text while the check runs. */
1393
+ loading: string;
1394
+ blockedTitle: string;
1395
+ /** For a check the browser blocked: names the setting to change. */
1396
+ blockedDescription: string;
1397
+ /** Title and body for a check the page itself prevents, which no setting fixes. */
1398
+ unavailableTitle: string;
1399
+ unavailableDescription: string;
1400
+ retry: string;
1401
+ };
1390
1402
  }
1391
1403
 
1392
1404
  /**
@@ -9,4 +9,5 @@ import { useDeleteApplication as s } from "./index8.js";
9
9
  import { usePollApplicationCompletion as c } from "./index9.js";
10
10
  import { useResumableBankAccountApplication as l } from "./index11.js";
11
11
  import { useStartedBankAccountApplication as u } from "./index12.js";
12
- export { n as ApplicationClientSecretProvider, e as OnboardingSuppressionReason, r as useApplicationClientSecret, i as useCreateApplication, s as useDeleteApplication, t as useOrganizationOnboardingSuppression, c as usePollApplicationCompletion, l as useResumableBankAccountApplication, u as useStartedBankAccountApplication, o as useSubmitApplication, a as useUpdateApplication };
12
+ import { DEVICE_PROFILING_PATH as d, fetchDeviceProfiling as f } from "./index13.js";
13
+ export { n as ApplicationClientSecretProvider, d as DEVICE_PROFILING_PATH, e as OnboardingSuppressionReason, f as fetchDeviceProfiling, r as useApplicationClientSecret, i as useCreateApplication, s as useDeleteApplication, t as useOrganizationOnboardingSuppression, c as usePollApplicationCompletion, l as useResumableBankAccountApplication, u as useStartedBankAccountApplication, o as useSubmitApplication, a as useUpdateApplication };
@@ -0,0 +1,17 @@
1
+ // ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index13.js
2
+ var e = "/api/widget-gateway/device-profiling";
3
+ function t(e) {
4
+ let t = e, n = t?.sdk;
5
+ return typeof t?.sessionId == "string" && typeof n?.key == "string" && typeof n.journeyToken == "string" && typeof n.production == "boolean" && (n.bcContext === void 0 || typeof n.bcContext == "string");
6
+ }
7
+ async function n({ client: n, widgetToken: r }) {
8
+ let { data: i, response: a } = await n.get({
9
+ url: e,
10
+ headers: { "X-Widget-Token": r },
11
+ throwOnError: !1
12
+ });
13
+ if (a?.status === 204 || a?.status === 404) return null;
14
+ if (!a?.ok || !t(i)) throw Error(`Device profiling lookup failed (${a?.status ?? "network"})`);
15
+ return i;
16
+ }
17
+ export { e as DEVICE_PROFILING_PATH, n as fetchDeviceProfiling };