@react-pakistan/util-functions 1.23.33 → 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 (101) 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/use-change.js +14 -5
  71. package/hooks/use-debounce.js +7 -6
  72. package/hooks/use-fetch.js +82 -31
  73. package/hooks/use-force-render.js +3 -3
  74. package/hooks/use-ip-geo-location.js +57 -22
  75. package/hooks/use-is-mobile.js +6 -6
  76. package/hooks/use-position.js +16 -16
  77. package/hooks/use-sticky.js +9 -8
  78. package/hooks/use-toggle-state.js +6 -5
  79. package/hooks/use-window-event-listener.js +4 -4
  80. package/local-storage/get-storage-value.js +2 -2
  81. package/local-storage/remove-storage-value.js +1 -1
  82. package/local-storage/set-storage-value.js +1 -1
  83. package/package.json +1 -1
  84. package/storybook/generate-sitemap.js +6 -22
  85. package/storybook/preview.js +13 -2
  86. package/storybook/react-design-story-script.js +7 -11
  87. package/storybook/react-emoji-collection.js +23 -33
  88. package/storybook/react-emoji-story-script.js +9 -13
  89. package/storybook/react-emoji-story-template.js +1 -46
  90. package/storybook/react-icon-collection.js +17 -27
  91. package/storybook/react-icon-story-script.js +9 -13
  92. package/storybook/react-icon-story-template.js +1 -46
  93. package/storybook/react-logo-collection.js +17 -27
  94. package/storybook/react-logo-story-script.js +9 -13
  95. package/storybook/react-logo-story-template.js +1 -46
  96. package/storybook/responsive-component.js +11 -46
  97. package/storybook/theme.js +4 -4
  98. package/general/upload-image-blob-to-private-supabase.d.ts +0 -11
  99. package/general/upload-image-blob-to-private-supabase.js +0 -27
  100. package/general/upload-image-blob-to-public-supabase.d.ts +0 -11
  101. package/general/upload-image-blob-to-public-supabase.js +0 -27
@@ -9,91 +9,158 @@ 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.deleteProduct = exports.postProduct = exports.postProducts = exports.getProductById = exports.getProducts = void 0;
14
- const getProducts = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
15
- const products = yield prisma.product.findMany({
16
- orderBy: {
17
- createdAt: 'desc',
18
- },
19
- include: {
20
- productCategory: true,
21
- quotesInvoices: true,
22
- },
41
+ var getProducts = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
42
+ var products;
43
+ var prisma = _b.prisma;
44
+ return __generator(this, function (_c) {
45
+ switch (_c.label) {
46
+ case 0: return [4 /*yield*/, prisma.product.findMany({
47
+ orderBy: {
48
+ createdAt: 'desc',
49
+ },
50
+ include: {
51
+ productCategory: true,
52
+ quotesInvoices: true,
53
+ },
54
+ })];
55
+ case 1:
56
+ products = _c.sent();
57
+ return [2 /*return*/, products];
58
+ }
23
59
  });
24
- return products;
25
- });
60
+ }); };
26
61
  exports.getProducts = getProducts;
27
- const getProductById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id, }) {
28
- const product = yield prisma.product.findUnique({
29
- where: {
30
- id,
31
- },
32
- include: {
33
- productCategory: true,
34
- quotesInvoices: true,
35
- },
62
+ var getProductById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
63
+ var product;
64
+ var prisma = _b.prisma, id = _b.id;
65
+ return __generator(this, function (_c) {
66
+ switch (_c.label) {
67
+ case 0: return [4 /*yield*/, prisma.product.findUnique({
68
+ where: {
69
+ id: id,
70
+ },
71
+ include: {
72
+ productCategory: true,
73
+ quotesInvoices: true,
74
+ },
75
+ })];
76
+ case 1:
77
+ product = _c.sent();
78
+ return [2 /*return*/, product];
79
+ }
36
80
  });
37
- return product;
38
- });
81
+ }); };
39
82
  exports.getProductById = getProductById;
40
- const postProducts = (_c) => __awaiter(void 0, [_c], void 0, function* ({ currentPage, include, orderBy, pageLimit, prisma, queryWhere, }) {
41
- const products = yield prisma.$transaction([
42
- prisma.product.count({
43
- where: queryWhere,
44
- }),
45
- prisma.product.findMany({
46
- include,
47
- orderBy,
48
- skip: (currentPage - 1) * pageLimit,
49
- take: pageLimit,
50
- where: queryWhere,
51
- }),
52
- ]);
53
- return products;
54
- });
83
+ var postProducts = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
84
+ var products;
85
+ var currentPage = _b.currentPage, include = _b.include, orderBy = _b.orderBy, pageLimit = _b.pageLimit, prisma = _b.prisma, queryWhere = _b.queryWhere;
86
+ return __generator(this, function (_c) {
87
+ switch (_c.label) {
88
+ case 0: return [4 /*yield*/, prisma.$transaction([
89
+ prisma.product.count({
90
+ where: queryWhere,
91
+ }),
92
+ prisma.product.findMany({
93
+ include: include,
94
+ orderBy: orderBy,
95
+ skip: (currentPage - 1) * pageLimit,
96
+ take: pageLimit,
97
+ where: queryWhere,
98
+ }),
99
+ ])];
100
+ case 1:
101
+ products = _c.sent();
102
+ return [2 /*return*/, products];
103
+ }
104
+ });
105
+ }); };
55
106
  exports.postProducts = postProducts;
56
- const postProduct = (_d) => __awaiter(void 0, [_d], void 0, function* ({ prisma, id, authorName, buyPrice, currency, description, image, isbn, name, productCategoryId, quantity, ref, salePrice, }) {
57
- const product = yield prisma.product.upsert({
58
- where: {
59
- id,
60
- },
61
- update: {
62
- authorName,
63
- buyPrice,
64
- currency,
65
- description,
66
- image,
67
- isbn,
68
- name,
69
- productCategoryId,
70
- quantity,
71
- ref,
72
- salePrice,
73
- },
74
- create: {
75
- authorName,
76
- buyPrice,
77
- currency,
78
- description,
79
- image,
80
- isbn,
81
- name,
82
- productCategoryId,
83
- quantity,
84
- ref,
85
- salePrice,
86
- },
107
+ var postProduct = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
108
+ var product;
109
+ var prisma = _b.prisma, id = _b.id, authorName = _b.authorName, buyPrice = _b.buyPrice, currency = _b.currency, description = _b.description, image = _b.image, isbn = _b.isbn, name = _b.name, productCategoryId = _b.productCategoryId, quantity = _b.quantity, ref = _b.ref, salePrice = _b.salePrice;
110
+ return __generator(this, function (_c) {
111
+ switch (_c.label) {
112
+ case 0: return [4 /*yield*/, prisma.product.upsert({
113
+ where: {
114
+ id: id,
115
+ },
116
+ update: {
117
+ authorName: authorName,
118
+ buyPrice: buyPrice,
119
+ currency: currency,
120
+ description: description,
121
+ image: image,
122
+ isbn: isbn,
123
+ name: name,
124
+ productCategoryId: productCategoryId,
125
+ quantity: quantity,
126
+ ref: ref,
127
+ salePrice: salePrice,
128
+ },
129
+ create: {
130
+ authorName: authorName,
131
+ buyPrice: buyPrice,
132
+ currency: currency,
133
+ description: description,
134
+ image: image,
135
+ isbn: isbn,
136
+ name: name,
137
+ productCategoryId: productCategoryId,
138
+ quantity: quantity,
139
+ ref: ref,
140
+ salePrice: salePrice,
141
+ },
142
+ })];
143
+ case 1:
144
+ product = _c.sent();
145
+ return [2 /*return*/, product];
146
+ }
87
147
  });
88
- return product;
89
- });
148
+ }); };
90
149
  exports.postProduct = postProduct;
91
- const deleteProduct = (_e) => __awaiter(void 0, [_e], void 0, function* ({ prisma, id, }) {
92
- const product = yield prisma.product.delete({
93
- where: {
94
- id,
95
- },
150
+ var deleteProduct = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
151
+ var product;
152
+ var prisma = _b.prisma, id = _b.id;
153
+ return __generator(this, function (_c) {
154
+ switch (_c.label) {
155
+ case 0: return [4 /*yield*/, prisma.product.delete({
156
+ where: {
157
+ id: id,
158
+ },
159
+ })];
160
+ case 1:
161
+ product = _c.sent();
162
+ return [2 /*return*/, product];
163
+ }
96
164
  });
97
- return product;
98
- });
165
+ }); };
99
166
  exports.deleteProduct = deleteProduct;
@@ -9,77 +9,144 @@ 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.deleteProductCategory = exports.postProductCategory = exports.postProductCategories = exports.getProductCategoryById = exports.getProductCategories = void 0;
14
- const getProductCategories = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
15
- const productCategories = yield prisma.productCategory.findMany({
16
- orderBy: {
17
- createdAt: 'desc',
18
- },
19
- include: {
20
- products: true,
21
- },
41
+ var getProductCategories = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
42
+ var productCategories;
43
+ var prisma = _b.prisma;
44
+ return __generator(this, function (_c) {
45
+ switch (_c.label) {
46
+ case 0: return [4 /*yield*/, prisma.productCategory.findMany({
47
+ orderBy: {
48
+ createdAt: 'desc',
49
+ },
50
+ include: {
51
+ products: true,
52
+ },
53
+ })];
54
+ case 1:
55
+ productCategories = _c.sent();
56
+ return [2 /*return*/, productCategories];
57
+ }
22
58
  });
23
- return productCategories;
24
- });
59
+ }); };
25
60
  exports.getProductCategories = getProductCategories;
26
- const getProductCategoryById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id, }) {
27
- const productCategory = yield prisma.productCategory.findUnique({
28
- where: {
29
- id,
30
- },
31
- include: {
32
- products: true,
33
- },
61
+ var getProductCategoryById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
62
+ var productCategory;
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.productCategory.findUnique({
67
+ where: {
68
+ id: id,
69
+ },
70
+ include: {
71
+ products: true,
72
+ },
73
+ })];
74
+ case 1:
75
+ productCategory = _c.sent();
76
+ return [2 /*return*/, productCategory];
77
+ }
34
78
  });
35
- return productCategory;
36
- });
79
+ }); };
37
80
  exports.getProductCategoryById = getProductCategoryById;
38
- const postProductCategories = (_c) => __awaiter(void 0, [_c], void 0, function* ({ currentPage, include, orderBy, pageLimit, prisma, queryWhere, }) {
39
- let productCategories;
40
- try {
41
- productCategories = yield prisma.$transaction([
42
- prisma.productCategory.count({
43
- where: queryWhere,
44
- }),
45
- prisma.productCategory.findMany({
46
- orderBy,
47
- include,
48
- where: queryWhere,
49
- take: pageLimit,
50
- skip: (currentPage - 1) * pageLimit,
51
- }),
52
- ]);
53
- }
54
- catch (err) {
55
- return err;
56
- }
57
- return productCategories;
58
- });
81
+ var postProductCategories = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
82
+ var productCategories, err_1;
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:
87
+ _c.trys.push([0, 2, , 3]);
88
+ return [4 /*yield*/, prisma.$transaction([
89
+ prisma.productCategory.count({
90
+ where: queryWhere,
91
+ }),
92
+ prisma.productCategory.findMany({
93
+ orderBy: orderBy,
94
+ include: include,
95
+ where: queryWhere,
96
+ take: pageLimit,
97
+ skip: (currentPage - 1) * pageLimit,
98
+ }),
99
+ ])];
100
+ case 1:
101
+ productCategories = _c.sent();
102
+ return [3 /*break*/, 3];
103
+ case 2:
104
+ err_1 = _c.sent();
105
+ return [2 /*return*/, err_1];
106
+ case 3: return [2 /*return*/, productCategories];
107
+ }
108
+ });
109
+ }); };
59
110
  exports.postProductCategories = postProductCategories;
60
- const postProductCategory = (_d) => __awaiter(void 0, [_d], void 0, function* ({ description, id, name, prisma, }) {
61
- const productCategory = yield prisma.productCategory.upsert({
62
- where: {
63
- id,
64
- },
65
- update: {
66
- description,
67
- name,
68
- },
69
- create: {
70
- description,
71
- name,
72
- },
111
+ var postProductCategory = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
112
+ var productCategory;
113
+ var description = _b.description, id = _b.id, name = _b.name, prisma = _b.prisma;
114
+ return __generator(this, function (_c) {
115
+ switch (_c.label) {
116
+ case 0: return [4 /*yield*/, prisma.productCategory.upsert({
117
+ where: {
118
+ id: id,
119
+ },
120
+ update: {
121
+ description: description,
122
+ name: name,
123
+ },
124
+ create: {
125
+ description: description,
126
+ name: name,
127
+ },
128
+ })];
129
+ case 1:
130
+ productCategory = _c.sent();
131
+ return [2 /*return*/, productCategory];
132
+ }
73
133
  });
74
- return productCategory;
75
- });
134
+ }); };
76
135
  exports.postProductCategory = postProductCategory;
77
- const deleteProductCategory = (_e) => __awaiter(void 0, [_e], void 0, function* ({ prisma, id, }) {
78
- const productCategory = yield prisma.productCategory.delete({
79
- where: {
80
- id,
81
- },
136
+ var deleteProductCategory = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
137
+ var productCategory;
138
+ var prisma = _b.prisma, id = _b.id;
139
+ return __generator(this, function (_c) {
140
+ switch (_c.label) {
141
+ case 0: return [4 /*yield*/, prisma.productCategory.delete({
142
+ where: {
143
+ id: id,
144
+ },
145
+ })];
146
+ case 1:
147
+ productCategory = _c.sent();
148
+ return [2 /*return*/, productCategory];
149
+ }
82
150
  });
83
- return productCategory;
84
- });
151
+ }); };
85
152
  exports.deleteProductCategory = deleteProductCategory;