@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/index.esm.js CHANGED
@@ -1259,7 +1259,7 @@ function ProtectedRoute(_a) {
1259
1259
  var children = _a.children, fallback = _a.fallback, redirectTo = _a.redirectTo;
1260
1260
  var _b = useCAMSContext$1(), isAuthenticated = _b.isAuthenticated, isLoading = _b.isLoading;
1261
1261
  if (isLoading) {
1262
- return fallback || jsxRuntimeExports.jsx("div", { children: "Loading..." });
1262
+ return fallback || jsxRuntimeExports.jsx("div", { className: 'h-screen flex items-center justify-center', children: "Loading..." });
1263
1263
  }
1264
1264
  if (!isAuthenticated) {
1265
1265
  if (redirectTo && typeof window !== 'undefined') {
@@ -1452,26 +1452,20 @@ function CAMSProviderCore(props) {
1452
1452
  }
1453
1453
  });
1454
1454
  }); };
1455
- // Handle MFA completion for MSAL mode
1456
1455
  useEffect(function () {
1457
1456
  if (mode === "MSAL" &&
1458
1457
  "requiresMFA" in auth &&
1459
1458
  !auth.requiresMFA &&
1460
1459
  auth.isAuthenticated) {
1461
- // MFA completed, extract profile from localStorage
1462
1460
  var storedData = localStorage.getItem(auth.storageKey);
1463
1461
  if (storedData) {
1464
1462
  try {
1465
1463
  var parsed = JSON.parse(storedData);
1466
- console.log("Parsed storage data:", parsed);
1467
1464
  if (parsed.userProfile) {
1468
- console.log("Setting user profile:", parsed.userProfile);
1469
1465
  setUserProfile(parsed.userProfile);
1470
1466
  }
1471
1467
  }
1472
- catch (e) {
1473
- console.error("Error parsing stored data:", e);
1474
- }
1468
+ catch (_a) { }
1475
1469
  }
1476
1470
  }
1477
1471
  }, [
@@ -1488,6 +1482,7 @@ function CAMSProviderCore(props) {
1488
1482
  return jsxRuntimeExports.jsx(CAMSContext.Provider, { value: value, children: children });
1489
1483
  }
1490
1484
  function UnifiedCAMSProvider(props) {
1485
+ var _a;
1491
1486
  // Validate appCode is a valid GUID
1492
1487
  var appCodeValidation = GuidSchema.safeParse(props.appCode);
1493
1488
  if (!appCodeValidation.success) {
@@ -1495,10 +1490,13 @@ function UnifiedCAMSProvider(props) {
1495
1490
  }
1496
1491
  if (props.mode === "MSAL") {
1497
1492
  var msalConfig = props.msalConfig, msalInstance = props.msalInstance;
1493
+ if (typeof window !== "undefined" && !((_a = window.crypto) === null || _a === void 0 ? void 0 : _a.subtle)) {
1494
+ throw new Error("Crypto API not available. Polyfill failed to load.");
1495
+ }
1498
1496
  var instance = msalInstance || new PublicClientApplication(msalConfig);
1499
1497
  return (jsxRuntimeExports.jsx(MsalProvider, { instance: instance, children: jsxRuntimeExports.jsx(CAMSProviderCore, __assign({}, props)) }));
1500
1498
  }
1501
- return (jsxRuntimeExports.jsx(ClientOnly, { fallback: jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: jsxRuntimeExports.jsx(CAMSProviderCore, __assign({}, props)) }));
1499
+ return (jsxRuntimeExports.jsx(ClientOnly, { fallback: jsxRuntimeExports.jsx("div", { className: 'h-screen flex items-center justify-center', children: "Loading..." }), children: jsxRuntimeExports.jsx(CAMSProviderCore, __assign({}, props)) }));
1502
1500
  }
1503
1501
  // Backward compatibility exports
1504
1502
  var CAMSProvider = function (props) { return (jsxRuntimeExports.jsx(UnifiedCAMSProvider, __assign({}, props, { mode: "REGULAR" }))); };
@@ -2427,7 +2425,7 @@ var MFAEndpointsSchema = z$1.object({
2427
2425
  AuthChallengeVerify: z$1.url("MFA AuthChallengeVerify must be a valid URL"),
2428
2426
  });
2429
2427
  var MFAGate = function (_a) {
2430
- var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? jsxRuntimeExports.jsx(LoadingSpinner, {}) : _b,
2428
+ 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,
2431
2429
  // loginComponent: LoginComponent = DefaultLoginPage,
2432
2430
  _c = _a.usePassKey,
2433
2431
  // loginComponent: LoginComponent = DefaultLoginPage,