@nibssplc/cams-sdk-react 0.0.1-beta.14 → 0.0.1-beta.15

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.d.ts CHANGED
@@ -3,4 +3,5 @@ export * from './hooks/useCAMSMSALAuth';
3
3
  export * from './components/CAMSProvider';
4
4
  export * from './components/ProtectedRoute';
5
5
  export * from './components/CAMSMSALProvider';
6
+ export * from './components/ClientOnly';
6
7
  export * from '@nibssplc/cams-sdk';
package/dist/index.esm.js CHANGED
@@ -18187,13 +18187,28 @@ if (process.env.NODE_ENV === 'production') {
18187
18187
 
18188
18188
  var jsxRuntimeExports = jsxRuntime.exports;
18189
18189
 
18190
+ function ClientOnly(_a) {
18191
+ var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? null : _b;
18192
+ var _c = useState(false), hasMounted = _c[0], setHasMounted = _c[1];
18193
+ useEffect(function () {
18194
+ setHasMounted(true);
18195
+ }, []);
18196
+ if (!hasMounted) {
18197
+ return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: fallback });
18198
+ }
18199
+ return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children });
18200
+ }
18201
+
18190
18202
  var CAMSContext = createContext(null);
18191
- function CAMSProvider(_a) {
18203
+ function CAMSProviderInner(_a) {
18192
18204
  var children = _a.children, defaultConfig = _a.defaultConfig, authOptions = __rest(_a, ["children", "defaultConfig"]);
18193
18205
  var auth = useCAMSAuth(authOptions);
18194
18206
  var value = useMemo(function () { return (__assign(__assign({}, auth), { defaultConfig: defaultConfig })); }, [auth, defaultConfig]);
18195
18207
  return (jsxRuntimeExports.jsx(CAMSContext.Provider, { value: value, children: children }));
18196
18208
  }
18209
+ function CAMSProvider(props) {
18210
+ return (jsxRuntimeExports.jsx(ClientOnly, { children: jsxRuntimeExports.jsx(CAMSProviderInner, __assign({}, props)) }));
18211
+ }
18197
18212
  function useCAMSContext() {
18198
18213
  var context = useContext(CAMSContext);
18199
18214
  if (!context) {
@@ -18224,5 +18239,5 @@ function CAMSMSALProvider(_a) {
18224
18239
  return (jsxRuntimeExports.jsx(MsalProvider, { instance: instance, children: children }));
18225
18240
  }
18226
18241
 
18227
- export { CAMSMSALProvider, CAMSProvider, ProtectedRoute, useCAMSAuth, useCAMSContext, useCAMSMSALAuth };
18242
+ export { CAMSMSALProvider, CAMSProvider, ClientOnly, ProtectedRoute, useCAMSAuth, useCAMSContext, useCAMSMSALAuth };
18228
18243
  //# sourceMappingURL=index.esm.js.map