@chemmangat/msal-next 5.1.0 → 5.2.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
@@ -2,6 +2,53 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [5.2.1] - 2026-04-07
6
+
7
+ ### 🐛 Bug Fix
8
+
9
+ #### `createAuthMiddleware` now importable from `@chemmangat/msal-next/middleware`
10
+
11
+ `createAuthMiddleware` was previously bundled inside `dist/index.mjs` which carries a `"use client"` directive. Importing it in `middleware.ts` caused Next.js to throw:
12
+
13
+ > "Attempted to call createAuthMiddleware() from the server but createAuthMiddleware is on the client."
14
+
15
+ It now has its own edge-compatible entry point with no React, no `@azure/msal-browser`, and no `"use client"` — only `next/server`.
16
+
17
+ **Migration** (update your import):
18
+ ```ts
19
+ // Before
20
+ import { createAuthMiddleware } from '@chemmangat/msal-next';
21
+
22
+ // After
23
+ import { createAuthMiddleware } from '@chemmangat/msal-next/middleware';
24
+ ```
25
+
26
+ Also fixed `tenantValidator.ts` to use `import type` for its `@azure/msal-browser` and `types.ts` imports, ensuring those never get bundled into the middleware output.
27
+
28
+ ---
29
+
30
+
31
+
32
+ ### 🔧 Compatibility
33
+
34
+ #### Support for `@azure/msal-browser` v5.x and `@azure/msal-react` v4.x / v5.x
35
+
36
+ Peer dependency ranges updated to include the latest MSAL major versions:
37
+
38
+ ```json
39
+ "@azure/msal-browser": "^3.11.0 || ^4.0.0 || ^5.0.0",
40
+ "@azure/msal-react": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0"
41
+ ```
42
+
43
+ Breaking changes in `msal-browser` v5 are handled transparently at runtime — no changes required in your app code.
44
+
45
+ **What changed internally:**
46
+
47
+ - `handleRedirectPromise()` now receives an options object on v5 (`navigateToLoginRequestUrl` moved here from config)
48
+ - `storeAuthStateInCookie` and `navigateToLoginRequestUrl` are conditionally omitted from the MSAL config object when running on v5 (both were removed from `BrowserAuthOptions`/`CacheOptions`)
49
+ - `EventType.LOGIN_SUCCESS` payload is now `AccountInfo` on v5 (was `AuthenticationResult` on v3/v4) — handled with a runtime type guard
50
+ - `EventType.LOGIN_FAILURE` was removed in v5; login failures now surface as `ACQUIRE_TOKEN_FAILURE` — both are handled
51
+
5
52
  ## [5.1.0] - 2026-03-17
6
53
 
7
54
  ### ✨ New Features