@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.cjs.js
CHANGED
|
@@ -534,56 +534,6 @@ function useCAMSMSALAuth(options) {
|
|
|
534
534
|
};
|
|
535
535
|
}
|
|
536
536
|
|
|
537
|
-
/**
|
|
538
|
-
* Hook for handling authentication in popup windows
|
|
539
|
-
* This should be used by the popup app to complete authentication
|
|
540
|
-
*/
|
|
541
|
-
function useCAMSPopupAuth(options) {
|
|
542
|
-
if (options === void 0) { options = {}; }
|
|
543
|
-
var _a = options.storageKey, storageKey = _a === void 0 ? "CAMS-SDK" : _a, targetOrigin = options.targetOrigin, onAuthComplete = options.onAuthComplete, onAuthError = options.onAuthError;
|
|
544
|
-
React.useEffect(function () {
|
|
545
|
-
if (typeof window === "undefined" || !camsSdk.isPopupWindow())
|
|
546
|
-
return;
|
|
547
|
-
// Initialize popup auth handler
|
|
548
|
-
camsSdk.initializePopupAuth(targetOrigin);
|
|
549
|
-
// Set up global handlers for the popup app
|
|
550
|
-
var globalHandlers = window.__CAMS_POPUP_AUTH__;
|
|
551
|
-
if (globalHandlers) {
|
|
552
|
-
var originalCompleteAuth_1 = globalHandlers.completeAuth;
|
|
553
|
-
var originalErrorAuth_1 = globalHandlers.errorAuth;
|
|
554
|
-
globalHandlers.completeAuth = function (profile) {
|
|
555
|
-
onAuthComplete === null || onAuthComplete === void 0 ? void 0 : onAuthComplete(profile);
|
|
556
|
-
originalCompleteAuth_1(profile);
|
|
557
|
-
};
|
|
558
|
-
globalHandlers.errorAuth = function (error) {
|
|
559
|
-
onAuthError === null || onAuthError === void 0 ? void 0 : onAuthError(error);
|
|
560
|
-
originalErrorAuth_1(error);
|
|
561
|
-
};
|
|
562
|
-
}
|
|
563
|
-
}, [targetOrigin, onAuthComplete, onAuthError]);
|
|
564
|
-
var completeAuth = React.useCallback(function (profile) {
|
|
565
|
-
if (!camsSdk.isPopupWindow()) {
|
|
566
|
-
console.warn("completeAuth called outside of popup window");
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
var sessionManager = new camsSdk.CAMSSessionManager(localStorage, storageKey);
|
|
570
|
-
sessionManager.completePopupAuth(profile, targetOrigin);
|
|
571
|
-
}, [storageKey, targetOrigin]);
|
|
572
|
-
var errorAuth = React.useCallback(function (error) {
|
|
573
|
-
if (!camsSdk.isPopupWindow()) {
|
|
574
|
-
console.warn("errorAuth called outside of popup window");
|
|
575
|
-
return;
|
|
576
|
-
}
|
|
577
|
-
var sessionManager = new camsSdk.CAMSSessionManager(localStorage, storageKey);
|
|
578
|
-
sessionManager.errorPopupAuth(error, targetOrigin);
|
|
579
|
-
}, [storageKey, targetOrigin]);
|
|
580
|
-
return {
|
|
581
|
-
completeAuth: completeAuth,
|
|
582
|
-
errorAuth: errorAuth,
|
|
583
|
-
isPopup: camsSdk.isPopupWindow(),
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
|
|
587
537
|
var jsxRuntime = {exports: {}};
|
|
588
538
|
|
|
589
539
|
var reactJsxRuntime_production = {};
|
|
@@ -2053,7 +2003,6 @@ exports.useCAMSAuth = useCAMSAuth;
|
|
|
2053
2003
|
exports.useCAMSContext = useCAMSContext;
|
|
2054
2004
|
exports.useCAMSMSALAuth = useCAMSMSALAuth;
|
|
2055
2005
|
exports.useCAMSMSALContext = useCAMSMSALContext;
|
|
2056
|
-
exports.useCAMSPopupAuth = useCAMSPopupAuth;
|
|
2057
2006
|
Object.keys(camsSdk).forEach(function (k) {
|
|
2058
2007
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
2059
2008
|
enumerable: true,
|