stream-connect-sdk 0.8.0 → 0.8.2

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,129 @@ 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.2
8
+
9
+ ### Fix: 2FA-required carriers no longer dead-end on a false "Connected"
10
+
11
+ A member connecting a carrier that requires two-factor auth could land on
12
+ a "Connected/finished" screen and never see the **verification-method
13
+ picker or code entry** — the connection then silently failed when the
14
+ carrier's 2FA prompt timed out unanswered. This happened with
15
+ `realTimeVerification: false`: the SDK fell straight to the end widget and
16
+ **never opened the progress stream**, so the `WAITING_FOR_METHOD_CHOICE`
17
+ event had nothing listening.
18
+
19
+ The fix keys the realtime/listening flow off the presence of a live
20
+ validation task (the `taskId` + `taskToken` the credential submit returns)
21
+ rather than off `realTimeVerification`. A live task means the backend is
22
+ running an async validation that **may** require 2FA, and a 2FA-pending
23
+ connection can never be "submit-and-trust" finished — the member has to
24
+ act. The validation hero (method picker / code entry) and the SSE runner
25
+ now mount whenever a validation is active, so 2FA is reachable even when
26
+ the verification UI was opted out of. A page reload mid-2FA also resumes
27
+ the live task now. First-time, never-submitted `realTimeVerification:
28
+ false` users see no change.
29
+
30
+ ### Patient Access API (OAuth) return is a toast, not a full-page stop
31
+
32
+ When a member finished connecting a carrier through its Patient Access
33
+ API (the OAuth redirect flow), they previously landed on a full-page
34
+ "Success!" end widget and had to click **"Add additional logins"** to
35
+ do anything else. That dead-end click is gone.
36
+
37
+ Both PAA variants now behave like the standard credential-submit flow:
38
+ on a successful connection the SDK drops a self-dismissing **"Connected"
39
+ card into the floating panel** and returns the member to the carrier
40
+ picker so they can immediately add another carrier. This applies to the
41
+ single-page redirect variant (which returns via
42
+ `?forceTPAStreamSdkEnd=1`) and the popup variant (which polls the interop
43
+ status). The single-page variant stashes the carrier name/logo across the
44
+ redirect so the toast can name it.
45
+
46
+ The explicit `forceEndStep` init option is unchanged — passing it still
47
+ routes straight to the end widget. Only the URL-driven PAA return changed.
48
+ When `realTimeVerification: false` (no floating panel), the PAA return
49
+ keeps the legacy end-widget behavior.
50
+
51
+ ### Policy-holder status view + gated credential editing
52
+
53
+ Tapping an already-connected carrier in the fix-credentials list now
54
+ opens a **status view** first instead of dropping straight into the
55
+ sign-in form. A healthy/connected carrier shows its connection status,
56
+ last-synced time, masked username, and a **claim-sync summary** (claims
57
+ synced + most recent claim date), and keeps the username/password hidden
58
+ behind an explicit **"Update sign-in info"** button. PAA carriers show a
59
+ **"Reconnect"** action instead. A carrier that genuinely needs attention
60
+ (bad creds, etc.) still opens straight into the fix form. Adding a brand
61
+ new carrier is unchanged.
62
+
63
+ The claim-sync summary is fed by two new fields on the policy-holder SDK
64
+ GET response (`claims_synced_count`, `most_recent_claim_date`); aggregate
65
+ audit signals only — no per-claim provider / amount / diagnosis.
66
+
67
+ ### Refuse to initialize on insecure (plain HTTP) host pages
68
+
69
+ `StreamConnect()` now checks `window.isSecureContext` at init and
70
+ refuses to mount the SDK if the host page is served over plain HTTP
71
+ from a non-loopback host. The browser-level secure-context check is
72
+ true on HTTPS and on the loopback hosts (`localhost`, `127.0.0.1`,
73
+ `[::1]`) — same set the new server-side CORS policy allows — so
74
+ local development against `vite`, `webpack-dev-server`, etc. is
75
+ unaffected.
76
+
77
+ The previous behavior on a plain-HTTP page was a generic
78
+ CORS-blocked error in the browser console on the first
79
+ `/sdk-api/*` request, with no actionable explanation. The SDK now
80
+ fails fast with a clear console error, calls the optional
81
+ `handleInitErrors` callback with the same message, and links to
82
+ the [origin-policy docs](https://developers.tpastream.com/connect/origin-policy)
83
+ explaining the requirement and how to fix it.
84
+
85
+ Members were never charged the network round-trip on a broken
86
+ plain-HTTP integration in the first place, so the practical effect
87
+ is shifting the error from "browser console mystery" to "init-time
88
+ diagnostic that names the problem."
89
+
90
+ ## 0.8.1
91
+
92
+ ### Handle expired connectAccessToken without a confusing error
93
+
94
+ Connect access tokens have a ~60 minute server-side TTL. Previously,
95
+ when a member left an SDK-hosting page open past that window and came
96
+ back to interact, the next API call failed with a misleading 422
97
+ error ("A connect access token can only be used once...") that
98
+ pointed integrators toward the wrong fix.
99
+
100
+ The SDK now detects the backend's expired-token shape
101
+ (`{status: 422, error_code: "expired_connect_token"}`) via an axios
102
+ response interceptor. **What happens next depends on how you wire
103
+ it** — there's no zero-config auto-recovery because only your server
104
+ holds the SDK secret key needed to mint a new token:
105
+
106
+ * **Recommended: wire `connectAccessTokenRefreshFn`** — a new init
107
+ option that points at a refresh endpoint on your server. The SDK
108
+ calls it for a fresh token, swaps it into the
109
+ `X-Connect-Access-Token` header, and retries the failed request
110
+ transparently — the member sees no error. Multiple parallel failed
111
+ requests share a single refresh attempt (stampede guard). See
112
+ [`docs/connect-access-token.md` → Refreshing an expired
113
+ token](./docs/connect-access-token.md#refreshing-an-expired-token-081)
114
+ for the server-side endpoint pattern (Flask + Express examples)
115
+ and the SDK-side wiring.
116
+ * **Fallback: wire `onConnectAccessTokenExpired`** — a new init
117
+ callback that fires when no refresh hook is wired or the refresh
118
+ rejected. Use to render a "session expired, please reload" UI on
119
+ the host page. Also dispatched as a
120
+ `tpastream-connect-token-expired` CustomEvent on `window` for
121
+ global listeners. Coalesced to one notification per expiry cycle.
122
+ * **No wiring at all**: the only change you see is a cleaner
123
+ server-side error message in the existing error-handler chain
124
+ (`handleFormErrors` etc.). The 422 still bubbles up; the member
125
+ still has to reload the page to recover.
126
+
127
+ See [`docs/client-usage.md`](./docs/client-usage.md) for the option
128
+ reference.
129
+
7
130
  ## 0.8.0
8
131
 
9
132
  ### Look and feel
package/README.md CHANGED
@@ -4,6 +4,10 @@
4
4
 
5
5
  ## Version
6
6
 
7
+ ### 0.8.1
8
+
9
+ 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.
10
+
7
11
  ### 0.8.0
8
12
 
9
13
  Polished default appearance, React 19 + TypeScript, real-time credential-validation streaming, and a substantial dependency cleanup. The init() contract is backward-compatible: every option supported in 0.7.7 keeps working, including the custom render props (`renderChoosePayer`, `renderPayerForm`, `renderEndWidget`).
@@ -17,6 +21,19 @@ This SDK embeds the [EasyEnrollment platform](https://www.easyenrollment.net) in
17
21
  Latest highlights below. The full per-version changelog lives in
18
22
  [CHANGELOG.md](./CHANGELOG.md).
19
23
 
24
+ ### 0.8.1 highlights
25
+
26
+ * Handle expired `connectAccessToken` (the ~60-minute server-side
27
+ TTL) without the misleading 422. Opt in to transparent recovery by
28
+ wiring `connectAccessTokenRefreshFn` against a server-side refresh
29
+ endpoint (Flask + Express snippets in [docs](./docs/connect-access-token.md#refreshing-an-expired-token-081)),
30
+ or use the `onConnectAccessTokenExpired` callback (and
31
+ `tpastream-connect-token-expired` window event) to render a
32
+ "session expired" UI as a fallback. Parallel-request stampede
33
+ guarded; notifications coalesced to one per expiry cycle.
34
+ Integrations that wire nothing see a cleaner error message but
35
+ still need a page reload to recover.
36
+
20
37
  ### 0.8.0 highlights
21
38
 
22
39
  * Polished default appearance; no host-page CSS required.