@nibssplc/cams-sdk-react 0.0.1-beta.80 → 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 -55
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +2 -56
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/dist/hooks/useCAMSPopupAuth.d.ts +0 -17
package/dist/index.cjs.js
CHANGED
|
@@ -152,10 +152,6 @@ function useCAMSAuth(options) {
|
|
|
152
152
|
// Only initialize on client side
|
|
153
153
|
if (typeof window === "undefined")
|
|
154
154
|
return;
|
|
155
|
-
// Initialize popup auth handler if in popup
|
|
156
|
-
if (camsSdk.isPopupWindow()) {
|
|
157
|
-
camsSdk.initializePopupAuth();
|
|
158
|
-
}
|
|
159
155
|
(_a = sessionManagerRef.current) !== null && _a !== void 0 ? _a : (sessionManagerRef.current = new camsSdk.CAMSSessionManager(localStorage, options.storageKey || "CAMS-AUTH-SDK", {
|
|
160
156
|
onAuthSuccess: function (res) {
|
|
161
157
|
var _a;
|
|
@@ -538,56 +534,6 @@ function useCAMSMSALAuth(options) {
|
|
|
538
534
|
};
|
|
539
535
|
}
|
|
540
536
|
|
|
541
|
-
/**
|
|
542
|
-
* Hook for handling authentication in popup windows
|
|
543
|
-
* This should be used by the popup app to complete authentication
|
|
544
|
-
*/
|
|
545
|
-
function useCAMSPopupAuth(options) {
|
|
546
|
-
if (options === void 0) { options = {}; }
|
|
547
|
-
var _a = options.storageKey, storageKey = _a === void 0 ? "CAMS-SDK" : _a, targetOrigin = options.targetOrigin, onAuthComplete = options.onAuthComplete, onAuthError = options.onAuthError;
|
|
548
|
-
React.useEffect(function () {
|
|
549
|
-
if (typeof window === "undefined" || !camsSdk.isPopupWindow())
|
|
550
|
-
return;
|
|
551
|
-
// Initialize popup auth handler
|
|
552
|
-
camsSdk.initializePopupAuth(targetOrigin);
|
|
553
|
-
// Set up global handlers for the popup app
|
|
554
|
-
var globalHandlers = window.__CAMS_POPUP_AUTH__;
|
|
555
|
-
if (globalHandlers) {
|
|
556
|
-
var originalCompleteAuth_1 = globalHandlers.completeAuth;
|
|
557
|
-
var originalErrorAuth_1 = globalHandlers.errorAuth;
|
|
558
|
-
globalHandlers.completeAuth = function (profile) {
|
|
559
|
-
onAuthComplete === null || onAuthComplete === void 0 ? void 0 : onAuthComplete(profile);
|
|
560
|
-
originalCompleteAuth_1(profile);
|
|
561
|
-
};
|
|
562
|
-
globalHandlers.errorAuth = function (error) {
|
|
563
|
-
onAuthError === null || onAuthError === void 0 ? void 0 : onAuthError(error);
|
|
564
|
-
originalErrorAuth_1(error);
|
|
565
|
-
};
|
|
566
|
-
}
|
|
567
|
-
}, [targetOrigin, onAuthComplete, onAuthError]);
|
|
568
|
-
var completeAuth = React.useCallback(function (profile) {
|
|
569
|
-
if (!camsSdk.isPopupWindow()) {
|
|
570
|
-
console.warn("completeAuth called outside of popup window");
|
|
571
|
-
return;
|
|
572
|
-
}
|
|
573
|
-
var sessionManager = new camsSdk.CAMSSessionManager(localStorage, storageKey);
|
|
574
|
-
sessionManager.completePopupAuth(profile, targetOrigin);
|
|
575
|
-
}, [storageKey, targetOrigin]);
|
|
576
|
-
var errorAuth = React.useCallback(function (error) {
|
|
577
|
-
if (!camsSdk.isPopupWindow()) {
|
|
578
|
-
console.warn("errorAuth called outside of popup window");
|
|
579
|
-
return;
|
|
580
|
-
}
|
|
581
|
-
var sessionManager = new camsSdk.CAMSSessionManager(localStorage, storageKey);
|
|
582
|
-
sessionManager.errorPopupAuth(error, targetOrigin);
|
|
583
|
-
}, [storageKey, targetOrigin]);
|
|
584
|
-
return {
|
|
585
|
-
completeAuth: completeAuth,
|
|
586
|
-
errorAuth: errorAuth,
|
|
587
|
-
isPopup: camsSdk.isPopupWindow(),
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
|
|
591
537
|
var jsxRuntime = {exports: {}};
|
|
592
538
|
|
|
593
539
|
var reactJsxRuntime_production = {};
|
|
@@ -2057,7 +2003,6 @@ exports.useCAMSAuth = useCAMSAuth;
|
|
|
2057
2003
|
exports.useCAMSContext = useCAMSContext;
|
|
2058
2004
|
exports.useCAMSMSALAuth = useCAMSMSALAuth;
|
|
2059
2005
|
exports.useCAMSMSALContext = useCAMSMSALContext;
|
|
2060
|
-
exports.useCAMSPopupAuth = useCAMSPopupAuth;
|
|
2061
2006
|
Object.keys(camsSdk).forEach(function (k) {
|
|
2062
2007
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
2063
2008
|
enumerable: true,
|