@schedule-x/react 2.14.0 → 2.15.0

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 CHANGED
@@ -62,11 +62,12 @@ function useNextCalendarApp(config, plugins) {
62
62
  }
63
63
 
64
64
  const usePlugin = (plugin) => {
65
+ if ('undefined' === typeof window) {
66
+ throw new Error('usePlugin can only be used in the browser. You need to wrap all logic for the calendar in a client side component.');
67
+ }
65
68
  const [pluginInstance, setPluginInstance] = react.useState();
66
69
  react.useEffect(() => {
67
- if (typeof window !== 'undefined') {
68
- setPluginInstance(plugin);
69
- }
70
+ setPluginInstance(plugin);
70
71
  }, []);
71
72
  return pluginInstance;
72
73
  };
package/dist/index.cjs.js CHANGED
@@ -62,11 +62,12 @@ function useNextCalendarApp(config, plugins) {
62
62
  }
63
63
 
64
64
  const usePlugin = (plugin) => {
65
+ if ('undefined' === typeof window) {
66
+ throw new Error('usePlugin can only be used in the browser. You need to wrap all logic for the calendar in a client side component.');
67
+ }
65
68
  const [pluginInstance, setPluginInstance] = react.useState();
66
69
  react.useEffect(() => {
67
- if (typeof window !== 'undefined') {
68
- setPluginInstance(plugin);
69
- }
70
+ setPluginInstance(plugin);
70
71
  }, []);
71
72
  return pluginInstance;
72
73
  };
package/dist/index.js CHANGED
@@ -60,11 +60,12 @@ function useNextCalendarApp(config, plugins) {
60
60
  }
61
61
 
62
62
  const usePlugin = (plugin) => {
63
+ if ('undefined' === typeof window) {
64
+ throw new Error('usePlugin can only be used in the browser. You need to wrap all logic for the calendar in a client side component.');
65
+ }
63
66
  const [pluginInstance, setPluginInstance] = useState();
64
67
  useEffect(() => {
65
- if (typeof window !== 'undefined') {
66
- setPluginInstance(plugin);
67
- }
68
+ setPluginInstance(plugin);
68
69
  }, []);
69
70
  return pluginInstance;
70
71
  };
@@ -1,2 +1,2 @@
1
1
  import { PluginBase } from '@schedule-x/shared';
2
- export declare const usePlugin: <Plugin extends PluginBase<string>>(plugin: Plugin) => Plugin | undefined;
2
+ export declare const usePlugin: <Plugin extends PluginBase<string>>(plugin: Plugin) => Plugin;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "main": "dist/index.cjs",
16
16
  "module": "dist/index.js",
17
17
  "types": "dist/types/index.d.ts",
18
- "version": "2.14.0",
18
+ "version": "2.15.0",
19
19
  "type": "module",
20
20
  "files": [
21
21
  "dist"