stream-connect-sdk 0.8.0 → 0.8.1

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,46 @@ 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.1
8
+
9
+ ### Handle expired connectAccessToken without a confusing error
10
+
11
+ Connect access tokens have a ~60 minute server-side TTL. Previously,
12
+ when a member left an SDK-hosting page open past that window and came
13
+ back to interact, the next API call failed with a misleading 422
14
+ error ("A connect access token can only be used once...") that
15
+ pointed integrators toward the wrong fix.
16
+
17
+ The SDK now detects the backend's expired-token shape
18
+ (`{status: 422, error_code: "expired_connect_token"}`) via an axios
19
+ response interceptor. **What happens next depends on how you wire
20
+ it** — there's no zero-config auto-recovery because only your server
21
+ holds the SDK secret key needed to mint a new token:
22
+
23
+ * **Recommended: wire `connectAccessTokenRefreshFn`** — a new init
24
+ option that points at a refresh endpoint on your server. The SDK
25
+ calls it for a fresh token, swaps it into the
26
+ `X-Connect-Access-Token` header, and retries the failed request
27
+ transparently — the member sees no error. Multiple parallel failed
28
+ requests share a single refresh attempt (stampede guard). See
29
+ [`docs/connect-access-token.md` → Refreshing an expired
30
+ token](./docs/connect-access-token.md#refreshing-an-expired-token-081)
31
+ for the server-side endpoint pattern (Flask + Express examples)
32
+ and the SDK-side wiring.
33
+ * **Fallback: wire `onConnectAccessTokenExpired`** — a new init
34
+ callback that fires when no refresh hook is wired or the refresh
35
+ rejected. Use to render a "session expired, please reload" UI on
36
+ the host page. Also dispatched as a
37
+ `tpastream-connect-token-expired` CustomEvent on `window` for
38
+ global listeners. Coalesced to one notification per expiry cycle.
39
+ * **No wiring at all**: the only change you see is a cleaner
40
+ server-side error message in the existing error-handler chain
41
+ (`handleFormErrors` etc.). The 422 still bubbles up; the member
42
+ still has to reload the page to recover.
43
+
44
+ See [`docs/client-usage.md`](./docs/client-usage.md) for the option
45
+ reference.
46
+
7
47
  ## 0.8.0
8
48
 
9
49
  ### 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.