@react-pakistan/util-functions 1.23.32 → 1.23.34

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 (105) hide show
  1. package/api/cors/index.js +6 -6
  2. package/api/stellar-solutions/app-user/index.js +97 -38
  3. package/api/stellar-solutions/banking-detail/index.js +107 -48
  4. package/api/stellar-solutions/branch/index.js +107 -48
  5. package/api/stellar-solutions/company/index.js +124 -57
  6. package/api/stellar-solutions/company-report/index.js +48 -13
  7. package/api/stellar-solutions/contact/index.js +132 -65
  8. package/api/stellar-solutions/currency/index.js +101 -42
  9. package/api/stellar-solutions/customer/index.js +149 -74
  10. package/api/stellar-solutions/expense/index.js +132 -65
  11. package/api/stellar-solutions/expense-category/index.js +133 -66
  12. package/api/stellar-solutions/lead/index.js +132 -65
  13. package/api/stellar-solutions/menu-order/index.js +97 -38
  14. package/api/stellar-solutions/payment/index.js +135 -77
  15. package/api/stellar-solutions/payment-mode/index.js +90 -31
  16. package/api/stellar-solutions/preference/index.js +71 -28
  17. package/api/stellar-solutions/product/index.js +144 -77
  18. package/api/stellar-solutions/product-category/index.js +130 -63
  19. package/api/stellar-solutions/profile/index.js +152 -77
  20. package/api/stellar-solutions/quote-invoice/index.js +280 -201
  21. package/api/stellar-solutions/quote-invoice-report/index.js +48 -13
  22. package/api/stellar-solutions/tax/index.js +103 -44
  23. package/constants/react-pakistan.js +11 -22
  24. package/constants/social-media-sizes.js +33 -32
  25. package/general/basic-get.js +68 -6
  26. package/general/basic-post.js +55 -6
  27. package/general/camel-to-sentence-case.js +3 -3
  28. package/general/check-even-odd-length.js +1 -1
  29. package/general/create-date.js +4 -4
  30. package/general/dynamic-page-limit.js +15 -4
  31. package/general/enum-to-text.js +2 -2
  32. package/general/fetch-supabase-image.js +53 -15
  33. package/general/format-date.js +13 -12
  34. package/general/generate-blog-schema.js +10 -9
  35. package/general/generate-breadcrumb-schema.js +5 -4
  36. package/general/generate-faq-schema.js +5 -3
  37. package/general/generate-grid.js +2 -2
  38. package/general/generate-organization-schema.js +14 -13
  39. package/general/get-day-name.js +1 -1
  40. package/general/get-full-name.js +4 -1
  41. package/general/get-href.js +1 -1
  42. package/general/get-month-name.js +1 -1
  43. package/general/get-pathname.js +1 -1
  44. package/general/index.d.ts +2 -2
  45. package/general/index.js +2 -2
  46. package/general/is-next-button-disabled.js +1 -1
  47. package/general/is-odd.js +1 -1
  48. package/general/is-previous-button-disabled.js +1 -1
  49. package/general/remove-data-image-prefix.js +2 -2
  50. package/general/repeat-times.js +3 -3
  51. package/general/resolve-anchor-link.js +4 -4
  52. package/general/resolve-current-date.js +2 -2
  53. package/general/resolve-grid.js +1 -1
  54. package/general/resolve-initials.js +2 -2
  55. package/general/set-timezone.js +6 -3
  56. package/general/slugify.js +2 -2
  57. package/general/text-to-enum.js +1 -1
  58. package/general/text-to-sentence-case.js +1 -1
  59. package/general/truncate-text.js +1 -1
  60. package/general/upload-blob-to-private-supabase.d.ts +11 -0
  61. package/general/upload-blob-to-private-supabase.js +62 -0
  62. package/general/upload-blob-to-public-supabase.d.ts +11 -0
  63. package/general/upload-blob-to-public-supabase.js +62 -0
  64. package/general/upload-image-to-private-supabase.js +51 -15
  65. package/general/upload-image-to-public-supabase.js +51 -15
  66. package/general/url-to-sentence-case.js +4 -4
  67. package/general/validate-comment.js +1 -1
  68. package/general/validate-email.js +2 -2
  69. package/general/validate-name.js +1 -1
  70. package/hooks/index.d.ts +0 -1
  71. package/hooks/index.js +0 -1
  72. package/hooks/use-change.js +14 -5
  73. package/hooks/use-debounce.js +7 -6
  74. package/hooks/use-fetch.js +82 -31
  75. package/hooks/use-force-render.js +3 -3
  76. package/hooks/use-ip-geo-location.js +57 -22
  77. package/hooks/use-is-mobile.js +6 -6
  78. package/hooks/use-position.js +16 -16
  79. package/hooks/use-sticky.js +9 -8
  80. package/hooks/use-toggle-state.js +6 -5
  81. package/hooks/use-window-event-listener.js +4 -4
  82. package/local-storage/get-storage-value.js +2 -2
  83. package/local-storage/remove-storage-value.js +1 -1
  84. package/local-storage/set-storage-value.js +1 -1
  85. package/package.json +1 -1
  86. package/storybook/generate-sitemap.js +6 -22
  87. package/storybook/preview.js +13 -2
  88. package/storybook/react-design-story-script.js +7 -11
  89. package/storybook/react-emoji-collection.js +23 -33
  90. package/storybook/react-emoji-story-script.js +9 -13
  91. package/storybook/react-emoji-story-template.js +1 -46
  92. package/storybook/react-icon-collection.js +17 -27
  93. package/storybook/react-icon-story-script.js +9 -13
  94. package/storybook/react-icon-story-template.js +1 -46
  95. package/storybook/react-logo-collection.js +17 -27
  96. package/storybook/react-logo-story-script.js +9 -13
  97. package/storybook/react-logo-story-template.js +1 -46
  98. package/storybook/responsive-component.js +11 -46
  99. package/storybook/theme.js +4 -4
  100. package/general/upload-image-blob-to-private-supabase.d.ts +0 -11
  101. package/general/upload-image-blob-to-private-supabase.js +0 -27
  102. package/general/upload-image-blob-to-public-supabase.d.ts +0 -11
  103. package/general/upload-image-blob-to-public-supabase.js +0 -27
  104. package/hooks/with-seo.d.ts +0 -9
  105. package/hooks/with-seo.js +0 -43
@@ -9,90 +9,165 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  step((generator = generator.apply(thisArg, _arguments || [])).next());
10
10
  });
11
11
  };
12
+ var __generator = (this && this.__generator) || function (thisArg, body) {
13
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
14
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
+ function verb(n) { return function (v) { return step([n, v]); }; }
16
+ function step(op) {
17
+ if (f) throw new TypeError("Generator is already executing.");
18
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
20
+ if (y = 0, t) op = [op[0] & 2, t.value];
21
+ switch (op[0]) {
22
+ case 0: case 1: t = op; break;
23
+ case 4: _.label++; return { value: op[1], done: false };
24
+ case 5: _.label++; y = op[1]; op = [0]; continue;
25
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
26
+ default:
27
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
28
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
29
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
30
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
31
+ if (t[2]) _.ops.pop();
32
+ _.trys.pop(); continue;
33
+ }
34
+ op = body.call(thisArg, _);
35
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
36
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
+ }
38
+ };
12
39
  Object.defineProperty(exports, "__esModule", { value: true });
13
40
  exports.deleteCustomer = exports.postCustomer = exports.postCustomers = exports.getCustomerByPhone = exports.getCustomerById = exports.getCustomers = void 0;
14
- const getCustomers = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
15
- const customers = yield prisma.customer.findMany({
16
- orderBy: {
17
- createdAt: 'desc',
18
- },
19
- include: {
20
- contacts: true,
21
- },
41
+ var getCustomers = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
42
+ var customers;
43
+ var prisma = _b.prisma;
44
+ return __generator(this, function (_c) {
45
+ switch (_c.label) {
46
+ case 0: return [4 /*yield*/, prisma.customer.findMany({
47
+ orderBy: {
48
+ createdAt: 'desc',
49
+ },
50
+ include: {
51
+ contacts: true,
52
+ },
53
+ })];
54
+ case 1:
55
+ customers = _c.sent();
56
+ return [2 /*return*/, customers];
57
+ }
22
58
  });
23
- return customers;
24
- });
59
+ }); };
25
60
  exports.getCustomers = getCustomers;
26
- const getCustomerById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id, }) {
27
- const customer = yield prisma.customer.findUnique({
28
- where: {
29
- id,
30
- },
31
- include: {
32
- contacts: true,
33
- },
61
+ var getCustomerById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
62
+ var customer;
63
+ var prisma = _b.prisma, id = _b.id;
64
+ return __generator(this, function (_c) {
65
+ switch (_c.label) {
66
+ case 0: return [4 /*yield*/, prisma.customer.findUnique({
67
+ where: {
68
+ id: id,
69
+ },
70
+ include: {
71
+ contacts: true,
72
+ },
73
+ })];
74
+ case 1:
75
+ customer = _c.sent();
76
+ return [2 /*return*/, customer];
77
+ }
34
78
  });
35
- return customer;
36
- });
79
+ }); };
37
80
  exports.getCustomerById = getCustomerById;
38
- const getCustomerByPhone = (_c) => __awaiter(void 0, [_c], void 0, function* ({ prisma, phone }) {
39
- const customer = yield prisma.customer.findUnique({
40
- where: {
41
- phone,
42
- },
81
+ var getCustomerByPhone = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
82
+ var customer;
83
+ var prisma = _b.prisma, phone = _b.phone;
84
+ return __generator(this, function (_c) {
85
+ switch (_c.label) {
86
+ case 0: return [4 /*yield*/, prisma.customer.findUnique({
87
+ where: {
88
+ phone: phone,
89
+ },
90
+ })];
91
+ case 1:
92
+ customer = _c.sent();
93
+ return [2 /*return*/, customer];
94
+ }
43
95
  });
44
- return customer;
45
- });
96
+ }); };
46
97
  exports.getCustomerByPhone = getCustomerByPhone;
47
- const postCustomers = (_d) => __awaiter(void 0, [_d], void 0, function* ({ currentPage, include, orderBy, pageLimit, prisma, queryWhere, }) {
48
- const customers = yield prisma.$transaction([
49
- prisma.customer.count({
50
- where: queryWhere,
51
- }),
52
- prisma.customer.findMany({
53
- orderBy,
54
- include,
55
- where: queryWhere,
56
- take: pageLimit,
57
- skip: (currentPage - 1) * pageLimit,
58
- }),
59
- ]);
60
- return customers;
61
- });
98
+ var postCustomers = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
99
+ var customers;
100
+ var currentPage = _b.currentPage, include = _b.include, orderBy = _b.orderBy, pageLimit = _b.pageLimit, prisma = _b.prisma, queryWhere = _b.queryWhere;
101
+ return __generator(this, function (_c) {
102
+ switch (_c.label) {
103
+ case 0: return [4 /*yield*/, prisma.$transaction([
104
+ prisma.customer.count({
105
+ where: queryWhere,
106
+ }),
107
+ prisma.customer.findMany({
108
+ orderBy: orderBy,
109
+ include: include,
110
+ where: queryWhere,
111
+ take: pageLimit,
112
+ skip: (currentPage - 1) * pageLimit,
113
+ }),
114
+ ])];
115
+ case 1:
116
+ customers = _c.sent();
117
+ return [2 /*return*/, customers];
118
+ }
119
+ });
120
+ }); };
62
121
  exports.postCustomers = postCustomers;
63
- const postCustomer = (_e) => __awaiter(void 0, [_e], void 0, function* ({ prisma, id, address, city, country, email, firstName, lastName, phone, }) {
64
- const customer = yield prisma.customer.upsert({
65
- where: {
66
- id,
67
- },
68
- update: {
69
- address,
70
- city,
71
- country,
72
- email,
73
- firstName,
74
- lastName,
75
- phone,
76
- },
77
- create: {
78
- address,
79
- city,
80
- country,
81
- email,
82
- firstName,
83
- lastName,
84
- phone,
85
- },
122
+ var postCustomer = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
123
+ var customer;
124
+ var prisma = _b.prisma, id = _b.id, address = _b.address, city = _b.city, country = _b.country, email = _b.email, firstName = _b.firstName, lastName = _b.lastName, phone = _b.phone;
125
+ return __generator(this, function (_c) {
126
+ switch (_c.label) {
127
+ case 0: return [4 /*yield*/, prisma.customer.upsert({
128
+ where: {
129
+ id: id,
130
+ },
131
+ update: {
132
+ address: address,
133
+ city: city,
134
+ country: country,
135
+ email: email,
136
+ firstName: firstName,
137
+ lastName: lastName,
138
+ phone: phone,
139
+ },
140
+ create: {
141
+ address: address,
142
+ city: city,
143
+ country: country,
144
+ email: email,
145
+ firstName: firstName,
146
+ lastName: lastName,
147
+ phone: phone,
148
+ },
149
+ })];
150
+ case 1:
151
+ customer = _c.sent();
152
+ return [2 /*return*/, customer];
153
+ }
86
154
  });
87
- return customer;
88
- });
155
+ }); };
89
156
  exports.postCustomer = postCustomer;
90
- const deleteCustomer = (_f) => __awaiter(void 0, [_f], void 0, function* ({ prisma, id }) {
91
- const customer = yield prisma.customer.delete({
92
- where: {
93
- id,
94
- },
157
+ var deleteCustomer = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
158
+ var customer;
159
+ var prisma = _b.prisma, id = _b.id;
160
+ return __generator(this, function (_c) {
161
+ switch (_c.label) {
162
+ case 0: return [4 /*yield*/, prisma.customer.delete({
163
+ where: {
164
+ id: id,
165
+ },
166
+ })];
167
+ case 1:
168
+ customer = _c.sent();
169
+ return [2 /*return*/, customer];
170
+ }
95
171
  });
96
- return customer;
97
- });
172
+ }); };
98
173
  exports.deleteCustomer = deleteCustomer;
@@ -9,79 +9,146 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  step((generator = generator.apply(thisArg, _arguments || [])).next());
10
10
  });
11
11
  };
12
+ var __generator = (this && this.__generator) || function (thisArg, body) {
13
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
14
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
15
+ function verb(n) { return function (v) { return step([n, v]); }; }
16
+ function step(op) {
17
+ if (f) throw new TypeError("Generator is already executing.");
18
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
19
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
20
+ if (y = 0, t) op = [op[0] & 2, t.value];
21
+ switch (op[0]) {
22
+ case 0: case 1: t = op; break;
23
+ case 4: _.label++; return { value: op[1], done: false };
24
+ case 5: _.label++; y = op[1]; op = [0]; continue;
25
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
26
+ default:
27
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
28
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
29
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
30
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
31
+ if (t[2]) _.ops.pop();
32
+ _.trys.pop(); continue;
33
+ }
34
+ op = body.call(thisArg, _);
35
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
36
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
37
+ }
38
+ };
12
39
  Object.defineProperty(exports, "__esModule", { value: true });
13
40
  exports.deleteExpense = exports.postExpense = exports.postExpenses = exports.getExpenseById = exports.getExpenses = void 0;
14
- const getExpenses = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
15
- const expenses = yield prisma.expense.findMany({
16
- orderBy: {
17
- createdAt: 'desc',
18
- },
19
- include: {
20
- expenseCategory: true,
21
- },
41
+ var getExpenses = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
42
+ var expenses;
43
+ var prisma = _b.prisma;
44
+ return __generator(this, function (_c) {
45
+ switch (_c.label) {
46
+ case 0: return [4 /*yield*/, prisma.expense.findMany({
47
+ orderBy: {
48
+ createdAt: 'desc',
49
+ },
50
+ include: {
51
+ expenseCategory: true,
52
+ },
53
+ })];
54
+ case 1:
55
+ expenses = _c.sent();
56
+ return [2 /*return*/, expenses];
57
+ }
22
58
  });
23
- return expenses;
24
- });
59
+ }); };
25
60
  exports.getExpenses = getExpenses;
26
- const getExpenseById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ id, prisma, }) {
27
- const expense = yield prisma.expense.findUnique({
28
- where: {
29
- id,
30
- },
31
- include: {
32
- expenseCategory: true,
33
- },
61
+ var getExpenseById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
62
+ var expense;
63
+ var id = _b.id, prisma = _b.prisma;
64
+ return __generator(this, function (_c) {
65
+ switch (_c.label) {
66
+ case 0: return [4 /*yield*/, prisma.expense.findUnique({
67
+ where: {
68
+ id: id,
69
+ },
70
+ include: {
71
+ expenseCategory: true,
72
+ },
73
+ })];
74
+ case 1:
75
+ expense = _c.sent();
76
+ return [2 /*return*/, expense];
77
+ }
34
78
  });
35
- return expense;
36
- });
79
+ }); };
37
80
  exports.getExpenseById = getExpenseById;
38
- const postExpenses = (_c) => __awaiter(void 0, [_c], void 0, function* ({ currentPage, include, orderBy, pageLimit, prisma, queryWhere, }) {
39
- const expenses = yield prisma.$transaction([
40
- prisma.expense.count({
41
- where: queryWhere,
42
- }),
43
- prisma.expense.findMany({
44
- orderBy,
45
- include,
46
- where: queryWhere,
47
- take: pageLimit,
48
- skip: (currentPage - 1) * pageLimit,
49
- }),
50
- ]);
51
- return expenses;
52
- });
81
+ var postExpenses = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
82
+ var expenses;
83
+ var currentPage = _b.currentPage, include = _b.include, orderBy = _b.orderBy, pageLimit = _b.pageLimit, prisma = _b.prisma, queryWhere = _b.queryWhere;
84
+ return __generator(this, function (_c) {
85
+ switch (_c.label) {
86
+ case 0: return [4 /*yield*/, prisma.$transaction([
87
+ prisma.expense.count({
88
+ where: queryWhere,
89
+ }),
90
+ prisma.expense.findMany({
91
+ orderBy: orderBy,
92
+ include: include,
93
+ where: queryWhere,
94
+ take: pageLimit,
95
+ skip: (currentPage - 1) * pageLimit,
96
+ }),
97
+ ])];
98
+ case 1:
99
+ expenses = _c.sent();
100
+ return [2 /*return*/, expenses];
101
+ }
102
+ });
103
+ }); };
53
104
  exports.postExpenses = postExpenses;
54
- const postExpense = (_d) => __awaiter(void 0, [_d], void 0, function* ({ currency, description, expenseCategoryId, id, name, prisma, ref, total, }) {
55
- const expense = yield prisma.expense.upsert({
56
- where: {
57
- id,
58
- },
59
- update: {
60
- currency,
61
- description,
62
- expenseCategoryId,
63
- name,
64
- ref,
65
- total,
66
- },
67
- create: {
68
- currency,
69
- description,
70
- expenseCategoryId,
71
- name,
72
- ref,
73
- total,
74
- },
105
+ var postExpense = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
106
+ var expense;
107
+ var currency = _b.currency, description = _b.description, expenseCategoryId = _b.expenseCategoryId, id = _b.id, name = _b.name, prisma = _b.prisma, ref = _b.ref, total = _b.total;
108
+ return __generator(this, function (_c) {
109
+ switch (_c.label) {
110
+ case 0: return [4 /*yield*/, prisma.expense.upsert({
111
+ where: {
112
+ id: id,
113
+ },
114
+ update: {
115
+ currency: currency,
116
+ description: description,
117
+ expenseCategoryId: expenseCategoryId,
118
+ name: name,
119
+ ref: ref,
120
+ total: total,
121
+ },
122
+ create: {
123
+ currency: currency,
124
+ description: description,
125
+ expenseCategoryId: expenseCategoryId,
126
+ name: name,
127
+ ref: ref,
128
+ total: total,
129
+ },
130
+ })];
131
+ case 1:
132
+ expense = _c.sent();
133
+ return [2 /*return*/, expense];
134
+ }
75
135
  });
76
- return expense;
77
- });
136
+ }); };
78
137
  exports.postExpense = postExpense;
79
- const deleteExpense = (_e) => __awaiter(void 0, [_e], void 0, function* ({ prisma, id, }) {
80
- const expense = yield prisma.expense.delete({
81
- where: {
82
- id,
83
- },
138
+ var deleteExpense = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
139
+ var expense;
140
+ var prisma = _b.prisma, id = _b.id;
141
+ return __generator(this, function (_c) {
142
+ switch (_c.label) {
143
+ case 0: return [4 /*yield*/, prisma.expense.delete({
144
+ where: {
145
+ id: id,
146
+ },
147
+ })];
148
+ case 1:
149
+ expense = _c.sent();
150
+ return [2 /*return*/, expense];
151
+ }
84
152
  });
85
- return expense;
86
- });
153
+ }); };
87
154
  exports.deleteExpense = deleteExpense;