@nibssplc/cams-sdk-react 0.0.1-beta.14 → 0.0.1-beta.16
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/components/CAMSProvider.client.d.ts +13 -0
- package/dist/components/CAMSProvider.d.ts +5 -12
- package/dist/components/ClientOnly.d.ts +6 -0
- package/dist/index.cjs.js +23 -32
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +24 -34
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CAMSConfig } from '@nibssplc/cams-sdk';
|
|
3
|
+
import { UseCAMSAuthReturn, UseCAMSAuthOptions } from '../hooks/useCAMSAuth';
|
|
4
|
+
interface CAMSContextValue extends UseCAMSAuthReturn {
|
|
5
|
+
defaultConfig?: Partial<CAMSConfig>;
|
|
6
|
+
}
|
|
7
|
+
export interface CAMSProviderProps extends UseCAMSAuthOptions {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
defaultConfig?: Partial<CAMSConfig>;
|
|
10
|
+
}
|
|
11
|
+
export declare function CAMSProvider({ children, defaultConfig, ...authOptions }: CAMSProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function useCAMSContext(): CAMSContextValue;
|
|
13
|
+
export {};
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
interface CAMSContextValue extends UseCAMSAuthReturn {
|
|
5
|
-
defaultConfig?: Partial<CAMSConfig>;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CAMSProviderProps {
|
|
3
|
+
children: React.ReactNode;
|
|
6
4
|
}
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
defaultConfig?: Partial<CAMSConfig>;
|
|
10
|
-
}
|
|
11
|
-
export declare function CAMSProvider({ children, defaultConfig, ...authOptions }: CAMSProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export declare function useCAMSContext(): CAMSContextValue;
|
|
13
|
-
export {};
|
|
5
|
+
export declare function CAMSProvider({ children }: CAMSProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function useCAMSContext(): any;
|
package/dist/index.cjs.js
CHANGED
|
@@ -39,29 +39,6 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
39
39
|
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
var __assign = function() {
|
|
43
|
-
__assign = Object.assign || function __assign(t) {
|
|
44
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
45
|
-
s = arguments[i];
|
|
46
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
47
|
-
}
|
|
48
|
-
return t;
|
|
49
|
-
};
|
|
50
|
-
return __assign.apply(this, arguments);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
function __rest(s, e) {
|
|
54
|
-
var t = {};
|
|
55
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
56
|
-
t[p] = s[p];
|
|
57
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
58
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
59
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
60
|
-
t[p[i]] = s[p[i]];
|
|
61
|
-
}
|
|
62
|
-
return t;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
42
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
66
43
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
67
44
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -18206,19 +18183,20 @@ if (process.env.NODE_ENV === 'production') {
|
|
|
18206
18183
|
|
|
18207
18184
|
var jsxRuntimeExports = jsxRuntime.exports;
|
|
18208
18185
|
|
|
18209
|
-
var CAMSContext = React__default.createContext(null);
|
|
18210
18186
|
function CAMSProvider(_a) {
|
|
18211
|
-
var children = _a.children
|
|
18212
|
-
|
|
18213
|
-
|
|
18214
|
-
|
|
18187
|
+
var children = _a.children;
|
|
18188
|
+
if (typeof window === 'undefined') {
|
|
18189
|
+
return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children });
|
|
18190
|
+
}
|
|
18191
|
+
var ClientProvider = require('./CAMSProvider.client').CAMSProvider;
|
|
18192
|
+
return jsxRuntimeExports.jsx(ClientProvider, { children: children });
|
|
18215
18193
|
}
|
|
18216
18194
|
function useCAMSContext() {
|
|
18217
|
-
|
|
18218
|
-
|
|
18219
|
-
throw new Error('useCAMSContext must be used within a CAMSProvider');
|
|
18195
|
+
if (typeof window === 'undefined') {
|
|
18196
|
+
throw new Error('useCAMSContext can only be used on the client side');
|
|
18220
18197
|
}
|
|
18221
|
-
|
|
18198
|
+
var useClientContext = require('./CAMSProvider.client').useCAMSContext;
|
|
18199
|
+
return useClientContext();
|
|
18222
18200
|
}
|
|
18223
18201
|
|
|
18224
18202
|
function ProtectedRoute(_a) {
|
|
@@ -18243,8 +18221,21 @@ function CAMSMSALProvider(_a) {
|
|
|
18243
18221
|
return (jsxRuntimeExports.jsx(MsalProvider, { instance: instance, children: children }));
|
|
18244
18222
|
}
|
|
18245
18223
|
|
|
18224
|
+
function ClientOnly(_a) {
|
|
18225
|
+
var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? null : _b;
|
|
18226
|
+
var _c = React__default.useState(false), hasMounted = _c[0], setHasMounted = _c[1];
|
|
18227
|
+
React__default.useEffect(function () {
|
|
18228
|
+
setHasMounted(true);
|
|
18229
|
+
}, []);
|
|
18230
|
+
if (!hasMounted) {
|
|
18231
|
+
return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: fallback });
|
|
18232
|
+
}
|
|
18233
|
+
return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children });
|
|
18234
|
+
}
|
|
18235
|
+
|
|
18246
18236
|
exports.CAMSMSALProvider = CAMSMSALProvider;
|
|
18247
18237
|
exports.CAMSProvider = CAMSProvider;
|
|
18238
|
+
exports.ClientOnly = ClientOnly;
|
|
18248
18239
|
exports.ProtectedRoute = ProtectedRoute;
|
|
18249
18240
|
exports.useCAMSAuth = useCAMSAuth;
|
|
18250
18241
|
exports.useCAMSContext = useCAMSContext;
|