@nibssplc/cams-sdk-react 1.0.0-rc.11 → 1.0.0-rc.13
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 +51 -21
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +51 -21
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -41,25 +41,51 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
41
41
|
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(LabelPrimitive);
|
|
42
42
|
var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DialogPrimitive);
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
// Crypto polyfill for MSAL browser compatibility
|
|
45
|
+
if (typeof window !== 'undefined') {
|
|
46
|
+
// Ensure crypto object exists
|
|
47
|
+
if (!window.crypto) {
|
|
48
|
+
window.crypto = {};
|
|
49
|
+
}
|
|
50
|
+
// Polyfill getRandomValues with better entropy
|
|
51
|
+
if (!window.crypto.getRandomValues) {
|
|
52
|
+
window.crypto.getRandomValues = function (array) {
|
|
53
|
+
var bytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
|
|
54
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
55
|
+
bytes[i] = Math.floor((Math.random() * 256 +
|
|
56
|
+
(performance.now() % 256) +
|
|
57
|
+
(Date.now() % 256)) / 3) & 0xFF;
|
|
54
58
|
}
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
return array;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// Polyfill crypto.subtle
|
|
63
|
+
if (!window.crypto.subtle) {
|
|
64
|
+
window.crypto.subtle = {
|
|
65
|
+
digest: function (algorithm, data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
+
var bytes, hash, i;
|
|
67
|
+
return __generator(this, function (_a) {
|
|
68
|
+
bytes = new Uint8Array(data);
|
|
69
|
+
hash = 0;
|
|
70
|
+
for (i = 0; i < bytes.length; i++) {
|
|
71
|
+
hash = ((hash << 5) - hash) + bytes[i];
|
|
72
|
+
hash = hash & hash;
|
|
73
|
+
}
|
|
74
|
+
return [2 /*return*/, new Uint8Array([hash]).buffer];
|
|
75
|
+
});
|
|
76
|
+
}); }
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
// Polyfill randomUUID
|
|
80
|
+
if (!window.crypto.randomUUID) {
|
|
81
|
+
window.crypto.randomUUID = function () {
|
|
82
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
83
|
+
var r = (Math.random() * 16) | 0;
|
|
84
|
+
var v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
85
|
+
return v.toString(16);
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
}
|
|
63
89
|
}
|
|
64
90
|
|
|
65
91
|
/******************************************************************************
|
|
@@ -1211,7 +1237,7 @@ function CAMSMSALProviderInner(_a) {
|
|
|
1211
1237
|
localStorage.setItem(auth.storageKey, JSON.stringify({
|
|
1212
1238
|
accessToken: auth.accessToken,
|
|
1213
1239
|
idToken: auth.idToken,
|
|
1214
|
-
appCode: auth.appCode
|
|
1240
|
+
appCode: auth.appCode,
|
|
1215
1241
|
}));
|
|
1216
1242
|
}
|
|
1217
1243
|
}, [auth.accessToken, auth.idToken, auth.storageKey]);
|
|
@@ -1246,7 +1272,9 @@ function CAMSMSALProviderInner(_a) {
|
|
|
1246
1272
|
}
|
|
1247
1273
|
function CAMSMSALProvider(props) {
|
|
1248
1274
|
var msalConfig = props.msalConfig, msalInstance = props.msalInstance;
|
|
1249
|
-
var instance =
|
|
1275
|
+
var instance = typeof window !== "undefined"
|
|
1276
|
+
? msalInstance || new msalBrowser.PublicClientApplication(msalConfig)
|
|
1277
|
+
: null;
|
|
1250
1278
|
return (jsxRuntimeExports.jsx(msalReact.MsalProvider, { instance: instance, children: jsxRuntimeExports.jsx(CAMSMSALProviderInner, __assign({}, props)) }));
|
|
1251
1279
|
}
|
|
1252
1280
|
function useCAMSMSALContext() {
|
|
@@ -1380,7 +1408,9 @@ function UnifiedCAMSProvider(props) {
|
|
|
1380
1408
|
}
|
|
1381
1409
|
if (props.mode === "MSAL") {
|
|
1382
1410
|
var msalConfig = props.msalConfig, msalInstance = props.msalInstance;
|
|
1383
|
-
var instance =
|
|
1411
|
+
var instance = typeof window !== "undefined"
|
|
1412
|
+
? msalInstance || new msalBrowser.PublicClientApplication(msalConfig)
|
|
1413
|
+
: null;
|
|
1384
1414
|
return (jsxRuntimeExports.jsx(msalReact.MsalProvider, { instance: instance, children: jsxRuntimeExports.jsx(CAMSProviderCore, __assign({}, props)) }));
|
|
1385
1415
|
}
|
|
1386
1416
|
return (jsxRuntimeExports.jsx(ClientOnly, { fallback: jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: jsxRuntimeExports.jsx(CAMSProviderCore, __assign({}, props)) }));
|