@nibssplc/cams-sdk-react 0.0.1-beta.104 → 0.0.1-beta.105

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.cjs.js CHANGED
@@ -1962,11 +1962,10 @@ var MFAOptions = function (_a) {
1962
1962
  var authenticate = useWebAuthn().authenticate;
1963
1963
  var handleFIDOLogin = function () { return __awaiter(void 0, void 0, void 0, function () {
1964
1964
  var options, assertionResponse, error_1;
1965
- var _a, _b, _c, _d, _e, _f;
1966
- return __generator(this, function (_g) {
1967
- switch (_g.label) {
1965
+ return __generator(this, function (_a) {
1966
+ switch (_a.label) {
1968
1967
  case 0:
1969
- _g.trys.push([0, 4, , 5]);
1968
+ _a.trys.push([0, 4, , 5]);
1970
1969
  // 1. Fetch authentication challenge from your server
1971
1970
  console.log("Requesting authentication challenge from server...");
1972
1971
  return [4 /*yield*/, axios.post(MFAEndpoints.RetrieveAuthChallenge, {}, {
@@ -1976,16 +1975,13 @@ var MFAOptions = function (_a) {
1976
1975
  },
1977
1976
  })];
1978
1977
  case 1:
1979
- options = (_g.sent()).data;
1978
+ options = (_a.sent()).data;
1980
1979
  console.log("Received challenge:", options);
1981
1980
  // 2. Call the SDK to trigger the browser's passkey authentication UI
1982
1981
  console.log("Calling SDK authenticate function...");
1983
- return [4 /*yield*/, authenticate(__assign(__assign({}, options), { pubKeyCredParams: (_a = options.pubKeyCredParams) === null || _a === void 0 ? void 0 : _a.map(function (param) { return ({
1984
- type: "public-key",
1985
- alg: param.alg
1986
- }); }), attestation: ((_b = options.attestation) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || "none", authenticatorSelection: __assign(__assign({}, options.authenticatorSelection), { residentKey: ((_d = (_c = options.authenticatorSelection) === null || _c === void 0 ? void 0 : _c.residentKey) === null || _d === void 0 ? void 0 : _d.toLowerCase()) || "discouraged", userVerification: ((_f = (_e = options.authenticatorSelection) === null || _e === void 0 ? void 0 : _e.userVerification) === null || _f === void 0 ? void 0 : _f.toLowerCase()) || "preferred" }) }))];
1982
+ return [4 /*yield*/, authenticate(__assign(__assign({}, options), { userVerification: "discouraged" }))];
1987
1983
  case 2:
1988
- assertionResponse = _g.sent();
1984
+ assertionResponse = _a.sent();
1989
1985
  console.log("Authentication assertion received from client:", assertionResponse);
1990
1986
  // 3. Send the assertion back to the server for verification
1991
1987
  console.log("Sending assertion to server for verification...");
@@ -1997,11 +1993,11 @@ var MFAOptions = function (_a) {
1997
1993
  withCredentials: true, // credentials: 'include'
1998
1994
  })];
1999
1995
  case 3:
2000
- _g.sent();
1996
+ _a.sent();
2001
1997
  sonner.toast.success("🔑 Sign-in successful!");
2002
1998
  return [3 /*break*/, 5];
2003
1999
  case 4:
2004
- error_1 = _g.sent();
2000
+ error_1 = _a.sent();
2005
2001
  console.error("Authentication failed:", error_1);
2006
2002
  sonner.toast.error("❌ Could not sign in.");
2007
2003
  return [3 /*break*/, 5];
@@ -2329,8 +2325,10 @@ var MFAGate = function (_a) {
2329
2325
  });
2330
2326
  }); }, [context.logout]);
2331
2327
  camsSdk.Logger.debug("MFA Endpoint >>>", { MFAEndpoints: MFAEndpoints });
2328
+ if (useADLogin && !CredentialsAuthEndpoint)
2329
+ return jsxRuntimeExports.jsx(ErrorFallback, { message: "Invalid AD Login Configuration." });
2332
2330
  if (!validatedMFAEndpoints)
2333
- return jsxRuntimeExports.jsx(ErrorFallback, { message: "Invalid MFA configuration." });
2331
+ return jsxRuntimeExports.jsx(ErrorFallback, { message: "Invalid MFA Configuration." });
2334
2332
  if (context.authMode !== "MSAL")
2335
2333
  return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children });
2336
2334
  if (context.isLoading)