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

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.
@@ -8,6 +8,6 @@ export interface CAMSProviderProps extends UseCAMSAuthOptions {
8
8
  children: ReactNode;
9
9
  defaultConfig?: Partial<CAMSConfig>;
10
10
  }
11
- export declare function CAMSProvider(props: CAMSProviderProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function CAMSProvider({ children, defaultConfig, ...authOptions }: CAMSProviderProps): import("react/jsx-runtime").JSX.Element;
12
12
  export declare function useCAMSContext(): CAMSContextValue;
13
13
  export {};
package/dist/index.cjs.js CHANGED
@@ -18206,28 +18206,24 @@ if (process.env.NODE_ENV === 'production') {
18206
18206
 
18207
18207
  var jsxRuntimeExports = jsxRuntime.exports;
18208
18208
 
18209
- function ClientOnly(_a) {
18210
- var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? null : _b;
18211
- var _c = React__default.useState(false), hasMounted = _c[0], setHasMounted = _c[1];
18209
+ var CAMSContext = React__default.createContext(null);
18210
+ function CAMSProvider(_a) {
18211
+ var children = _a.children, defaultConfig = _a.defaultConfig, authOptions = __rest(_a, ["children", "defaultConfig"]);
18212
+ var _b = React__default.useState(false), mounted = _b[0], setMounted = _b[1];
18212
18213
  React__default.useEffect(function () {
18213
- setHasMounted(true);
18214
+ setMounted(true);
18214
18215
  }, []);
18215
- if (!hasMounted) {
18216
- return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: fallback });
18216
+ if (!mounted) {
18217
+ return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children });
18217
18218
  }
18218
- return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children });
18219
+ return jsxRuntimeExports.jsx(CAMSProviderInner, __assign({ defaultConfig: defaultConfig }, authOptions, { children: children }));
18219
18220
  }
18220
-
18221
- var CAMSContext = React__default.createContext(null);
18222
18221
  function CAMSProviderInner(_a) {
18223
18222
  var children = _a.children, defaultConfig = _a.defaultConfig, authOptions = __rest(_a, ["children", "defaultConfig"]);
18224
18223
  var auth = useCAMSAuth(authOptions);
18225
18224
  var value = React__default.useMemo(function () { return (__assign(__assign({}, auth), { defaultConfig: defaultConfig })); }, [auth, defaultConfig]);
18226
18225
  return (jsxRuntimeExports.jsx(CAMSContext.Provider, { value: value, children: children }));
18227
18226
  }
18228
- function CAMSProvider(props) {
18229
- return (jsxRuntimeExports.jsx(ClientOnly, { children: jsxRuntimeExports.jsx(CAMSProviderInner, __assign({}, props)) }));
18230
- }
18231
18227
  function useCAMSContext() {
18232
18228
  var context = React__default.useContext(CAMSContext);
18233
18229
  if (!context) {
@@ -18258,6 +18254,18 @@ function CAMSMSALProvider(_a) {
18258
18254
  return (jsxRuntimeExports.jsx(MsalProvider, { instance: instance, children: children }));
18259
18255
  }
18260
18256
 
18257
+ function ClientOnly(_a) {
18258
+ var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? null : _b;
18259
+ var _c = React__default.useState(false), hasMounted = _c[0], setHasMounted = _c[1];
18260
+ React__default.useEffect(function () {
18261
+ setHasMounted(true);
18262
+ }, []);
18263
+ if (!hasMounted) {
18264
+ return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: fallback });
18265
+ }
18266
+ return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children });
18267
+ }
18268
+
18261
18269
  exports.CAMSMSALProvider = CAMSMSALProvider;
18262
18270
  exports.CAMSProvider = CAMSProvider;
18263
18271
  exports.ClientOnly = ClientOnly;