@react-pakistan/util-functions 1.22.53 → 1.22.55

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.
@@ -1,5 +1,12 @@
1
1
  import { PreferenceBE } from '../type';
2
- export interface GetPreferencesArgs {
2
+ interface GetPreferencesArgs {
3
+ prisma: any;
4
+ }
5
+ interface PostPreferenceArgs {
6
+ id: string;
7
+ onboarding: boolean;
3
8
  prisma: any;
4
9
  }
5
10
  export declare const getPreferences: ({ prisma, }: GetPreferencesArgs) => Promise<Array<PreferenceBE>>;
11
+ export declare const postPreference: ({ prisma, id, onboarding, }: PostPreferenceArgs) => Promise<PreferenceBE>;
12
+ export {};
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  });
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.getPreferences = void 0;
13
+ exports.postPreference = exports.getPreferences = void 0;
14
14
  const getPreferences = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
15
15
  const preferences = yield prisma.preference.findMany({
16
16
  orderBy: {
@@ -28,3 +28,18 @@ const getPreferences = (_a) => __awaiter(void 0, [_a], void 0, function* ({ pris
28
28
  return preferences;
29
29
  });
30
30
  exports.getPreferences = getPreferences;
31
+ const postPreference = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id, onboarding, }) {
32
+ const preference = yield prisma.preference.upsert({
33
+ where: {
34
+ id,
35
+ },
36
+ update: {
37
+ onboarding,
38
+ },
39
+ create: {
40
+ onboarding,
41
+ },
42
+ });
43
+ return preference;
44
+ });
45
+ exports.postPreference = postPreference;
@@ -0,0 +1 @@
1
+ export declare const useDebounce: (value: string, timeout?: number) => string;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useDebounce = void 0;
4
+ const react_1 = require("react");
5
+ const useDebounce = (value, timeout = 500) => {
6
+ const [state, setState] = (0, react_1.useState)(value);
7
+ (0, react_1.useEffect)(() => {
8
+ const handler = setTimeout(() => setState(value), timeout);
9
+ return () => clearTimeout(handler);
10
+ }, [value, timeout]);
11
+ return state;
12
+ };
13
+ exports.useDebounce = useDebounce;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.22.53",
3
+ "version": "1.22.55",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {