@nibssplc/cams-sdk-react 0.0.1-beta.82 → 0.0.1-beta.83
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 +0 -51
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +2 -52
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/hooks/useCAMSPopupAuth.d.ts +0 -17
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export * from './hooks/useCAMSAuth';
|
|
2
2
|
export * from './hooks/useCAMSMSALAuth';
|
|
3
|
-
export * from './hooks/useCAMSPopupAuth';
|
|
4
3
|
export * from './components/ProtectedRoute';
|
|
5
4
|
export { CAMSMSALProvider, useCAMSMSALContext } from './components/CAMSMSALProvider';
|
|
6
5
|
export * from './components/ClientOnly';
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { useState, useRef, useEffect, useCallback, createContext, useContext, useMemo } from 'react';
|
|
3
|
-
import { CAMSSessionManager, isPopupWindow, CAMSMFAAuthenticator, Logger, CAMSError, CAMSErrorType
|
|
3
|
+
import { CAMSSessionManager, isPopupWindow, CAMSMFAAuthenticator, Logger, CAMSError, CAMSErrorType } from '@nibssplc/cams-sdk';
|
|
4
4
|
export * from '@nibssplc/cams-sdk';
|
|
5
5
|
import { useMsal, useAccount, MsalProvider } from '@azure/msal-react';
|
|
6
6
|
import { InteractionStatus, PublicClientApplication } from '@azure/msal-browser';
|
|
@@ -513,56 +513,6 @@ function useCAMSMSALAuth(options) {
|
|
|
513
513
|
};
|
|
514
514
|
}
|
|
515
515
|
|
|
516
|
-
/**
|
|
517
|
-
* Hook for handling authentication in popup windows
|
|
518
|
-
* This should be used by the popup app to complete authentication
|
|
519
|
-
*/
|
|
520
|
-
function useCAMSPopupAuth(options) {
|
|
521
|
-
if (options === void 0) { options = {}; }
|
|
522
|
-
var _a = options.storageKey, storageKey = _a === void 0 ? "CAMS-SDK" : _a, targetOrigin = options.targetOrigin, onAuthComplete = options.onAuthComplete, onAuthError = options.onAuthError;
|
|
523
|
-
useEffect(function () {
|
|
524
|
-
if (typeof window === "undefined" || !isPopupWindow())
|
|
525
|
-
return;
|
|
526
|
-
// Initialize popup auth handler
|
|
527
|
-
initializePopupAuth(targetOrigin);
|
|
528
|
-
// Set up global handlers for the popup app
|
|
529
|
-
var globalHandlers = window.__CAMS_POPUP_AUTH__;
|
|
530
|
-
if (globalHandlers) {
|
|
531
|
-
var originalCompleteAuth_1 = globalHandlers.completeAuth;
|
|
532
|
-
var originalErrorAuth_1 = globalHandlers.errorAuth;
|
|
533
|
-
globalHandlers.completeAuth = function (profile) {
|
|
534
|
-
onAuthComplete === null || onAuthComplete === void 0 ? void 0 : onAuthComplete(profile);
|
|
535
|
-
originalCompleteAuth_1(profile);
|
|
536
|
-
};
|
|
537
|
-
globalHandlers.errorAuth = function (error) {
|
|
538
|
-
onAuthError === null || onAuthError === void 0 ? void 0 : onAuthError(error);
|
|
539
|
-
originalErrorAuth_1(error);
|
|
540
|
-
};
|
|
541
|
-
}
|
|
542
|
-
}, [targetOrigin, onAuthComplete, onAuthError]);
|
|
543
|
-
var completeAuth = useCallback(function (profile) {
|
|
544
|
-
if (!isPopupWindow()) {
|
|
545
|
-
console.warn("completeAuth called outside of popup window");
|
|
546
|
-
return;
|
|
547
|
-
}
|
|
548
|
-
var sessionManager = new CAMSSessionManager(localStorage, storageKey);
|
|
549
|
-
sessionManager.completePopupAuth(profile, targetOrigin);
|
|
550
|
-
}, [storageKey, targetOrigin]);
|
|
551
|
-
var errorAuth = useCallback(function (error) {
|
|
552
|
-
if (!isPopupWindow()) {
|
|
553
|
-
console.warn("errorAuth called outside of popup window");
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
|
-
var sessionManager = new CAMSSessionManager(localStorage, storageKey);
|
|
557
|
-
sessionManager.errorPopupAuth(error, targetOrigin);
|
|
558
|
-
}, [storageKey, targetOrigin]);
|
|
559
|
-
return {
|
|
560
|
-
completeAuth: completeAuth,
|
|
561
|
-
errorAuth: errorAuth,
|
|
562
|
-
isPopup: isPopupWindow(),
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
|
|
566
516
|
var jsxRuntime = {exports: {}};
|
|
567
517
|
|
|
568
518
|
var reactJsxRuntime_production = {};
|
|
@@ -2020,5 +1970,5 @@ var MFAGate = function (_a) {
|
|
|
2020
1970
|
return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children });
|
|
2021
1971
|
};
|
|
2022
1972
|
|
|
2023
|
-
export { CAMSMSALProvider, CAMSProvider, ClientOnly, DefaultLoginPage as LoginButton, MFAGate, MFAOptions, ProtectedRoute, UnifiedCAMSProvider, useCAMSAuth, useCAMSContext, useCAMSMSALAuth, useCAMSMSALContext
|
|
1973
|
+
export { CAMSMSALProvider, CAMSProvider, ClientOnly, DefaultLoginPage as LoginButton, MFAGate, MFAOptions, ProtectedRoute, UnifiedCAMSProvider, useCAMSAuth, useCAMSContext, useCAMSMSALAuth, useCAMSMSALContext };
|
|
2024
1974
|
//# sourceMappingURL=index.esm.js.map
|