@react-pakistan/util-functions 1.24.65 → 1.24.66

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.
Files changed (110) hide show
  1. package/README.md +6 -3
  2. package/api/stellar-solutions/app-user/index.d.ts +63 -14
  3. package/api/stellar-solutions/app-user/index.js +106 -52
  4. package/api/stellar-solutions/bank/index.d.ts +65 -16
  5. package/api/stellar-solutions/bank/index.js +115 -65
  6. package/api/stellar-solutions/branch/index.d.ts +64 -15
  7. package/api/stellar-solutions/branch/index.js +119 -65
  8. package/api/stellar-solutions/company/index.d.ts +58 -24
  9. package/api/stellar-solutions/company/index.js +106 -78
  10. package/api/stellar-solutions/company-report/index.d.ts +12 -5
  11. package/api/stellar-solutions/company-report/index.js +12 -7
  12. package/api/stellar-solutions/contact/index.d.ts +54 -20
  13. package/api/stellar-solutions/contact/index.js +109 -88
  14. package/api/stellar-solutions/currency/index.d.ts +63 -14
  15. package/api/stellar-solutions/currency/index.js +113 -61
  16. package/api/stellar-solutions/customer/index.d.ts +70 -28
  17. package/api/stellar-solutions/customer/index.js +131 -101
  18. package/api/stellar-solutions/expense/index.d.ts +58 -22
  19. package/api/stellar-solutions/expense/index.js +128 -92
  20. package/api/stellar-solutions/expense-category/index.d.ts +58 -22
  21. package/api/stellar-solutions/expense-category/index.js +125 -86
  22. package/api/stellar-solutions/lead/index.js +0 -1
  23. package/api/stellar-solutions/menu-order/index.d.ts +29 -7
  24. package/api/stellar-solutions/menu-order/index.js +74 -27
  25. package/api/stellar-solutions/payment/index.d.ts +62 -27
  26. package/api/stellar-solutions/payment/index.js +144 -123
  27. package/api/stellar-solutions/payment-mode/index.d.ts +44 -12
  28. package/api/stellar-solutions/payment-mode/index.js +115 -49
  29. package/api/stellar-solutions/preference/index.d.ts +14 -3
  30. package/api/stellar-solutions/preference/index.js +44 -14
  31. package/api/stellar-solutions/product/index.d.ts +46 -31
  32. package/api/stellar-solutions/product/index.js +142 -113
  33. package/api/stellar-solutions/product-category/index.d.ts +44 -27
  34. package/api/stellar-solutions/product-category/index.js +123 -87
  35. package/api/stellar-solutions/profile/index.d.ts +48 -17
  36. package/api/stellar-solutions/profile/index.js +124 -65
  37. package/api/stellar-solutions/quote-invoice/index.d.ts +67 -8
  38. package/api/stellar-solutions/quote-invoice/index.js +123 -57
  39. package/api/stellar-solutions/quote-invoice-report/index.d.ts +12 -5
  40. package/api/stellar-solutions/quote-invoice-report/index.js +10 -5
  41. package/api/stellar-solutions/tax/index.d.ts +46 -14
  42. package/api/stellar-solutions/tax/index.js +135 -63
  43. package/api/stellar-solutions/type.d.ts +178 -112
  44. package/api/stellar-solutions/type.js +60 -2
  45. package/constants/countries-timezones.js +0 -1
  46. package/constants/currencies.js +0 -1
  47. package/general/basic-get.js +22 -21
  48. package/general/basic-post.js +19 -18
  49. package/general/calculate-pages.js +3 -1
  50. package/general/check-even-odd-length.js +3 -2
  51. package/general/delete-image-from-private-supabase.js +0 -1
  52. package/general/delete-image-from-public-supabase.js +0 -1
  53. package/general/dynamic-page-limit.js +3 -2
  54. package/general/enum-to-text.js +7 -4
  55. package/general/fetch-data.js +0 -1
  56. package/general/fetch-supabase-image.js +0 -1
  57. package/general/fetch-supabase-private-assets.js +15 -14
  58. package/general/format-date.js +8 -8
  59. package/general/format-number.js +3 -2
  60. package/general/format-time.js +3 -2
  61. package/general/full-year-range.js +2 -2
  62. package/general/generate-blog-schema.d.ts +3 -3
  63. package/general/generate-blog-schema.js +20 -13
  64. package/general/generate-breadcrumb-schema.d.ts +4 -4
  65. package/general/generate-breadcrumb-schema.js +9 -10
  66. package/general/generate-faq-schema.d.ts +5 -5
  67. package/general/generate-faq-schema.js +18 -11
  68. package/general/generate-grid.js +0 -1
  69. package/general/generate-organization-schema.d.ts +3 -3
  70. package/general/generate-organization-schema.js +25 -18
  71. package/general/get-available-page-limit.js +2 -2
  72. package/general/get-calendar-dates.js +14 -3
  73. package/general/get-full-name.d.ts +1 -1
  74. package/general/get-number-of-days-in-month.d.ts +1 -1
  75. package/general/get-pathname.js +4 -1
  76. package/general/is-odd.js +1 -1
  77. package/general/is-previous-button-disabled.js +3 -1
  78. package/general/parse-frontmatter.js +0 -1
  79. package/general/remove-data-image-prefix.js +3 -2
  80. package/general/repeat-times.js +0 -1
  81. package/general/resolve-current-date.js +1 -2
  82. package/general/resolve-grid.js +3 -2
  83. package/general/slugify.js +11 -9
  84. package/general/text-to-enum.js +6 -1
  85. package/general/text-to-sentence-case.js +3 -1
  86. package/general/time-out.js +5 -4
  87. package/general/truncate-text.js +3 -1
  88. package/general/upload-blob-to-private-supabase.js +2 -2
  89. package/general/upload-blob-to-public-supabase.js +2 -2
  90. package/general/upload-image-to-private-supabase.js +2 -2
  91. package/general/upload-image-to-public-supabase.js +2 -2
  92. package/general/validate-email.js +1 -1
  93. package/hooks/use-fetch.js +11 -12
  94. package/hooks/use-module-entity.js +5 -6
  95. package/hooks/use-sticky.js +0 -1
  96. package/hooks/with-seo.d.ts +1 -1
  97. package/hooks/with-seo.js +3 -4
  98. package/local-storage/get-storage-value.js +0 -1
  99. package/package.json +22 -13
  100. package/setupTests.js +1 -2
  101. package/storybook/generate-sitemap.js +0 -1
  102. package/storybook/preview.js +1 -4
  103. package/storybook/react-design-story-script.js +0 -2
  104. package/storybook/react-emoji-collection.js +8 -6
  105. package/storybook/react-emoji-story-script.js +0 -2
  106. package/storybook/react-icon-collection.js +4 -3
  107. package/storybook/react-icon-story-script.js +0 -2
  108. package/storybook/react-logo-collection.js +4 -3
  109. package/storybook/react-logo-story-script.js +0 -2
  110. package/storybook/responsive-component.js +14 -7
@@ -1,27 +1,34 @@
1
1
  "use strict";
2
- /* eslint-disable */
2
+ /**
3
+ * A util function to create Rich Schema for Organization
4
+ *
5
+ * @returns formatted date - Saturday, 11/01/2020
6
+ * @author Taimoor Khan
7
+ * @remarks AppCorp
8
+ */
9
+ /** End file docs */
3
10
  Object.defineProperty(exports, "__esModule", { value: true });
4
11
  exports.generateOrganizationSchema = void 0;
5
12
  var generateOrganizationSchema = function (_a) {
6
13
  var addressCountry = _a.addressCountry, addressLocality = _a.addressLocality, addressRegion = _a.addressRegion, appName = _a.appName, baseUrl = _a.baseUrl, description = _a.description, email = _a.email, image = _a.image, logo = _a.logo, postalCode = _a.postalCode, sameAsArr = _a.sameAsArr, streetAddress = _a.streetAddress, telephone = _a.telephone;
7
14
  return {
8
- "@context": "https://schema.org",
9
- "@type": "Organization",
10
- "image": "".concat(image),
11
- "url": "".concat(baseUrl),
12
- "sameAs": sameAsArr,
13
- "logo": "".concat(logo),
14
- "name": "".concat(appName),
15
- "description": "".concat(description),
16
- "email": "".concat(email),
17
- "telephone": "".concat(telephone),
18
- "address": {
19
- "@type": "PostalAddress",
20
- "streetAddress": "".concat(streetAddress),
21
- "addressLocality": "".concat(addressLocality),
22
- "addressCountry": "".concat(addressCountry),
23
- "addressRegion": "".concat(addressRegion),
24
- "postalCode": "".concat(postalCode),
15
+ '@context': 'https://schema.org',
16
+ '@type': 'Organization',
17
+ image: "".concat(image),
18
+ url: "".concat(baseUrl),
19
+ sameAs: sameAsArr,
20
+ logo: "".concat(logo),
21
+ name: "".concat(appName),
22
+ description: "".concat(description),
23
+ email: "".concat(email),
24
+ telephone: "".concat(telephone),
25
+ address: {
26
+ '@type': 'PostalAddress',
27
+ streetAddress: "".concat(streetAddress),
28
+ addressLocality: "".concat(addressLocality),
29
+ addressCountry: "".concat(addressCountry),
30
+ addressRegion: "".concat(addressRegion),
31
+ postalCode: "".concat(postalCode),
25
32
  },
26
33
  };
27
34
  };
@@ -14,9 +14,9 @@ var dynamic_page_limit_1 = require("./dynamic-page-limit");
14
14
  var getAvailablePageLimits = function (totalRecords) {
15
15
  var allOptions = [5, 10, 15, 25, 100];
16
16
  // Get options less than or equal to totalRecords
17
- var lowerOptions = allOptions.filter(function (opt) { return (opt < totalRecords); });
17
+ var lowerOptions = allOptions.filter(function (opt) { return opt < totalRecords; });
18
18
  // Find the next higher option
19
- var nextHigherOption = allOptions.find(function (opt) { return (opt >= totalRecords); });
19
+ var nextHigherOption = allOptions.find(function (opt) { return opt >= totalRecords; });
20
20
  // Combine lower options and next higher (if it exists)
21
21
  var availableOptions = __spreadArray([], lowerOptions, true);
22
22
  if (nextHigherOption && !availableOptions.includes(nextHigherOption)) {
@@ -22,9 +22,20 @@ dayjs_1.default.extend(weekday_1.default);
22
22
  var getCalendarDates = function (_a) {
23
23
  var month = _a.month, year = _a.year;
24
24
  var updatedMonth = month + 1;
25
- var currentMonthDays = (0, get_calendar_current_month_1.getCalendarCurrentMonth)({ month: updatedMonth, year: year });
26
- var previousMonthDays = (0, get_calendar_previous_month_1.getCalendarPreviousMonth)({ currentMonthDays: currentMonthDays, month: updatedMonth, year: year });
27
- var nextMonthDays = (0, get_calendar_next_month_1.getCalendarNextMonth)({ currentMonthDays: currentMonthDays, month: updatedMonth, year: year });
25
+ var currentMonthDays = (0, get_calendar_current_month_1.getCalendarCurrentMonth)({
26
+ month: updatedMonth,
27
+ year: year,
28
+ });
29
+ var previousMonthDays = (0, get_calendar_previous_month_1.getCalendarPreviousMonth)({
30
+ currentMonthDays: currentMonthDays,
31
+ month: updatedMonth,
32
+ year: year,
33
+ });
34
+ var nextMonthDays = (0, get_calendar_next_month_1.getCalendarNextMonth)({
35
+ currentMonthDays: currentMonthDays,
36
+ month: updatedMonth,
37
+ year: year,
38
+ });
28
39
  var days = __spreadArray(__spreadArray(__spreadArray([], previousMonthDays, true), currentMonthDays, true), nextMonthDays, true);
29
40
  return days;
30
41
  };
@@ -2,5 +2,5 @@ interface Params {
2
2
  firstName: string;
3
3
  lastName: string;
4
4
  }
5
- export declare const getFullName: ({ firstName, lastName, }: Params) => string;
5
+ export declare const getFullName: ({ firstName, lastName }: Params) => string;
6
6
  export {};
@@ -2,5 +2,5 @@ interface Params {
2
2
  year: number;
3
3
  month: number;
4
4
  }
5
- export declare const getNumberOfDaysInMonth: ({ year, month, }: Params) => number;
5
+ export declare const getNumberOfDaysInMonth: ({ year, month }: Params) => number;
6
6
  export {};
@@ -9,5 +9,8 @@
9
9
  /** End file docs */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.getPathname = void 0;
12
- var getPathname = function () { return (window && window.location.pathname.substring(0, window.location.pathname.length - 1)); };
12
+ var getPathname = function () {
13
+ return window &&
14
+ window.location.pathname.substring(0, window.location.pathname.length - 1);
15
+ };
13
16
  exports.getPathname = getPathname;
package/general/is-odd.js CHANGED
@@ -9,5 +9,5 @@
9
9
  /** End file docs */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.isOdd = void 0;
12
- var isOdd = function (num) { return (num % 2 !== 0); };
12
+ var isOdd = function (num) { return num % 2 !== 0; };
13
13
  exports.isOdd = isOdd;
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isPreviousButtonDisabled = void 0;
4
- var isPreviousButtonDisabled = function (currentPage) { return currentPage <= 1; };
4
+ var isPreviousButtonDisabled = function (currentPage) {
5
+ return currentPage <= 1;
6
+ };
5
7
  exports.isPreviousButtonDisabled = isPreviousButtonDisabled;
@@ -5,7 +5,6 @@ var parseFrontmatter = function (data) {
5
5
  var _a;
6
6
  var frontmatterRegex = /---\s*([\s\S]*?)\s*---/;
7
7
  var match = frontmatterRegex.exec(data.content);
8
- // eslint-disable-next-line
9
8
  var frontMatterBlock = match[1];
10
9
  var content = (_a = data.content) === null || _a === void 0 ? void 0 : _a.replace(frontmatterRegex, '').trim();
11
10
  var frontMatterLines = frontMatterBlock.trim().split('\n');
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.removeDataImagePrefix = void 0;
4
- var removeDataImagePrefix = function (base64) { return base64
5
- .replace(/data:image\/jpeg;base64,/i, ''); };
4
+ var removeDataImagePrefix = function (base64) {
5
+ return base64.replace(/data:image\/jpeg;base64,/i, '');
6
+ };
6
7
  exports.removeDataImagePrefix = removeDataImagePrefix;
@@ -13,7 +13,6 @@
13
13
  /** End file docs */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.repeatTimes = void 0;
16
- /* eslint-disable @typescript-eslint/no-explicit-any */
17
16
  var check_even_odd_length_1 = require("./check-even-odd-length");
18
17
  var repeatTimes = function (str, arr) {
19
18
  var stringToRepeat = str.repeat(arr.length / (0, check_even_odd_length_1.checkEvenOddLength)(arr));
@@ -12,8 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.resolveCurrentDate = void 0;
13
13
  var resolveCurrentDate = function () {
14
14
  var currentDate = new Date();
15
- return currentDate
16
- .toLocaleString('en-GB', {
15
+ return currentDate.toLocaleString('en-GB', {
17
16
  weekday: 'long',
18
17
  year: 'numeric',
19
18
  month: '2-digit',
@@ -12,6 +12,7 @@
12
12
  /** End file docs */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.resolveGrid = void 0;
15
- /* eslint-disable @typescript-eslint/no-explicit-any */
16
- var resolveGrid = function (array, gridSize) { return "repeat(".concat(array.length, ", ").concat(gridSize, ")"); };
15
+ var resolveGrid = function (array, gridSize) {
16
+ return "repeat(".concat(array.length, ", ").concat(gridSize, ")");
17
+ };
17
18
  exports.resolveGrid = resolveGrid;
@@ -10,13 +10,15 @@
10
10
  /** End file docs */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.slugify = void 0;
13
- var slugify = function (str) { return str
14
- .replaceAll(/[’|&;$%@"<>/()+,:?]/gm, '')
15
- .normalize('NFD') // normalize accented characters
16
- .replace(/[\u0300-\u036f]/g, '') // remove accents
17
- .replace(/[^a-zA-Z0-9\s-]/g, '') // remove special chars except spaces & hyphens
18
- .trim() // trim leading/trailing spaces
19
- .replace(/\s+/g, '-') // replace spaces with -
20
- .replace(/-+/g, '-') // collapse multiple hyphens
21
- .toLowerCase(); };
13
+ var slugify = function (str) {
14
+ return str
15
+ .replaceAll(/[’|&;$%@"<>/()+,:?]/gm, '')
16
+ .normalize('NFD') // normalize accented characters
17
+ .replace(/[\u0300-\u036f]/g, '') // remove accents
18
+ .replace(/[^a-zA-Z0-9\s-]/g, '') // remove special chars except spaces & hyphens
19
+ .trim() // trim leading/trailing spaces
20
+ .replace(/\s+/g, '-') // replace spaces with -
21
+ .replace(/-+/g, '-') // collapse multiple hyphens
22
+ .toLowerCase();
23
+ };
22
24
  exports.slugify = slugify;
@@ -1,5 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.textToEnum = void 0;
4
- var textToEnum = function (text) { return text.split(' ').map(function (item) { return item.toUpperCase(); }).join('_'); };
4
+ var textToEnum = function (text) {
5
+ return text
6
+ .split(' ')
7
+ .map(function (item) { return item.toUpperCase(); })
8
+ .join('_');
9
+ };
5
10
  exports.textToEnum = textToEnum;
@@ -10,5 +10,7 @@
10
10
  /** End file docs */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.textToSentenceCase = void 0;
13
- var textToSentenceCase = function (text) { return text.charAt(0).toUpperCase() + text.slice(1); };
13
+ var textToSentenceCase = function (text) {
14
+ return text.charAt(0).toUpperCase() + text.slice(1);
15
+ };
14
16
  exports.textToSentenceCase = textToSentenceCase;
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable */
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.timeout = void 0;
5
2
  /**
6
3
  * Returns a promisified setTimeout that can be awaited
7
4
  * await timeout(500);
@@ -11,5 +8,9 @@ exports.timeout = void 0;
11
8
  * @remarks
12
9
  */
13
10
  /** End file docs */
14
- var timeout = function (ms) { return new Promise(function (resolve) { return setTimeout(resolve, ms); }); };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.timeout = void 0;
13
+ var timeout = function (ms) {
14
+ return new Promise(function (resolve) { return setTimeout(resolve, ms); });
15
+ };
15
16
  exports.timeout = timeout;
@@ -12,5 +12,7 @@
12
12
  /** End file docs */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.truncateText = void 0;
15
- var truncateText = function (string, length) { return "".concat(string === null || string === void 0 ? void 0 : string.substring(0, length), "..."); };
15
+ var truncateText = function (string, length) {
16
+ return "".concat(string === null || string === void 0 ? void 0 : string.substring(0, length), "...");
17
+ };
16
18
  exports.truncateText = truncateText;
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -46,7 +45,8 @@ var uploadBlobToPrivateSupabase = function (_a) { return __awaiter(void 0, [_a],
46
45
  case 0: return [4 /*yield*/, supabase.storage
47
46
  .from(process.env.NEXT_PUBLIC_SUPABASE_PRIVATE_BUCKET)
48
47
  .upload(fileRef, blob, {
49
- cacheControl: cacheControl || process.env.NEXT_PUBLIC_SUPABASE_CACHE_CONTROL,
48
+ cacheControl: cacheControl ||
49
+ process.env.NEXT_PUBLIC_SUPABASE_CACHE_CONTROL,
50
50
  contentType: contentType,
51
51
  upsert: upsert,
52
52
  })];
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -46,7 +45,8 @@ var uploadBlobToPublicSupabase = function (_a) { return __awaiter(void 0, [_a],
46
45
  case 0: return [4 /*yield*/, supabase.storage
47
46
  .from(process.env.NEXT_PUBLIC_SUPABASE_PUBLIC_BUCKET)
48
47
  .upload(fileRef, blob, {
49
- cacheControl: cacheControl || process.env.NEXT_PUBLIC_SUPABASE_CACHE_CONTROL,
48
+ cacheControl: cacheControl ||
49
+ process.env.NEXT_PUBLIC_SUPABASE_CACHE_CONTROL,
50
50
  contentType: contentType,
51
51
  upsert: upsert,
52
52
  })];
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -50,7 +49,8 @@ var uploadImageToPrivateSupabase = function (_a) { return __awaiter(void 0, [_a]
50
49
  return [4 /*yield*/, supabase.storage
51
50
  .from(process.env.NEXT_PUBLIC_SUPABASE_PRIVATE_BUCKET)
52
51
  .upload(fileRef, buffer, {
53
- cacheControl: cacheControl || process.env.NEXT_PUBLIC_SUPABASE_CACHE_CONTROL,
52
+ cacheControl: cacheControl ||
53
+ process.env.NEXT_PUBLIC_SUPABASE_CACHE_CONTROL,
54
54
  contentType: contentType,
55
55
  upsert: upsert,
56
56
  })];
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -50,7 +49,8 @@ var uploadImageToPublicSupabase = function (_a) { return __awaiter(void 0, [_a],
50
49
  return [4 /*yield*/, supabase.storage
51
50
  .from(process.env.NEXT_PUBLIC_SUPABASE_PUBLIC_BUCKET)
52
51
  .upload(fileRef, buffer, {
53
- cacheControl: cacheControl || process.env.NEXT_PUBLIC_SUPABASE_CACHE_CONTROL,
52
+ cacheControl: cacheControl ||
53
+ process.env.NEXT_PUBLIC_SUPABASE_CACHE_CONTROL,
54
54
  contentType: contentType,
55
55
  upsert: upsert,
56
56
  })];
@@ -13,7 +13,7 @@
13
13
  /** End file docs */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.validateEmail = void 0;
16
- /* eslint-disable max-len, no-useless-escape */
16
+ /* eslint-disable no-useless-escape */
17
17
  var emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/gi;
18
18
  var validateEmail = function (email) {
19
19
  if (email.match(emailRegex)) {
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any, no-void, no-restricted-globals */
3
2
  var __assign = (this && this.__assign) || function () {
4
3
  __assign = Object.assign || function(t) {
5
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -94,9 +93,9 @@ var useFetch = function (url, config, deps) {
94
93
  };
95
94
  }, []);
96
95
  var fetchNow = (0, react_1.useCallback)(function (overrideUrl, overrideOptions) { return __awaiter(void 0, void 0, void 0, function () {
97
- var finalUrl, finalOptions, controller, response, parsed, e_1, err, err_1;
98
- return __generator(this, function (_a) {
99
- switch (_a.label) {
96
+ var finalUrl, finalOptions, controller, response, parsed, _a, err, err_1;
97
+ return __generator(this, function (_b) {
98
+ switch (_b.label) {
100
99
  case 0:
101
100
  finalUrl = overrideUrl || url;
102
101
  finalOptions = __assign(__assign(__assign({}, defaultOptions), overrideOptions), { headers: __assign(__assign({}, defaultOptions.headers), ((overrideOptions === null || overrideOptions === void 0 ? void 0 : overrideOptions.headers) || {})) });
@@ -106,22 +105,22 @@ var useFetch = function (url, config, deps) {
106
105
  controller = new AbortController();
107
106
  abortControllerRef.current = controller;
108
107
  finalOptions.signal = controller.signal;
109
- _a.label = 1;
108
+ _b.label = 1;
110
109
  case 1:
111
- _a.trys.push([1, 7, 8, 9]);
110
+ _b.trys.push([1, 7, 8, 9]);
112
111
  return [4 /*yield*/, fetch(finalUrl, finalOptions)];
113
112
  case 2:
114
- response = _a.sent();
113
+ response = _b.sent();
115
114
  parsed = null;
116
- _a.label = 3;
115
+ _b.label = 3;
117
116
  case 3:
118
- _a.trys.push([3, 5, , 6]);
117
+ _b.trys.push([3, 5, , 6]);
119
118
  return [4 /*yield*/, response.json()];
120
119
  case 4:
121
- parsed = _a.sent();
120
+ parsed = _b.sent();
122
121
  return [3 /*break*/, 6];
123
122
  case 5:
124
- e_1 = _a.sent();
123
+ _a = _b.sent();
125
124
  // non-json or empty body
126
125
  parsed = null;
127
126
  return [3 /*break*/, 6];
@@ -153,7 +152,7 @@ var useFetch = function (url, config, deps) {
153
152
  }
154
153
  return [3 /*break*/, 9];
155
154
  case 7:
156
- err_1 = _a.sent();
155
+ err_1 = _b.sent();
157
156
  if (isMounted.current) {
158
157
  setError(err_1);
159
158
  setData(null);
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any, no-restricted-globals */
3
2
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
4
3
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
5
4
  if (ar || !(i in from)) {
@@ -45,7 +44,7 @@ var useModuleEntity = function (_a) {
45
44
  body: JSON.stringify(listParams),
46
45
  });
47
46
  }
48
- catch (e) {
47
+ catch (_a) {
49
48
  // noop
50
49
  }
51
50
  refreshTimerRef.current = null;
@@ -60,7 +59,7 @@ var useModuleEntity = function (_a) {
60
59
  try {
61
60
  updateCallback(d);
62
61
  }
63
- catch (e) {
62
+ catch (_a) {
64
63
  // swallow callback errors to ensure list refresh still runs
65
64
  // caller's callback is responsible for its own error handling
66
65
  }
@@ -71,7 +70,7 @@ var useModuleEntity = function (_a) {
71
70
  refreshList();
72
71
  }
73
72
  }
74
- catch (e) {
73
+ catch (_b) {
75
74
  // noop
76
75
  }
77
76
  },
@@ -91,7 +90,7 @@ var useModuleEntity = function (_a) {
91
90
  try {
92
91
  deleteCallback(d);
93
92
  }
94
- catch (e) {
93
+ catch (_a) {
95
94
  // swallow callback errors to ensure list refresh still runs
96
95
  }
97
96
  }
@@ -101,7 +100,7 @@ var useModuleEntity = function (_a) {
101
100
  refreshList();
102
101
  }
103
102
  }
104
- catch (e) {
103
+ catch (_b) {
105
104
  // noop
106
105
  }
107
106
  },
@@ -11,7 +11,6 @@
11
11
  /** End file docs */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  exports.useSticky = void 0;
14
- /* eslint-disable consistent-return */
15
14
  var react_1 = require("react");
16
15
  var use_toggle_state_1 = require("./use-toggle-state");
17
16
  var useSticky = function (offset) {
@@ -5,5 +5,5 @@ interface WrapperProps {
5
5
  faqJsonLd?: any;
6
6
  [key: string]: any;
7
7
  }
8
- export declare const withSEO: (Component: ComponentType<WrapperProps>, rest: WrapperProps) => () => JSX.Element;
8
+ export declare const withSEO: (Component: ComponentType<WrapperProps>, rest: WrapperProps) => (() => JSX.Element);
9
9
  export {};
package/hooks/with-seo.js CHANGED
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  var __assign = (this && this.__assign) || function () {
4
3
  __assign = Object.assign || function(t) {
5
4
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -21,13 +20,13 @@ var script_1 = __importDefault(require("next/script"));
21
20
  var withSEO = function (Component, rest) {
22
21
  var EnhancedComponent = function () { return (react_1.default.createElement(react_1.default.Fragment, null,
23
22
  react_1.default.createElement(Component, __assign({}, rest)),
24
- rest.organizationJsonLd && (react_1.default.createElement(script_1.default, { id: 'organization-schema', type: 'application/ld+json', dangerouslySetInnerHTML: {
23
+ rest.organizationJsonLd && (react_1.default.createElement(script_1.default, { id: "organization-schema", type: "application/ld+json", dangerouslySetInnerHTML: {
25
24
  __html: JSON.stringify(rest.organizationJsonLd),
26
25
  } })),
27
- rest.breadcrumbJsonLd && (react_1.default.createElement(script_1.default, { id: 'breadcrumb-schema', type: 'application/ld+json', dangerouslySetInnerHTML: {
26
+ rest.breadcrumbJsonLd && (react_1.default.createElement(script_1.default, { id: "breadcrumb-schema", type: "application/ld+json", dangerouslySetInnerHTML: {
28
27
  __html: JSON.stringify(rest.breadcrumbJsonLd),
29
28
  } })),
30
- rest.faqJsonLd && (react_1.default.createElement(script_1.default, { id: 'faq-schema', type: 'application/ld+json', dangerouslySetInnerHTML: {
29
+ rest.faqJsonLd && (react_1.default.createElement(script_1.default, { id: "faq-schema", type: "application/ld+json", dangerouslySetInnerHTML: {
31
30
  __html: JSON.stringify(rest.faqJsonLd),
32
31
  } })))); };
33
32
  return EnhancedComponent;
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable consistent-return */
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.getStorageValue = void 0;
5
4
  var getStorageValue = function (key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-pakistan/util-functions",
3
- "version": "1.24.65",
3
+ "version": "1.24.66",
4
4
  "description": "A library of all util functions",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,14 +9,17 @@
9
9
  "build:ts": "tsc --project tsconfig.json",
10
10
  "clean:badges": "yarn rimraf ./badges",
11
11
  "clean:build": "yarn rimraf ./lib",
12
+ "format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
13
+ "format:check": "prettier --check \"**/*.{ts,tsx,js,jsx,json,md}\"",
12
14
  "generate:docs": "typedoc",
13
15
  "generate:sitemap": "scripts/generate-sitemap.sh",
14
- "lint": "yarn lint:ts",
16
+ "lint": "eslint .",
17
+ "lint:fix": "eslint . --fix",
15
18
  "lint:staged": "lint-staged",
16
- "lint:ts": "eslint --config .eslintrc .",
17
19
  "major": "npm version major",
18
20
  "minor": "npm version minor",
19
21
  "patch": "npm version patch",
22
+ "prepare": "husky",
20
23
  "publish:github": "yarn build && cd lib && npm publish && cd ..",
21
24
  "publish:npm": "yarn build && cd lib && npm publish --access public && cd ..",
22
25
  "test": "jest --coverage --config jest.config.js",
@@ -28,8 +31,12 @@
28
31
  "url": "git+https://github.com/react-pakistan/util-functions.git"
29
32
  },
30
33
  "lint-staged": {
31
- "*.{ts,tx}": [
32
- "yarn lint"
34
+ "*.{ts,tsx,js,jsx}": [
35
+ "eslint --fix",
36
+ "prettier --write"
37
+ ],
38
+ "*.{json,md}": [
39
+ "prettier --write"
33
40
  ]
34
41
  },
35
42
  "author": "Taimoor Khan",
@@ -41,32 +48,33 @@
41
48
  "devDependencies": {
42
49
  "@appcorp/app-corp-vista": "^0.1.20",
43
50
  "@babel/core": "^7.24.5",
44
- "@babel/eslint-parser": "^7.24.5",
45
51
  "@babel/preset-typescript": "^7.24.1",
52
+ "@eslint/js": "^9.17.0",
46
53
  "@microsoft/tsdoc": "^0.14.2",
47
- "@react-pakistan/eslint-config-shared": "^1.11.3",
48
54
  "@testing-library/react": "^14.0.0",
49
55
  "@testing-library/react-hooks": "^8.0.1",
56
+ "@types/eslint__js": "^8.42.3",
50
57
  "@types/jest": "^29.5.12",
51
58
  "@types/lodash.curry": "^4.1.9",
52
59
  "@types/node": "^20.12.8",
53
60
  "@types/styled-components": "^5.1.34",
54
- "@typescript-eslint/eslint-plugin": "^7.8.0",
55
- "@typescript-eslint/parser": "^7.8.0",
56
61
  "date-fns": "^2.30.0",
57
62
  "date-fns-tz": "^2.0.0",
58
63
  "dayjs": "^1.11.13",
59
- "eslint": "^8.57.0",
60
- "eslint-config-airbnb": "^19.0.4",
61
- "eslint-plugin-import": "^2.29.1",
62
- "husky": "^9.0.11",
64
+ "eslint": "^9.17.0",
65
+ "eslint-config-prettier": "^9.1.0",
66
+ "eslint-plugin-prettier": "^5.2.1",
67
+ "globals": "^15.13.0",
68
+ "husky": "^9.1.7",
63
69
  "jest": "^29.7.0",
70
+ "jest-coverage-badges": "^1.1.2",
64
71
  "jest-environment-jsdom": "^29.7.0",
65
72
  "libphonenumber-js": "^1.12.13",
66
73
  "lint-staged": "^15.2.2",
67
74
  "lodash.curry": "^4.1.1",
68
75
  "lodash.isequal": "^4.5.0",
69
76
  "next": "^15",
77
+ "prettier": "^3.4.2",
70
78
  "react": "^19.2.0",
71
79
  "react-dom": "^19.2.0",
72
80
  "react-use": "^17",
@@ -75,6 +83,7 @@
75
83
  "ts-loader": "^9",
76
84
  "ts-node": "^10",
77
85
  "typescript": "^5",
86
+ "typescript-eslint": "^8.18.1",
78
87
  "uuid": "^11",
79
88
  "zod": "^4"
80
89
  },
package/setupTests.js CHANGED
@@ -39,7 +39,7 @@ console.error = function () {
39
39
  }
40
40
  }
41
41
  }
42
- catch (e) {
42
+ catch (_c) {
43
43
  // if anything goes wrong while matching, fall back to original
44
44
  return origConsoleError.apply(void 0, args);
45
45
  }
@@ -48,6 +48,5 @@ console.error = function () {
48
48
  };
49
49
  // Provide a small helper to restore console in case tests need it
50
50
  function __restoreConsoleErrors() {
51
- // @ts-ignore
52
51
  console.error = origConsoleError;
53
52
  }
@@ -14,7 +14,6 @@
14
14
  /** End file docs */
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.generateSitemap = void 0;
17
- /* eslint-disable @typescript-eslint/no-explicit-any */
18
17
  var generateSitemap = function (baseUrl, fs, stories) {
19
18
  var generatedSitemap = '';
20
19
  Object.keys(stories).forEach(function (id) {
@@ -41,10 +41,7 @@ exports.globalTypes = {
41
41
  defaultValue: 'light',
42
42
  toolbar: {
43
43
  icon: 'circlehollow',
44
- items: [
45
- 'light',
46
- 'dark',
47
- ],
44
+ items: ['light', 'dark'],
48
45
  },
49
46
  },
50
47
  locale: {