stream-connect-sdk 0.8.2 → 0.8.4

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,78 @@ 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.4
8
+
9
+ ### Validations that outlive one stream connection keep reporting live
10
+
11
+ A member whose credential validation ran longer than a single progress
12
+ stream would watch live updates stop arriving, get "Still working on
13
+ it", and have no way forward except reloading the page. Nothing was
14
+ broken server-side: the SDK had simply stopped looking.
15
+
16
+ The server caps one SSE connection at about ten minutes
17
+ (`STREAM_DEADLINE_SECONDS`) and then emits a `timeout` event. That
18
+ deadline belongs to the connection, not to the validation:
19
+ `validate_credentials` runs up to 4800s, and the slow part is usually
20
+ the post-MFA claims pull, well after the member has done everything
21
+ asked of them. The runner treated `timeout` as the end of the story.
22
+
23
+ It now reattaches. On `timeout` it re-fetches the policy holder, takes
24
+ the still-active `task_id` and a freshly minted `task_token`, and
25
+ resubscribes: the same loop the Connect API docs describe for backend
26
+ callers. Up to ten reattaches, which spans the ~90-minute window the
27
+ backend keeps a validation observable for. Dropped connections take the
28
+ same path behind a 1s-to-15s backoff, so an SSE blip doesn't become a
29
+ retry storm across every member mid-validation.
30
+
31
+ When a reattach finds no active task the validation has almost
32
+ certainly finished, but that is not a good enough basis for telling a
33
+ member their carrier connected: the real outcome comes from the
34
+ validate-credentials GET, and only a terminal state finalizes.
35
+ `pending_async` remains the fallback for an unreachable backend or a
36
+ spent attempt budget.
37
+
38
+ Requires a backend that serves `task_id` + `task_token` on the
39
+ policy-holder GET (stream #15091, live 2026-07-29). Against an older
40
+ backend the reattach finds no token and the SDK falls back to the
41
+ previous `pending_async` behavior.
42
+
43
+ Verified end to end against a local stack with the per-connection
44
+ deadline shortened to 15s, driving the built-in test-2FA carrier: nine
45
+ connections, a distinct token on each, every reattach 15.3-15.4s apart,
46
+ and a `WAITING_FOR_TWO_FACTOR_CODE` emitted after a reattach rendering
47
+ live in the hero.
48
+
49
+ ## 0.8.3
50
+
51
+ ### Fix: carriers that ask for Date of Birth could never be connected
52
+
53
+ A member connecting a carrier whose credential form includes a **Date of
54
+ Birth** field — Medical Mutual and SimplePay Health — could not complete
55
+ enrollment. Whatever they typed was discarded before the request left the
56
+ browser, the backend rejected the submission as missing a required field
57
+ (HTTP 422), and the form came back with a red validation error. No input
58
+ format worked, because the value never reached the server at all.
59
+
60
+ The credential payload spread the carrier's form values first and then
61
+ re-pinned a handful of SDK-controlled fields on top. One of those was
62
+ `date_of_birth: values.dateOfBirth || null` — camelCase, which no carrier
63
+ schema emits — so it always evaluated to `null` and overwrote the real
64
+ value. The line was inherited from 0.7.x, where the spread order was
65
+ reversed and the member's value won; 0.8.0 inverted that order (so carrier
66
+ schemas can't clobber `payer_id` / `accept` / `tenants_accept`) and turned a
67
+ dead line into a data-destroying one. The re-pin is gone; `payer_id` and the
68
+ consent fields are still protected.
69
+
70
+ Date fields also render as a native date input now. Carrier schemas mark
71
+ them `{"type": "string", "format": "date"}`, which 0.8.x rendered as a bare
72
+ text box with no format hint even though the backend only accepts ISO
73
+ `YYYY-MM-DD`. The date input always produces ISO, so there is nothing left
74
+ to guess.
75
+
76
+ The React Native hook (`stream-connect-sdk-hook`) kept the 0.7.x spread
77
+ order and was never affected.
78
+
7
79
  ## 0.8.2
8
80
 
9
81
  ### Fix: 2FA-required carriers no longer dead-end on a false "Connected"
package/README.md CHANGED
@@ -4,6 +4,18 @@
4
4
 
5
5
  ## Version
6
6
 
7
+ ### 0.8.4
8
+
9
+ 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.
10
+
11
+ ### 0.8.3
12
+
13
+ Fix: carriers whose credential form asks for a Date of Birth (Medical Mutual, SimplePay Health) could not be connected at all. The value was discarded before submit, so the server rejected the enrollment as missing a required field and no input format worked. Regression introduced in 0.8.0. Date fields now render as a native date input.
14
+
15
+ ### 0.8.2
16
+
17
+ Patient Access API (OAuth) connections finish with a self-dismissing "Connected" toast and return the member to the carrier picker instead of dead-ending on a full-page end widget. Tapping an already-connected carrier opens a status view first. Fix: 2FA-required carriers reach the verification-method picker rather than a false "Connected". `StreamConnect()` refuses to mount on insecure (plain-HTTP) host pages.
18
+
7
19
  ### 0.8.1
8
20
 
9
21
  Handle expired `connectAccessToken` cleanly. Long-lived pages no longer surface the misleading 422 when the ~60-minute server-side TTL elapses; integrations opt into transparent refresh via a new server-side endpoint hook, or a clean expiry callback as a fallback. See the [Refreshing an expired token](./docs/connect-access-token.md#refreshing-an-expired-token-081) integration guide.
@@ -21,6 +33,52 @@ This SDK embeds the [EasyEnrollment platform](https://www.easyenrollment.net) in
21
33
  Latest highlights below. The full per-version changelog lives in
22
34
  [CHANGELOG.md](./CHANGELOG.md).
23
35
 
36
+ ### 0.8.4 highlights
37
+
38
+ * A validation that outlives one progress-stream connection keeps
39
+ streaming. The server caps a single SSE connection at roughly ten
40
+ minutes, but the validation behind it can run far longer: the
41
+ post-MFA claims pull is usually what takes the time. The SDK now
42
+ re-fetches the policy holder for a fresh stream token and
43
+ resubscribes, up to ten times, covering the validation's whole
44
+ observable lifetime.
45
+ * Members who used to dead-end on "Still working on it" until they
46
+ reloaded the page now watch the connection complete. `pending_async`
47
+ is still there, but only for when reattach genuinely can't proceed.
48
+ * Dropped connections take the same path behind a backoff, so an SSE
49
+ blip no longer ends a validation's live reporting.
50
+ * Requires the policy-holder GET to serve `task_id` + `task_token`
51
+ (stream #15091). Against an older backend the SDK falls back to the
52
+ previous `pending_async` behavior rather than failing.
53
+
54
+ ### 0.8.3 highlights
55
+
56
+ * Fix: a carrier whose credential form includes a **Date of Birth**
57
+ field — Medical Mutual, SimplePay Health — could not be connected.
58
+ Whatever the member typed was dropped before the request left the
59
+ browser, so the server rejected the enrollment as missing a required
60
+ field and returned a validation error no input format could clear.
61
+ Introduced in 0.8.0 by a spread-order change; ten weeks in the field.
62
+ * Date fields (`{"type": "string", "format": "date"}` in the carrier
63
+ schema) now render as a native date input rather than a bare text
64
+ box, so the submitted value is always the ISO `YYYY-MM-DD` the
65
+ backend expects.
66
+ * The React Native hook (`stream-connect-sdk-hook`) was never affected.
67
+
68
+ ### 0.8.2 highlights
69
+
70
+ * Patient Access API (OAuth) connections end with a self-dismissing
71
+ "Connected" toast in the floating panel and return the member to the
72
+ carrier picker, instead of dead-ending on a full-page end widget.
73
+ * Tapping an already-connected carrier opens a status view (status,
74
+ last-synced, masked username, claim-sync summary) with credentials
75
+ gated behind an explicit "Update sign-in info" / "Reconnect".
76
+ * Fix: 2FA-required carriers reach the verification-method picker
77
+ rather than a false "Connected" — the realtime flow keys off a live
78
+ validation task rather than `realTimeVerification`.
79
+ * `StreamConnect()` refuses to mount on insecure (plain-HTTP) host
80
+ pages; `localhost` / `127.0.0.1` / `[::1]` still work for local dev.
81
+
24
82
  ### 0.8.1 highlights
25
83
 
26
84
  * Handle expired `connectAccessToken` (the ~60-minute server-side
@@ -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.1.js"></script>
14
+ <script src="https://app.tpastream.com/static/js/sdk-v-0.8.3.js"></script>
15
15
  <div id="sdk-hook"></div>
16
16
  <script>
17
17
  window.StreamConnect({
@@ -27,13 +27,17 @@ Mount the SDK by calling `StreamConnect({...})` with your config. The minimum yo
27
27
  </script>
28
28
  ```
29
29
 
30
- Three CDN forms are supported:
30
+ These CDN forms are supported:
31
31
 
32
- * `sdk-v-0.8.1.js` (current 0.8.x, pinned)
32
+ * `sdk-v-0.8.3.js` (current 0.8.x, pinned)
33
+ * `sdk-v-0.8.2.js` (0.8.2, pinned)
34
+ * `sdk-v-0.8.1.js` (0.8.1, pinned)
33
35
  * `sdk-v-0.8.0.js` (0.8.0, pinned)
34
36
  * `sdk-v-0.7.7.js` (last 0.7.x, pinned)
35
37
  * `sdk.js` (floating pointer to the latest release; updates automatically when a new version ships)
36
38
 
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.
40
+
37
41
  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.
38
42
 
39
43
  ### Via npm
package/docs/error.md CHANGED
@@ -77,18 +77,27 @@ in the hero element.
77
77
  | HTTP status | Detail message | Meaning | Recovery |
78
78
  |---|---|---|---|
79
79
  | 401 | `Missing token` | The SSE URL was hit without a `?token=` query param | Shouldn't happen via the SDK; if you proxy the URL yourself, forward the token |
80
- | 401 | `Task token has expired` | JWT `exp` passed (10-minute TTL after dispatch) | Re-submit the credentials to get a fresh token |
81
- | 401 | `Task not available` | The Redis `progress_task_owner` pointer expired (typically same TTL as token) | Same: re-submit |
80
+ | 401 | `Task token has expired` | JWT `exp` passed (10-minute TTL, sized to one connection) | Re-fetch the policy holder for a fresh token and resubscribe. The SDK does this automatically |
81
+ | 401 | `Task not available` | The Redis `progress_task_owner` pointer is gone: cleared on terminal state, or the ~90-minute observation window lapsed | Usually means the task finished. Read the outcome from the validate-credentials GET rather than retrying the stream |
82
82
  | 403 | `Not your task` | The JWT and Redis pointer disagree on `user_id` | Token reuse across sessions; re-init the SDK |
83
83
  | 422 | `Task token is invalid` | Bad signature, unknown algorithm, or malformed claims | Token was tampered with or minted by a different deploy |
84
84
  | 422 | `Task token does not match requested task` | The token's `task_id` claim doesn't match the URL path | Token reuse against the wrong task; re-submit |
85
85
  | 422 | `Task token audience mismatch` | `aud` claim isn't `sdk:sse:progress` | Token from a different service was forwarded |
86
86
  | 422 | `Task token missing required claim: <name>` | Mint upstream produced a token missing one of `exp` / `iat` / `task_id` / `sub` | Backend bug; report it |
87
87
 
88
- On any error the SDK transitions the active validation to
89
- `pending_async` (visible in the hero / corner panel) and leaves the
90
- wizard usable. The user can keep adding carriers; when they return
91
- later the validation's true terminal state is reflected.
88
+ On any of these the SDK first tries to reattach (re-fetch the policy
89
+ holder for a fresh `task_token`, resubscribe), because the stream
90
+ failing says nothing about whether the validation is still running.
91
+ Only if that can't proceed does the validation go to `pending_async`
92
+ (visible in the hero / corner panel), and the wizard stays usable
93
+ throughout. The user can keep adding carriers; when they return later
94
+ the validation's true terminal state is reflected.
95
+
96
+ `Task not available` is the interesting one: the Redis pointer is
97
+ cleared the moment a task reaches a terminal state, so this now
98
+ usually means the validation *finished*, not that a window lapsed. The
99
+ SDK reads the outcome from the validate-credentials GET and shows the
100
+ real terminal state rather than asking the user to re-submit.
92
101
 
93
102
  ## Cred-submit + validation errors
94
103
 
@@ -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.1.js"></script>`. Pinned versions remain available indefinitely.
22
+ `<script src="https://app.tpastream.com/static/js/sdk-v-0.8.3.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/docs/sdk-flow.md CHANGED
@@ -37,7 +37,7 @@ In 0.8 this is no longer a blocking intermediate widget. After the user submits
37
37
 
38
38
  Auth on the SSE channel is a short-lived task-scoped JWT (audience `sdk:sse:progress`, bound to the user + validation task, 10-minute TTL) returned in the credential-submit response as `task_token`. The SDK forwards it as a `?token=...` query param on the SSE subscription; integrators do not need to handle the token directly.
39
39
 
40
- State transitions arrive as they happen rather than on the 5-second polling cadence used in 0.7.x. The server-side stream has a hard ~10-minute deadline; if validation hasn't terminated by then the server emits a `timeout` event and closes the stream. The SDK transitions that validation to a `pending_async` state which keeps it visible in the hero / corner-panel UI (the wizard does NOT auto-advance to FinishedEasyEnroll). The user can keep using the SDK; when they return later, the next call to the backend will reflect whatever terminal state the validation reached.
40
+ State transitions arrive as they happen rather than on the 5-second polling cadence used in 0.7.x. The server-side stream has a hard ~10-minute deadline; if validation hasn't terminated by then the server emits a `timeout` event and closes the stream. That deadline belongs to the connection, not to the validation. The task behind it runs for as long as it needs (the post-MFA claims pull is usually what takes the time) and stays observable for its whole life. So the SDK reattaches: it re-fetches the policy holder for the still-active `task_id` plus a freshly minted `task_token` and resubscribes, and the user keeps seeing live state across as many ten-minute connections as the validation needs. The validation lands in `pending_async` only when reattach can't proceed: it genuinely ended, the backend can't be reached, or the ten-reattach budget is spent. That state keeps it visible in the hero / corner-panel UI (the wizard does NOT auto-advance to FinishedEasyEnroll). The user can keep using the SDK; when they return later, the next call to the backend will reflect whatever terminal state the validation reached.
41
41
 
42
42
  `doneRealTime` still fires for back-compat. The `realtimeTimeout` init option is accepted but ignored (the timeout is now server-side).
43
43
 
@@ -23,7 +23,7 @@ hero re-renders with the right copy and the right input control:
23
23
  | `submitting` | "Working on it…" | Wait |
24
24
  | `success` | "Connected!" (green) | Done; auto-dismisses after a short hold |
25
25
  | `failure` | "Couldn't connect" (red) with the carrier message | Reconnect via the tile |
26
- | `pending_async` | "Still working on it" | Come back later; SDK is no longer streaming live |
26
+ | `pending_async` | "Still working on it" | Come back later; the SDK has stopped streaming live (reattach ran out of road) |
27
27
 
28
28
  The hero is rendered by `ActiveValidationsHero` and lives alongside
29
29
  the wizard step state, so the user can keep navigating
@@ -88,19 +88,32 @@ without re-running the entire credential flow.
88
88
 
89
89
  ### Stream times out (10-minute deadline)
90
90
 
91
- The server-side SSE deadline is ~10 minutes per stream. If the user
92
- takes longer than that to retrieve and enter the code, the stream
93
- closes and the validation moves to `pending_async`. The hero shows
94
- "Still working on it" and the validation stays visible. The user can
95
- keep using the SDK; the task itself isn't cancelled. When they come
96
- back later, the validation's terminal state will be reflected on the
97
- next page load.
91
+ The ~10-minute SSE deadline is per stream, not per validation. If the
92
+ user takes longer than that to retrieve and enter the code, the server
93
+ emits `timeout` and closes the connection, and the SDK reattaches: it
94
+ re-fetches the policy holder for the still-active `task_id` and a
95
+ freshly minted `task_token`, then resubscribes. The hero keeps showing
96
+ live state; the member sees nothing. A validation stays observable for
97
+ about 90 minutes, and the SDK will spend up to ten reattaches covering
98
+ it.
99
+
100
+ The member's real deadline is much tighter and is enforced by the task,
101
+ not the transport: the worker waits ~5 minutes at each interactive MFA
102
+ stage for a method choice or a code before giving up.
103
+
104
+ If the validation actually ended while the SDK was between
105
+ connections, the reattach finds no active task, reads the outcome from
106
+ the validate-credentials GET, and shows the real terminal state.
98
107
 
99
108
  ### Stream disconnects mid-2FA
100
109
 
101
- A network blip, server-side close, or proxy drop during the validation
102
- lands the validation in `pending_async` the same way the timeout does.
103
- The backend task continues; the SDK just can't observe it live anymore.
110
+ A network blip, server-side close, or proxy drop is handled the same
111
+ way as a timeout, with a short backoff between attempts so an outage
112
+ doesn't turn into a retry storm. Only when reattach itself can't
113
+ proceed (the backend is unreachable, or ten attempts are spent) does
114
+ the validation land in `pending_async`. The backend task
115
+ continues either way; `pending_async` means the SDK stopped watching,
116
+ not that anything was cancelled.
104
117
 
105
118
  `AbortController.abort()` is intentionally NOT treated as a disconnect:
106
119
  the SDK aborts on unmount and on terminal-state cleanup, and surfacing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-connect-sdk",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
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",