@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,93 +9,168 @@ 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.deleteProfile = exports.postProfile = exports.postProfiles = exports.getProfileByUserId = exports.getProfileById = exports.getProfiles = void 0;
14
- const getProfiles = (_a) => __awaiter(void 0, [_a], void 0, function* ({ prisma, }) {
15
- const profiles = yield prisma.profile.findMany({
16
- orderBy: {
17
- createdAt: 'desc',
18
- },
41
+ var getProfiles = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
42
+ var profiles;
43
+ var prisma = _b.prisma;
44
+ return __generator(this, function (_c) {
45
+ switch (_c.label) {
46
+ case 0: return [4 /*yield*/, prisma.profile.findMany({
47
+ orderBy: {
48
+ createdAt: 'desc',
49
+ },
50
+ })];
51
+ case 1:
52
+ profiles = _c.sent();
53
+ return [2 /*return*/, profiles];
54
+ }
19
55
  });
20
- return profiles;
21
- });
56
+ }); };
22
57
  exports.getProfiles = getProfiles;
23
- const getProfileById = (_b) => __awaiter(void 0, [_b], void 0, function* ({ prisma, id, }) {
24
- const profile = yield prisma.profile.findUnique({
25
- where: {
26
- id,
27
- },
58
+ var getProfileById = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
59
+ var profile;
60
+ var prisma = _b.prisma, id = _b.id;
61
+ return __generator(this, function (_c) {
62
+ switch (_c.label) {
63
+ case 0: return [4 /*yield*/, prisma.profile.findUnique({
64
+ where: {
65
+ id: id,
66
+ },
67
+ })];
68
+ case 1:
69
+ profile = _c.sent();
70
+ return [2 /*return*/, profile];
71
+ }
28
72
  });
29
- return profile;
30
- });
73
+ }); };
31
74
  exports.getProfileById = getProfileById;
32
- const getProfileByUserId = (_c) => __awaiter(void 0, [_c], void 0, function* ({ prisma, userId, }) {
33
- const profile = yield prisma.profile.findFirst({
34
- where: {
35
- userId,
36
- },
75
+ var getProfileByUserId = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
76
+ var profile;
77
+ var prisma = _b.prisma, userId = _b.userId;
78
+ return __generator(this, function (_c) {
79
+ switch (_c.label) {
80
+ case 0: return [4 /*yield*/, prisma.profile.findFirst({
81
+ where: {
82
+ userId: userId,
83
+ },
84
+ })];
85
+ case 1:
86
+ profile = _c.sent();
87
+ return [2 /*return*/, profile];
88
+ }
37
89
  });
38
- return profile;
39
- });
90
+ }); };
40
91
  exports.getProfileByUserId = getProfileByUserId;
41
- const postProfiles = (_d) => __awaiter(void 0, [_d], void 0, function* ({ currentPage, pageLimit, prisma, queryWhere, }) {
42
- const profiles = yield prisma.$transaction([
43
- prisma.profile.count({
44
- where: queryWhere,
45
- }),
46
- prisma.profile.findMany({
47
- orderBy: {
48
- createdAt: 'desc',
49
- },
50
- where: queryWhere,
51
- take: pageLimit,
52
- skip: (currentPage - 1) * pageLimit,
53
- }),
54
- ]);
55
- return profiles;
56
- });
92
+ var postProfiles = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
93
+ var profiles;
94
+ var currentPage = _b.currentPage, pageLimit = _b.pageLimit, prisma = _b.prisma, queryWhere = _b.queryWhere;
95
+ return __generator(this, function (_c) {
96
+ switch (_c.label) {
97
+ case 0: return [4 /*yield*/, prisma.$transaction([
98
+ prisma.profile.count({
99
+ where: queryWhere,
100
+ }),
101
+ prisma.profile.findMany({
102
+ orderBy: {
103
+ createdAt: 'desc',
104
+ },
105
+ where: queryWhere,
106
+ take: pageLimit,
107
+ skip: (currentPage - 1) * pageLimit,
108
+ }),
109
+ ])];
110
+ case 1:
111
+ profiles = _c.sent();
112
+ return [2 /*return*/, profiles];
113
+ }
114
+ });
115
+ }); };
57
116
  exports.postProfiles = postProfiles;
58
- const postProfile = (_e) => __awaiter(void 0, [_e], void 0, function* ({ avatar, dob, email, firstName, gender, id, language, lastName, location, phone, prisma, skill, userId, }) {
59
- const profile = yield prisma.profile.upsert({
60
- where: {
61
- id,
62
- },
63
- update: {
64
- avatar,
65
- dob,
66
- email,
67
- firstName,
68
- gender,
69
- language,
70
- lastName,
71
- location,
72
- phone,
73
- skill,
74
- userId,
75
- },
76
- create: {
77
- avatar,
78
- dob,
79
- email,
80
- firstName,
81
- gender,
82
- language,
83
- lastName,
84
- location,
85
- phone,
86
- skill,
87
- userId,
88
- },
117
+ var postProfile = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
118
+ var profile;
119
+ var avatar = _b.avatar, dob = _b.dob, email = _b.email, firstName = _b.firstName, gender = _b.gender, id = _b.id, language = _b.language, lastName = _b.lastName, location = _b.location, phone = _b.phone, prisma = _b.prisma, skill = _b.skill, userId = _b.userId;
120
+ return __generator(this, function (_c) {
121
+ switch (_c.label) {
122
+ case 0: return [4 /*yield*/, prisma.profile.upsert({
123
+ where: {
124
+ id: id,
125
+ },
126
+ update: {
127
+ avatar: avatar,
128
+ dob: dob,
129
+ email: email,
130
+ firstName: firstName,
131
+ gender: gender,
132
+ language: language,
133
+ lastName: lastName,
134
+ location: location,
135
+ phone: phone,
136
+ skill: skill,
137
+ userId: userId,
138
+ },
139
+ create: {
140
+ avatar: avatar,
141
+ dob: dob,
142
+ email: email,
143
+ firstName: firstName,
144
+ gender: gender,
145
+ language: language,
146
+ lastName: lastName,
147
+ location: location,
148
+ phone: phone,
149
+ skill: skill,
150
+ userId: userId,
151
+ },
152
+ })];
153
+ case 1:
154
+ profile = _c.sent();
155
+ return [2 /*return*/, profile];
156
+ }
89
157
  });
90
- return profile;
91
- });
158
+ }); };
92
159
  exports.postProfile = postProfile;
93
- const deleteProfile = (_f) => __awaiter(void 0, [_f], void 0, function* ({ prisma, id, }) {
94
- const profile = yield prisma.profile.delete({
95
- where: {
96
- id,
97
- },
160
+ var deleteProfile = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
161
+ var profile;
162
+ var prisma = _b.prisma, id = _b.id;
163
+ return __generator(this, function (_c) {
164
+ switch (_c.label) {
165
+ case 0: return [4 /*yield*/, prisma.profile.delete({
166
+ where: {
167
+ id: id,
168
+ },
169
+ })];
170
+ case 1:
171
+ profile = _c.sent();
172
+ return [2 /*return*/, profile];
173
+ }
98
174
  });
99
- return profile;
100
- });
175
+ }); };
101
176
  exports.deleteProfile = deleteProfile;