@react-pakistan/util-functions 1.23.87 → 1.23.89

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.
@@ -9,6 +9,7 @@ export * from './enum-to-text';
9
9
  export * from './fetch-data';
10
10
  export * from './fetch-supabase-image';
11
11
  export * from './format-date';
12
+ export * from './format-time';
12
13
  export * from './generate-blog-schema';
13
14
  export * from './generate-breadcrumb-schema';
14
15
  export * from './generate-faq-schema';
package/general/index.js CHANGED
@@ -26,6 +26,7 @@ __exportStar(require("./enum-to-text"), exports);
26
26
  __exportStar(require("./fetch-data"), exports);
27
27
  __exportStar(require("./fetch-supabase-image"), exports);
28
28
  __exportStar(require("./format-date"), exports);
29
+ __exportStar(require("./format-time"), exports);
29
30
  __exportStar(require("./generate-blog-schema"), exports);
30
31
  __exportStar(require("./generate-breadcrumb-schema"), exports);
31
32
  __exportStar(require("./generate-faq-schema"), exports);
@@ -5,8 +5,6 @@ interface FetchResult {
5
5
  interface FetchConfig extends RequestInit {
6
6
  callback?: (result: FetchResult) => void;
7
7
  autoFetch?: boolean;
8
- showErrorNotification?: boolean;
9
- showSuccessNotification?: boolean;
10
8
  }
11
9
  interface Return {
12
10
  data: any;
@@ -11,39 +11,6 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  return __assign.apply(this, arguments);
13
13
  };
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
- Object.defineProperty(o, "default", { enumerable: true, value: v });
27
- }) : function(o, v) {
28
- o["default"] = v;
29
- });
30
- var __importStar = (this && this.__importStar) || (function () {
31
- var ownKeys = function(o) {
32
- ownKeys = Object.getOwnPropertyNames || function (o) {
33
- var ar = [];
34
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
35
- return ar;
36
- };
37
- return ownKeys(o);
38
- };
39
- return function (mod) {
40
- if (mod && mod.__esModule) return mod;
41
- var result = {};
42
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
43
- __setModuleDefault(result, mod);
44
- return result;
45
- };
46
- })();
47
14
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
48
15
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
49
16
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -91,21 +58,15 @@ var __rest = (this && this.__rest) || function (s, e) {
91
58
  }
92
59
  return t;
93
60
  };
94
- var __importDefault = (this && this.__importDefault) || function (mod) {
95
- return (mod && mod.__esModule) ? mod : { "default": mod };
96
- };
97
61
  Object.defineProperty(exports, "__esModule", { value: true });
98
62
  exports.useFetch = void 0;
99
- var react_1 = __importStar(require("react"));
100
- var react_hot_toast_1 = __importDefault(require("react-hot-toast"));
101
- var vista_notification_v1_1 = require("@appcorp/app-corp-vista/molecules/vista-notification-v1/vista-notification-v1");
102
- var vista_notification_type_1 = require("@appcorp/app-corp-vista/type/vista-notification-type");
63
+ var react_1 = require("react");
103
64
  var useFetch = function (url, config) {
104
65
  if (config === void 0) { config = {}; }
105
- var callback = config.callback, _a = config.autoFetch, autoFetch = _a === void 0 ? false : _a, _b = config.showErrorNotification, showErrorNotification = _b === void 0 ? false : _b, _c = config.showSuccessNotification, showSuccessNotification = _c === void 0 ? false : _c, defaultOptions = __rest(config, ["callback", "autoFetch", "showErrorNotification", "showSuccessNotification"]);
106
- var _d = (0, react_1.useState)(null), data = _d[0], setData = _d[1];
107
- var _e = (0, react_1.useState)(null), error = _e[0], setError = _e[1];
108
- var _f = (0, react_1.useState)(false), loading = _f[0], setLoading = _f[1];
66
+ var callback = config.callback, _a = config.autoFetch, autoFetch = _a === void 0 ? false : _a, defaultOptions = __rest(config, ["callback", "autoFetch"]);
67
+ var _b = (0, react_1.useState)(null), data = _b[0], setData = _b[1];
68
+ var _c = (0, react_1.useState)(null), error = _c[0], setError = _c[1];
69
+ var _d = (0, react_1.useState)(false), loading = _d[0], setLoading = _d[1];
109
70
  var abortControllerRef = (0, react_1.useRef)(null);
110
71
  var isMounted = (0, react_1.useRef)(true);
111
72
  (0, react_1.useEffect)(function () {
@@ -145,9 +106,6 @@ var useFetch = function (url, config) {
145
106
  setData(result);
146
107
  setError(null);
147
108
  callback === null || callback === void 0 ? void 0 : callback({ data: result, error: null });
148
- if (showSuccessNotification) {
149
- react_hot_toast_1.default.custom(react_1.default.createElement(vista_notification_v1_1.VistaNotificationV1, { isVisible: true, handleIsVisible: function () { return void 0; }, variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.SUCCESS, description: 'Operation successful!' }));
150
- }
151
109
  }
152
110
  return [3 /*break*/, 6];
153
111
  case 4:
@@ -156,9 +114,6 @@ var useFetch = function (url, config) {
156
114
  setError(err_1);
157
115
  setData(null);
158
116
  callback === null || callback === void 0 ? void 0 : callback({ data: null, error: err_1 });
159
- if (showErrorNotification) {
160
- react_hot_toast_1.default.custom(react_1.default.createElement(vista_notification_v1_1.VistaNotificationV1, { isVisible: true, handleIsVisible: function () { return void 0; }, variant: vista_notification_type_1.VISTA_NOTIFICATION_V1_VARIANT.ERROR, description: 'Error occurred, try again!' }));
161
- }
162
117
  }
163
118
  return [3 /*break*/, 6];
164
119
  case 5:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.23.87",
3
+ "version": "1.23.89",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -65,7 +65,6 @@
65
65
  "lodash.isequal": "^4.5.0",
66
66
  "next": "^14.2.3",
67
67
  "react": "^19",
68
- "react-hot-toast": "^2.5.2",
69
68
  "react-use": "^17.5.0",
70
69
  "rimraf": "^5.0.5",
71
70
  "ts-jest": "^29",