stream-connect-sdk 0.8.4 → 0.8.6

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/CHANGELOG.md CHANGED
@@ -4,6 +4,112 @@ All notable changes to the `stream-connect-sdk` npm package. The
4
4
  companion React Native hook (`stream-connect-sdk-hook`) is on its own
5
5
  release line; see [`sdk-hook/docs/README.md`](./sdk-hook/docs/README.md).
6
6
 
7
+ ## 0.8.6
8
+
9
+ ### Security: axios and dompurify upgraded
10
+
11
+ The SDK's two runtime dependencies with published advisories move to
12
+ their first patched versions:
13
+
14
+ * **axios** 1.16.1 -> 1.20.0 (and its `form-data` dependency 4.0.5 ->
15
+ 4.0.6). Closes the axios advisories affecting 1.0.0 - 1.19.0 and
16
+ GHSA-hmw2-7cc7-3qxx in `form-data`.
17
+ * **dompurify** 3.4.3 -> 3.4.17. Closes the advisories affecting
18
+ <= 3.4.15. DOMPurify sanitizes the Terms of Use modal and the payer
19
+ info articles before they render.
20
+
21
+ The package.json floors are now `axios ^1.20.0` and `dompurify
22
+ ^3.4.17`, so a host app that installs `stream-connect-sdk` no longer
23
+ pulls vulnerable nested copies into its own lockfile. The query
24
+ strings the SDK sends are unchanged: every query parameter is a flat
25
+ string or number, and axios 1.16.1 and 1.20.0 encode them
26
+ byte-for-byte the same.
27
+
28
+ ### Security: zod removed
29
+
30
+ `npm audit --omit=dev` reported a high advisory against zod 3.25.76
31
+ (GHSA-mrhx-c7xc-m3w5) whose only fix is zod 4. zod validated one
32
+ small form, the carrier credential form, so it is removed along with
33
+ `@hookform/resolvers` instead of being carried to a new major
34
+ version. A small built-in React Hook Form resolver
35
+ (`credentialsResolver.ts`) now applies the same rules: required and
36
+ optional text, password, date and select fields, boolean and numeric
37
+ fields, and the two consent checkboxes. Every error message the
38
+ member can see is unchanged. With zod gone, `npm audit --omit=dev`
39
+ reports 0 vulnerabilities. A plain `npm audit fix` also cleared the
40
+ build-time advisories in `@babel/core` and `postcss-selector-parser`,
41
+ so the full `npm audit` reports 0 as well.
42
+
43
+ ### Saved host-site logins are no longer offered on the carrier form
44
+
45
+ The SDK runs inside the customer's page, so the browser's password
46
+ manager treated the carrier form as a login for the customer's own
47
+ site. A customer reported a member's saved login for their site being
48
+ filled into the carrier username and password fields. The password
49
+ field asked for `autocomplete="current-password"` and the username
50
+ field for `autocomplete="username"`. Both, and every other text field
51
+ on the form, now render `autocomplete="off"` plus the opt-out
52
+ attributes 1Password, LastPass, Bitwarden and Dashlane read
53
+ (`data-1p-ignore`, `data-lpignore`, `data-bwignore`,
54
+ `data-form-type="other"`), the same pattern the carrier picker
55
+ already used. `new-password` is deliberately not used, because Chrome
56
+ would then offer to generate a password for an existing carrier
57
+ login. The one-time-code field in the 2FA prompt keeps
58
+ `autocomplete="one-time-code"`.
59
+
60
+ ### `X-SDK-Page-Path` is read per request
61
+
62
+ 0.8.5 read the hosting page's pathname once, when the widget mounted.
63
+ 0.8.6 reads it as each request is sent, so a single-page host that
64
+ routes the member to another view reports the page the widget is
65
+ actually on.
66
+
67
+ ### Fix: resubmitting during 2FA no longer sticks on "Connecting…"
68
+
69
+ A member who submitted the same credentials again while that
70
+ validation was still running (for example, waiting on the
71
+ verification-method picker) was left on "Connecting…" until a page
72
+ reload. The server hands back the running task's id instead of
73
+ starting a new one, and the SDK replaced its entry for that id with a
74
+ fresh `pending` one, dropping the method list. The progress stream
75
+ for that id stayed open, but the server sends a step only when the
76
+ step changes, so the picker or code prompt never came back.
77
+
78
+ Adding a validation whose id is still live now keeps its current
79
+ step, method list and messages, and takes only the new token, email
80
+ and carrier. An entry that has already ended (success, failure or
81
+ "still working on it") is replaced as before, so a new stream opens
82
+ for it. `npm test` now also runs the reducer's unit tests
83
+ (`npm run test:unit`, Node's built-in runner).
84
+
85
+ ## 0.8.5
86
+
87
+ ### Broken logins surface on the entry screen (TPA-6662)
88
+
89
+ A member opening the widget in member-portal mode saw no signal that
90
+ any of their carrier logins were broken until they clicked into
91
+ "Manage your carriers", so broken logins sat unnoticed exactly where
92
+ the member already was. The entry screen's Manage tile now carries a
93
+ pill reading "X logins need attention", where X is the combined
94
+ critical + warning count from the same `severityFor` classification
95
+ the carrier list uses (a warning with a successful sync in the last
96
+ seven days still counts as healthy). The pill is red if any critical
97
+ problem exists, amber otherwise, and renders nothing at zero. The
98
+ count is computed from the policy holders already in widget state, so
99
+ it costs no extra request, and because the widget refetches member
100
+ state after each validation completes, fixing a login updates the
101
+ count without a reload.
102
+
103
+ ### The widget reports the page it is mounted on (TPA-6661)
104
+
105
+ Cross-origin requests carry only the embedding page's origin; the path
106
+ never reaches the server. The SDK now sends the hosting page's
107
+ pathname as `X-SDK-Page-Path` on every request, and the backend stamps
108
+ (origin, path) per SDK token and tenant. That stamped location is what
109
+ lets fix-credentials emails link members of SDK-only tenants back to
110
+ the portal page that actually hosts the widget instead of a TPA Stream
111
+ portal they have never seen. Older backends ignore the header.
112
+
7
113
  ## 0.8.4
8
114
 
9
115
  ### Validations that outlive one stream connection keep reporting live
package/README.md CHANGED
@@ -4,6 +4,14 @@
4
4
 
5
5
  ## Version
6
6
 
7
+ ### 0.8.6
8
+
9
+ Security release: axios is upgraded to 1.20.0 and DOMPurify to 3.4.17, and the zod dependency is removed, clearing every `npm audit --omit=dev` advisory against the SDK's runtime dependencies. No API or wire-format change. The `X-SDK-Page-Path` header is now read on each request instead of once at mount. The carrier credential form no longer invites the browser to fill in the login saved for the host site. Fix: a member who resubmits the same credentials while that validation is still running keeps the 2FA method picker or code prompt instead of sticking on "Connecting…" until a reload.
10
+
11
+ ### 0.8.5
12
+
13
+ The entry screen's "Manage your carriers" tile now carries an "X logins need attention" pill (red if any critical problem exists, amber otherwise, hidden at zero), so members in portal mode see broken logins without clicking in. The SDK also reports the hosting page's pathname (`X-SDK-Page-Path`) so fix-credentials emails can route members of SDK-only tenants back to the portal page that embeds the widget.
14
+
7
15
  ### 0.8.4
8
16
 
9
17
  Credential validations that outlive a single progress stream now keep reporting live. A stream connection is capped at about ten minutes server-side; the SDK reattaches to the running validation instead of showing "Still working on it" and going quiet, so members on slow carriers or long MFA waits see the flow finish rather than having to reload.
@@ -33,6 +41,43 @@ This SDK embeds the [EasyEnrollment platform](https://www.easyenrollment.net) in
33
41
  Latest highlights below. The full per-version changelog lives in
34
42
  [CHANGELOG.md](./CHANGELOG.md).
35
43
 
44
+ ### 0.8.6 highlights
45
+
46
+ * Fix: a member who submits the same credentials again while that
47
+ validation is still running keeps the 2FA method picker or code
48
+ prompt. Before, the widget stuck on "Connecting…" until the page was
49
+ reloaded.
50
+ * Dependency security upgrades: axios 1.20.0 and DOMPurify 3.4.17.
51
+ zod is removed; the carrier credential form is now checked by a
52
+ small built-in validator with the same rules and messages.
53
+ `npm audit --omit=dev` reports no advisories against the SDK's
54
+ runtime dependencies.
55
+ * `X-SDK-Page-Path` is read as each request is sent, not once at
56
+ mount, so a single-page host that changes route reports the page
57
+ the widget is actually on.
58
+ * The validation hero no longer sits flush against the step below it
59
+ when a member returns to the carrier picker or the fix-credentials
60
+ screen after a validation.
61
+ * New docs for the per-key embed origin allowlist: the
62
+ `origin_not_allowed` error and an FAQ entry. TPA Stream support
63
+ turns the allowlist on.
64
+ * The carrier username and password fields opt out of autofill.
65
+ Because the SDK runs inside the host's page, the browser used to
66
+ offer the login saved for the host site, and a customer reported a
67
+ member's host-site login being filled into the carrier form.
68
+
69
+ ### 0.8.5 highlights
70
+
71
+ * "X logins need attention" pill on the entry screen's Manage tile:
72
+ combined critical + warning count from the same severity
73
+ classification the carrier list uses, red when any critical problem
74
+ exists, amber otherwise, absent at zero. Updates live as
75
+ validations complete, with no extra requests.
76
+ * The widget reports the page it is mounted on via `X-SDK-Page-Path`,
77
+ letting the backend stamp the embed location per SDK token and
78
+ tenant and route fix-credentials emails back to the hosting portal
79
+ page. Older backends ignore the header.
80
+
36
81
  ### 0.8.4 highlights
37
82
 
38
83
  * A validation that outlives one progress-stream connection keeps
@@ -11,7 +11,7 @@ Mount the SDK by calling `StreamConnect({...})` with your config. The minimum yo
11
11
  ### Via CDN (vanilla HTML, server-rendered, Backbone, jQuery)
12
12
 
13
13
  ```html
14
- <script src="https://app.tpastream.com/static/js/sdk-v-0.8.3.js"></script>
14
+ <script src="https://app.tpastream.com/static/js/sdk-v-0.8.6.js"></script>
15
15
  <div id="sdk-hook"></div>
16
16
  <script>
17
17
  window.StreamConnect({
@@ -29,14 +29,17 @@ Mount the SDK by calling `StreamConnect({...})` with your config. The minimum yo
29
29
 
30
30
  These CDN forms are supported:
31
31
 
32
- * `sdk-v-0.8.3.js` (current 0.8.x, pinned)
32
+ * `sdk-v-0.8.6.js` (current 0.8.x, pinned)
33
+ * `sdk-v-0.8.5.js` (0.8.5, pinned)
34
+ * `sdk-v-0.8.4.js` (0.8.4, pinned)
35
+ * `sdk-v-0.8.3.js` (0.8.3, pinned)
33
36
  * `sdk-v-0.8.2.js` (0.8.2, pinned)
34
37
  * `sdk-v-0.8.1.js` (0.8.1, pinned)
35
38
  * `sdk-v-0.8.0.js` (0.8.0, pinned)
36
39
  * `sdk-v-0.7.7.js` (last 0.7.x, pinned)
37
40
  * `sdk.js` (floating pointer to the latest release; updates automatically when a new version ships)
38
41
 
39
- If you pin, note that you do not pick up fixes automatically. 0.8.3 fixes a bug that made Medical Mutual and SimplePay Health impossible to connect, so pinned integrations on 0.8.0–0.8.2 should move up.
42
+ If you pin, note that you do not pick up fixes automatically. 0.8.3 fixes a bug that made Medical Mutual and SimplePay Health impossible to connect, so pinned integrations on 0.8.0–0.8.2 should move up. 0.8.6 fixes the two-factor prompt disappearing when a member resubmits their credentials while the validation is still running, so pinned integrations on 0.8.0–0.8.5 should move up to 0.8.6.
40
43
 
41
44
  Pinned versions stay available indefinitely. See [Migrating from 0.7 to 0.8](./migration-0.7-to-0.8.md) for the breaking-change story before flipping the floating pointer in production.
42
45
 
package/docs/error.md CHANGED
@@ -66,6 +66,37 @@ redirect URL registered with your sdkToken so the carrier knows where
66
66
  to send the user after they authenticate. Contact TPAStream support
67
67
  to configure this on the sdkToken.
68
68
 
69
+ ## Embed origin errors
70
+
71
+ ### `origin_not_allowed`
72
+
73
+ The request was rejected with HTTP 403 and a JSON body like:
74
+
75
+ ```json
76
+ { "error_code": "origin_not_allowed", "docs_url": "..." }
77
+ ```
78
+
79
+ Your `sdkToken` has an embed origin allowlist, its mode is `enforce`,
80
+ and the page that made the request is not on the list. The browser's
81
+ `Origin` header (for example `https://staging.example.com`) did not
82
+ match any entry under the key's "Embed origins". The response still
83
+ carries the normal CORS headers, so the SDK can read it and hand the
84
+ error to `handleInitErrors`.
85
+
86
+ To fix it, either:
87
+
88
+ * Add the site's origin (scheme, host, and port if not the default) to
89
+ the key's embed origins. A wildcard such as `https://*.example.com`
90
+ covers subdomains. Local development origins like
91
+ `http://localhost:3000` must be listed too.
92
+ * Or switch the key's mode back to `report`, which lets the request
93
+ through and only logs it, while you finish the list.
94
+
95
+ Only TPAStream staff can change these settings, so contact TPAStream
96
+ support with the origins and mode you want. Requests with no `Origin` header, such as
97
+ server-to-server calls, are never affected. See
98
+ [Restricting which sites may embed your key](./faq.md#restricting-which-sites-may-embed-your-key).
99
+
69
100
  ## SSE / real-time validation errors (0.8+)
70
101
 
71
102
  These come from the `/v3/sdk/progress/<task_id>/stream` endpoint that
@@ -137,7 +168,8 @@ how to handle. Indicates a backend-frontend version skew; report it.
137
168
  ### `Required`
138
169
 
139
170
  A required field on the credentials form is empty. Comes from the
140
- Zod schema generated from the carrier's `onboard_form.schema`.
171
+ validation rules the SDK builds from the carrier's
172
+ `onboard_form.schema`.
141
173
 
142
174
  ### `You must agree to the terms and services.`
143
175
 
package/docs/faq.md CHANGED
@@ -32,7 +32,7 @@ Embed the SDK in a WebView via [`react-native-webview`](https://github.com/react
32
32
  The older `stream-connect-sdk-hook` npm package (v0.6.2) is deprecated. Existing integrations keep working but won't receive feature updates: no SSE-driven validation, no inline 2FA, no fix-credentials status badges, no PAA support. New integrations should use the WebView pattern.
33
33
 
34
34
  ## I'd like to create a more customized flow for how a user enters credentials and validation.
35
- The default recommendation for customizing the SDK flow is to use the various sdk [Callbacks](client-usage.md#callbacks).
35
+ The default recommendation for customizing the SDK flow is to use the various sdk [Callbacks](client-usage.md#lifecycle-callbacks-in-detail).
36
36
 
37
37
  The SDK renders various steps with default templates which should be editted post render using JS and CSS. However, if you would like
38
38
  to create more customized widgets it is possible to turn off the default rendering using the various `renderXStep` values within the
@@ -42,7 +42,7 @@ If you are to turn of the default template rendering, the callbacks associated w
42
42
  objects in their parameters which will allow an implementor to mirror all of the functionality previously defined in the default
43
43
  template.
44
44
 
45
- Each of the provided information is present in the [Callbacks](client-usage.md#callbacks) docs.
45
+ Each of the provided information is present in the [Callbacks](client-usage.md#lifecycle-callbacks-in-detail) docs.
46
46
 
47
47
  ## How do I use the data from the SDK?
48
48
  The StreamConnect SDK is designed to take in carrier credentials, save them to the TPAStream sytem, and then validate the credentials.
@@ -74,4 +74,29 @@ own in-house system, simply refer to it as "internal"
74
74
  Using the `user` configuration object you can define `memberSystemKey`. This system key will be defined under the same vendor as the
75
75
  employer block, since a member can only exist under 1 employer.
76
76
 
77
- See our [Client Usage Docs](client-usage.md) for more information on the `user` object block.
77
+ See our [Client Usage Docs](client-usage.md) for more information on the `user` object block.
78
+
79
+ ## Restricting which sites may embed your key
80
+ By default an `sdkToken` works from any HTTPS page, because the token is public and ships in your page source.
81
+ You can optionally limit a key to your own sites. Only TPAStream staff can change these settings, so to turn this on, ask TPAStream support to enable it for your key and tell them the list of origins and the mode you want. Each key has two settings:
82
+
83
+ * **Embed origins**: a list of origins such as `https://benefits.example.com` or `https://*.example.com`.
84
+ * **Mode**: one of the three below.
85
+
86
+ | Mode | What happens to a request from a browser origin that is not on the list |
87
+ |---|---|
88
+ | `off` (default) | Nothing. The list is ignored and behavior is unchanged. |
89
+ | `report` | The request succeeds, and TPAStream logs it so you can see what would be blocked. |
90
+ | `enforce` | The request fails with HTTP 403 and `{"error_code": "origin_not_allowed", "docs_url": "..."}`. See [Error Documentation](./error.md#origin_not_allowed). |
91
+
92
+ The check uses the browser's `Origin` header on every SDK request that carries the key. Requests with no `Origin` header (server-to-server calls) are never affected, and neither are CORS preflight (`OPTIONS`) requests.
93
+
94
+ **Suggested rollout:**
95
+ 1. Leave the key on `off` while you collect every site that embeds the SDK, including staging and QA.
96
+ 2. Ask TPAStream support to enter those origins and switch the key to `report`. Run for about a week and ask TPAStream support for the logged origins that were not on the list.
97
+ 3. Ask support to add anything you missed, then switch to `enforce`.
98
+
99
+ Notes:
100
+ * A wildcard such as `https://*.example.com` matches subdomains (`https://benefits.example.com`). It never matches the bare `https://example.com`, so list the bare origin separately if you need it.
101
+ * Local development origins must be listed too, for example `http://localhost:3000`. Include the port.
102
+ * This restricts which websites can use a key from a browser. It does not protect a key used from a server, because server callers send no `Origin` header. For that, use server-side [connect access tokens](./connect-access-token.md).
@@ -32,7 +32,11 @@ StreamConnect({
32
32
 
33
33
  When a returning user opens the SDK in fix-credentials mode, the
34
34
  first screen offers two paths: add a new carrier, or manage existing
35
- ones.
35
+ ones. When any connected carrier needs attention, the "Manage your
36
+ carriers" tile carries a pill reading "N logins need attention": red
37
+ if any login is critical, amber otherwise, and absent at zero. The
38
+ count uses the same severity rules as the status badges below and
39
+ updates as validations finish.
36
40
 
37
41
  ![Select enroll process](https://tpastream-public.s3.amazonaws.com/sdk-docs/fix-credentials/select-enroll-widget.png)
38
42
 
@@ -19,7 +19,7 @@ Here is what the test htmlscript looks like.
19
19
  ```
20
20
 
21
21
  `<script src="https://app.tpastream.com/static/js/sdk.js"></script>` in the head will bring down the latest version of the StreamConnect SDK. If you need to pin to a specific version, change the src to something like
22
- `<script src="https://app.tpastream.com/static/js/sdk-v-0.8.3.js"></script>`. Pinned versions remain available indefinitely.
22
+ `<script src="https://app.tpastream.com/static/js/sdk-v-0.8.6.js"></script>`. Pinned versions remain available indefinitely.
23
23
 
24
24
  The 0.8 SDK is visually self-contained: it does not require Bootstrap, jQuery, FontAwesome, or any other host-page CSS. Host pages that already load Bootstrap can keep doing so without conflict. SDK styles use a `tpa-` class prefix to avoid name collisions with host CSS, and the reset/theme variables are wrapped under `.tpa-sdk-root` so they only affect the SDK subtree.
25
25
 
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "stream-connect-sdk",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "description": "A JavaScript SDK implementing TPAStream's Connect Platform",
5
5
  "scripts": {
6
6
  "build": "webpack --config webpack.prod-sdk.js --mode=production",
7
7
  "format": "biome check --write assets/",
8
8
  "test:lint": "biome check assets/",
9
9
  "test:types": "tsc --noEmit",
10
- "test": "npm run test:lint && npm run test:types",
10
+ "test:unit": "node --test --experimental-strip-types \"assets/**/*.test.ts\"",
11
+ "test": "npm run test:lint && npm run test:types && npm run test:unit",
11
12
  "screenshots": "node scripts/screenshots/capture.mjs",
12
13
  "screenshots:preview": "node scripts/screenshots/preview.mjs",
13
14
  "screenshots:upload": "node scripts/screenshots/upload.mjs"
@@ -41,14 +42,12 @@
41
42
  },
42
43
  "dependencies": {
43
44
  "@headlessui/react": "^2.2.0",
44
- "@hookform/resolvers": "^3.10.0",
45
- "axios": "^1.7.9",
46
- "dompurify": "^3.2.4",
45
+ "axios": "^1.20.0",
46
+ "dompurify": "^3.4.17",
47
47
  "marked": "^15.0.7",
48
48
  "react": "^19.0.0",
49
49
  "react-dom": "^19.0.0",
50
- "react-hook-form": "^7.54.2",
51
- "zod": "^3.24.2"
50
+ "react-hook-form": "^7.54.2"
52
51
  },
53
52
  "bugs": {
54
53
  "url": "https://github.com/TPAStream/stream-connect-js-sdk/issues"