@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.esm.js
CHANGED
|
@@ -20,25 +20,51 @@ import { motion } from 'framer-motion';
|
|
|
20
20
|
import axios from 'axios';
|
|
21
21
|
import https from 'https';
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
// Crypto polyfill for MSAL browser compatibility
|
|
24
|
+
if (typeof window !== 'undefined') {
|
|
25
|
+
// Ensure crypto object exists
|
|
26
|
+
if (!window.crypto) {
|
|
27
|
+
window.crypto = {};
|
|
28
|
+
}
|
|
29
|
+
// Polyfill getRandomValues with better entropy
|
|
30
|
+
if (!window.crypto.getRandomValues) {
|
|
31
|
+
window.crypto.getRandomValues = function (array) {
|
|
32
|
+
var bytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
|
|
33
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
34
|
+
bytes[i] = Math.floor((Math.random() * 256 +
|
|
35
|
+
(performance.now() % 256) +
|
|
36
|
+
(Date.now() % 256)) / 3) & 0xFF;
|
|
33
37
|
}
|
|
34
|
-
return
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
return array;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// Polyfill crypto.subtle
|
|
42
|
+
if (!window.crypto.subtle) {
|
|
43
|
+
window.crypto.subtle = {
|
|
44
|
+
digest: function (algorithm, data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
45
|
+
var bytes, hash, i;
|
|
46
|
+
return __generator(this, function (_a) {
|
|
47
|
+
bytes = new Uint8Array(data);
|
|
48
|
+
hash = 0;
|
|
49
|
+
for (i = 0; i < bytes.length; i++) {
|
|
50
|
+
hash = ((hash << 5) - hash) + bytes[i];
|
|
51
|
+
hash = hash & hash;
|
|
52
|
+
}
|
|
53
|
+
return [2 /*return*/, new Uint8Array([hash]).buffer];
|
|
54
|
+
});
|
|
55
|
+
}); }
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
// Polyfill randomUUID
|
|
59
|
+
if (!window.crypto.randomUUID) {
|
|
60
|
+
window.crypto.randomUUID = function () {
|
|
61
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
62
|
+
var r = (Math.random() * 16) | 0;
|
|
63
|
+
var v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
64
|
+
return v.toString(16);
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
}
|
|
42
68
|
}
|
|
43
69
|
|
|
44
70
|
/******************************************************************************
|
|
@@ -1190,7 +1216,7 @@ function CAMSMSALProviderInner(_a) {
|
|
|
1190
1216
|
localStorage.setItem(auth.storageKey, JSON.stringify({
|
|
1191
1217
|
accessToken: auth.accessToken,
|
|
1192
1218
|
idToken: auth.idToken,
|
|
1193
|
-
appCode: auth.appCode
|
|
1219
|
+
appCode: auth.appCode,
|
|
1194
1220
|
}));
|
|
1195
1221
|
}
|
|
1196
1222
|
}, [auth.accessToken, auth.idToken, auth.storageKey]);
|
|
@@ -1225,7 +1251,9 @@ function CAMSMSALProviderInner(_a) {
|
|
|
1225
1251
|
}
|
|
1226
1252
|
function CAMSMSALProvider(props) {
|
|
1227
1253
|
var msalConfig = props.msalConfig, msalInstance = props.msalInstance;
|
|
1228
|
-
var instance =
|
|
1254
|
+
var instance = typeof window !== "undefined"
|
|
1255
|
+
? msalInstance || new PublicClientApplication(msalConfig)
|
|
1256
|
+
: null;
|
|
1229
1257
|
return (jsxRuntimeExports.jsx(MsalProvider, { instance: instance, children: jsxRuntimeExports.jsx(CAMSMSALProviderInner, __assign({}, props)) }));
|
|
1230
1258
|
}
|
|
1231
1259
|
function useCAMSMSALContext() {
|
|
@@ -1359,7 +1387,9 @@ function UnifiedCAMSProvider(props) {
|
|
|
1359
1387
|
}
|
|
1360
1388
|
if (props.mode === "MSAL") {
|
|
1361
1389
|
var msalConfig = props.msalConfig, msalInstance = props.msalInstance;
|
|
1362
|
-
var instance =
|
|
1390
|
+
var instance = typeof window !== "undefined"
|
|
1391
|
+
? msalInstance || new PublicClientApplication(msalConfig)
|
|
1392
|
+
: null;
|
|
1363
1393
|
return (jsxRuntimeExports.jsx(MsalProvider, { instance: instance, children: jsxRuntimeExports.jsx(CAMSProviderCore, __assign({}, props)) }));
|
|
1364
1394
|
}
|
|
1365
1395
|
return (jsxRuntimeExports.jsx(ClientOnly, { fallback: jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: jsxRuntimeExports.jsx(CAMSProviderCore, __assign({}, props)) }));
|