@nibssplc/cams-sdk-react 1.0.0-rc.41 → 1.0.0-rc.43
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/dist/components/CAMSMSALProvider.d.ts +0 -1
- package/dist/components/UnifiedCAMSProvider.d.ts +0 -1
- package/dist/hooks/useCAMSMSALAuth.d.ts +0 -1
- package/dist/index.cjs.js +8 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +8 -10
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1280,7 +1280,7 @@ function ProtectedRoute(_a) {
|
|
|
1280
1280
|
var children = _a.children, fallback = _a.fallback, redirectTo = _a.redirectTo;
|
|
1281
1281
|
var _b = useCAMSContext$1(), isAuthenticated = _b.isAuthenticated, isLoading = _b.isLoading;
|
|
1282
1282
|
if (isLoading) {
|
|
1283
|
-
return fallback || jsxRuntimeExports.jsx("div", { children: "Loading..." });
|
|
1283
|
+
return fallback || jsxRuntimeExports.jsx("div", { className: 'h-screen flex items-center justify-center', children: "Loading..." });
|
|
1284
1284
|
}
|
|
1285
1285
|
if (!isAuthenticated) {
|
|
1286
1286
|
if (redirectTo && typeof window !== 'undefined') {
|
|
@@ -1473,26 +1473,20 @@ function CAMSProviderCore(props) {
|
|
|
1473
1473
|
}
|
|
1474
1474
|
});
|
|
1475
1475
|
}); };
|
|
1476
|
-
// Handle MFA completion for MSAL mode
|
|
1477
1476
|
React.useEffect(function () {
|
|
1478
1477
|
if (mode === "MSAL" &&
|
|
1479
1478
|
"requiresMFA" in auth &&
|
|
1480
1479
|
!auth.requiresMFA &&
|
|
1481
1480
|
auth.isAuthenticated) {
|
|
1482
|
-
// MFA completed, extract profile from localStorage
|
|
1483
1481
|
var storedData = localStorage.getItem(auth.storageKey);
|
|
1484
1482
|
if (storedData) {
|
|
1485
1483
|
try {
|
|
1486
1484
|
var parsed = JSON.parse(storedData);
|
|
1487
|
-
console.log("Parsed storage data:", parsed);
|
|
1488
1485
|
if (parsed.userProfile) {
|
|
1489
|
-
console.log("Setting user profile:", parsed.userProfile);
|
|
1490
1486
|
setUserProfile(parsed.userProfile);
|
|
1491
1487
|
}
|
|
1492
1488
|
}
|
|
1493
|
-
catch (
|
|
1494
|
-
console.error("Error parsing stored data:", e);
|
|
1495
|
-
}
|
|
1489
|
+
catch (_a) { }
|
|
1496
1490
|
}
|
|
1497
1491
|
}
|
|
1498
1492
|
}, [
|
|
@@ -1509,6 +1503,7 @@ function CAMSProviderCore(props) {
|
|
|
1509
1503
|
return jsxRuntimeExports.jsx(CAMSContext.Provider, { value: value, children: children });
|
|
1510
1504
|
}
|
|
1511
1505
|
function UnifiedCAMSProvider(props) {
|
|
1506
|
+
var _a;
|
|
1512
1507
|
// Validate appCode is a valid GUID
|
|
1513
1508
|
var appCodeValidation = GuidSchema.safeParse(props.appCode);
|
|
1514
1509
|
if (!appCodeValidation.success) {
|
|
@@ -1516,10 +1511,13 @@ function UnifiedCAMSProvider(props) {
|
|
|
1516
1511
|
}
|
|
1517
1512
|
if (props.mode === "MSAL") {
|
|
1518
1513
|
var msalConfig = props.msalConfig, msalInstance = props.msalInstance;
|
|
1514
|
+
if (typeof window !== "undefined" && !((_a = window.crypto) === null || _a === void 0 ? void 0 : _a.subtle)) {
|
|
1515
|
+
throw new Error("Crypto API not available. Polyfill failed to load.");
|
|
1516
|
+
}
|
|
1519
1517
|
var instance = msalInstance || new msalBrowser.PublicClientApplication(msalConfig);
|
|
1520
1518
|
return (jsxRuntimeExports.jsx(msalReact.MsalProvider, { instance: instance, children: jsxRuntimeExports.jsx(CAMSProviderCore, __assign({}, props)) }));
|
|
1521
1519
|
}
|
|
1522
|
-
return (jsxRuntimeExports.jsx(ClientOnly, { fallback: jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: jsxRuntimeExports.jsx(CAMSProviderCore, __assign({}, props)) }));
|
|
1520
|
+
return (jsxRuntimeExports.jsx(ClientOnly, { fallback: jsxRuntimeExports.jsx("div", { className: 'h-screen flex items-center justify-center', children: "Loading..." }), children: jsxRuntimeExports.jsx(CAMSProviderCore, __assign({}, props)) }));
|
|
1523
1521
|
}
|
|
1524
1522
|
// Backward compatibility exports
|
|
1525
1523
|
var CAMSProvider = function (props) { return (jsxRuntimeExports.jsx(UnifiedCAMSProvider, __assign({}, props, { mode: "REGULAR" }))); };
|
|
@@ -2448,7 +2446,7 @@ var MFAEndpointsSchema = z.object({
|
|
|
2448
2446
|
AuthChallengeVerify: z.url("MFA AuthChallengeVerify must be a valid URL"),
|
|
2449
2447
|
});
|
|
2450
2448
|
var MFAGate = function (_a) {
|
|
2451
|
-
var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? jsxRuntimeExports.jsx(LoadingSpinner, {}) : _b,
|
|
2449
|
+
var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? jsxRuntimeExports.jsx("div", { className: 'h-screen flex items-center justify-center', children: jsxRuntimeExports.jsx(LoadingSpinner, {}) }) : _b,
|
|
2452
2450
|
// loginComponent: LoginComponent = DefaultLoginPage,
|
|
2453
2451
|
_c = _a.usePassKey,
|
|
2454
2452
|
// loginComponent: LoginComponent = DefaultLoginPage,
|