@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.
- package/api/cors/index.js +6 -6
- package/api/stellar-solutions/app-user/index.js +97 -38
- package/api/stellar-solutions/banking-detail/index.js +107 -48
- package/api/stellar-solutions/branch/index.js +107 -48
- package/api/stellar-solutions/company/index.js +124 -57
- package/api/stellar-solutions/company-report/index.js +48 -13
- package/api/stellar-solutions/contact/index.js +132 -65
- package/api/stellar-solutions/currency/index.js +101 -42
- package/api/stellar-solutions/customer/index.js +149 -74
- package/api/stellar-solutions/expense/index.js +132 -65
- package/api/stellar-solutions/expense-category/index.js +133 -66
- package/api/stellar-solutions/lead/index.js +132 -65
- package/api/stellar-solutions/menu-order/index.js +97 -38
- package/api/stellar-solutions/payment/index.js +135 -77
- package/api/stellar-solutions/payment-mode/index.js +90 -31
- package/api/stellar-solutions/preference/index.js +71 -28
- package/api/stellar-solutions/product/index.js +144 -77
- package/api/stellar-solutions/product-category/index.js +130 -63
- package/api/stellar-solutions/profile/index.js +152 -77
- package/api/stellar-solutions/quote-invoice/index.js +280 -201
- package/api/stellar-solutions/quote-invoice-report/index.js +48 -13
- package/api/stellar-solutions/tax/index.js +103 -44
- package/constants/react-pakistan.js +11 -22
- package/constants/social-media-sizes.js +33 -32
- package/general/basic-get.js +68 -6
- package/general/basic-post.js +55 -6
- package/general/camel-to-sentence-case.js +3 -3
- package/general/check-even-odd-length.js +1 -1
- package/general/create-date.js +4 -4
- package/general/dynamic-page-limit.js +15 -4
- package/general/enum-to-text.js +2 -2
- package/general/fetch-supabase-image.js +53 -15
- package/general/format-date.js +13 -12
- package/general/generate-blog-schema.js +10 -9
- package/general/generate-breadcrumb-schema.js +5 -4
- package/general/generate-faq-schema.js +5 -3
- package/general/generate-grid.js +2 -2
- package/general/generate-organization-schema.js +14 -13
- package/general/get-day-name.js +1 -1
- package/general/get-full-name.js +4 -1
- package/general/get-href.js +1 -1
- package/general/get-month-name.js +1 -1
- package/general/get-pathname.js +1 -1
- package/general/index.d.ts +2 -2
- package/general/index.js +2 -2
- package/general/is-next-button-disabled.js +1 -1
- package/general/is-odd.js +1 -1
- package/general/is-previous-button-disabled.js +1 -1
- package/general/remove-data-image-prefix.js +2 -2
- package/general/repeat-times.js +3 -3
- package/general/resolve-anchor-link.js +4 -4
- package/general/resolve-current-date.js +2 -2
- package/general/resolve-grid.js +1 -1
- package/general/resolve-initials.js +2 -2
- package/general/set-timezone.js +6 -3
- package/general/slugify.js +2 -2
- package/general/text-to-enum.js +1 -1
- package/general/text-to-sentence-case.js +1 -1
- package/general/truncate-text.js +1 -1
- package/general/upload-blob-to-private-supabase.d.ts +11 -0
- package/general/upload-blob-to-private-supabase.js +62 -0
- package/general/upload-blob-to-public-supabase.d.ts +11 -0
- package/general/upload-blob-to-public-supabase.js +62 -0
- package/general/upload-image-to-private-supabase.js +51 -15
- package/general/upload-image-to-public-supabase.js +51 -15
- package/general/url-to-sentence-case.js +4 -4
- package/general/validate-comment.js +1 -1
- package/general/validate-email.js +2 -2
- package/general/validate-name.js +1 -1
- package/hooks/use-change.js +14 -5
- package/hooks/use-debounce.js +7 -6
- package/hooks/use-fetch.js +82 -31
- package/hooks/use-force-render.js +3 -3
- package/hooks/use-ip-geo-location.js +57 -22
- package/hooks/use-is-mobile.js +6 -6
- package/hooks/use-position.js +16 -16
- package/hooks/use-sticky.js +9 -8
- package/hooks/use-toggle-state.js +6 -5
- package/hooks/use-window-event-listener.js +4 -4
- package/local-storage/get-storage-value.js +2 -2
- package/local-storage/remove-storage-value.js +1 -1
- package/local-storage/set-storage-value.js +1 -1
- package/package.json +1 -1
- package/storybook/generate-sitemap.js +6 -22
- package/storybook/preview.js +13 -2
- package/storybook/react-design-story-script.js +7 -11
- package/storybook/react-emoji-collection.js +23 -33
- package/storybook/react-emoji-story-script.js +9 -13
- package/storybook/react-emoji-story-template.js +1 -46
- package/storybook/react-icon-collection.js +17 -27
- package/storybook/react-icon-story-script.js +9 -13
- package/storybook/react-icon-story-template.js +1 -46
- package/storybook/react-logo-collection.js +17 -27
- package/storybook/react-logo-story-script.js +9 -13
- package/storybook/react-logo-story-template.js +1 -46
- package/storybook/responsive-component.js +11 -46
- package/storybook/theme.js +4 -4
- package/general/upload-image-blob-to-private-supabase.d.ts +0 -11
- package/general/upload-image-blob-to-private-supabase.js +0 -27
- package/general/upload-image-blob-to-public-supabase.d.ts +0 -11
- package/general/upload-image-blob-to-public-supabase.js +0 -27
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.dynamicPageLimit = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
15
|
+
var constants_1 = require("../constants");
|
|
16
|
+
var dynamicPageLimit = function (totalRecordCount) {
|
|
17
|
+
var adjustedPageLimit = __assign({}, constants_1.PAGE_LIMIT);
|
|
7
18
|
if (totalRecordCount <= 5) {
|
|
8
19
|
adjustedPageLimit = {
|
|
9
20
|
5: 5,
|
|
@@ -40,7 +51,7 @@ const dynamicPageLimit = (totalRecordCount) => {
|
|
|
40
51
|
};
|
|
41
52
|
}
|
|
42
53
|
else if (totalRecordCount > 150) {
|
|
43
|
-
adjustedPageLimit =
|
|
54
|
+
adjustedPageLimit = __assign(__assign({}, constants_1.PAGE_LIMIT), { 150: 150 });
|
|
44
55
|
}
|
|
45
56
|
return adjustedPageLimit;
|
|
46
57
|
};
|
package/general/enum-to-text.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.enumToText = void 0;
|
|
4
|
-
|
|
4
|
+
var enumToText = function (e) { return e
|
|
5
5
|
.split('_')
|
|
6
|
-
.map((item)
|
|
6
|
+
.map(function (item) { return item.charAt(0).toUpperCase() + item.slice(1); }).join(' '); };
|
|
7
7
|
exports.enumToText = enumToText;
|
|
@@ -9,22 +9,60 @@ 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.fetchSupabasePrivateImage = void 0;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
41
|
+
var constants_1 = require("../constants");
|
|
42
|
+
var fetchSupabasePrivateImage = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
43
|
+
var response, blob, url;
|
|
44
|
+
var apikey = _b.apikey, callback = _b.callback, fetchUrl = _b.fetchUrl, token = _b.token;
|
|
45
|
+
return __generator(this, function (_c) {
|
|
46
|
+
switch (_c.label) {
|
|
47
|
+
case 0: return [4 /*yield*/, fetch(fetchUrl, {
|
|
48
|
+
method: constants_1.API_METHODS.GET,
|
|
49
|
+
headers: {
|
|
50
|
+
'Content-Type': 'application/json',
|
|
51
|
+
apikey: apikey,
|
|
52
|
+
Authorization: "Bearer ".concat(token),
|
|
53
|
+
},
|
|
54
|
+
})];
|
|
55
|
+
case 1:
|
|
56
|
+
response = _c.sent();
|
|
57
|
+
if (!response.ok) return [3 /*break*/, 3];
|
|
58
|
+
return [4 /*yield*/, response.blob()];
|
|
59
|
+
case 2:
|
|
60
|
+
blob = _c.sent();
|
|
61
|
+
url = URL.createObjectURL(blob);
|
|
62
|
+
callback(url);
|
|
63
|
+
_c.label = 3;
|
|
64
|
+
case 3: return [2 /*return*/];
|
|
65
|
+
}
|
|
23
66
|
});
|
|
24
|
-
|
|
25
|
-
const blob = yield response.blob();
|
|
26
|
-
const url = URL.createObjectURL(blob);
|
|
27
|
-
callback(url);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
67
|
+
}); };
|
|
30
68
|
exports.fetchSupabasePrivateImage = fetchSupabasePrivateImage;
|
package/general/format-date.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatDate = exports.DATE_FORMATS = void 0;
|
|
4
|
-
|
|
4
|
+
var get_month_name_1 = require("./get-month-name");
|
|
5
5
|
var DATE_FORMATS;
|
|
6
6
|
(function (DATE_FORMATS) {
|
|
7
7
|
DATE_FORMATS["LOCALE_DATE"] = "LOCALE_DATE";
|
|
8
8
|
DATE_FORMATS["DD_MM"] = "DD_MM";
|
|
9
9
|
DATE_FORMATS["YYYY_MM_DD"] = "YYYY_MM_DD";
|
|
10
10
|
})(DATE_FORMATS || (exports.DATE_FORMATS = DATE_FORMATS = {}));
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
[DATE_FORMATS.
|
|
20
|
-
[DATE_FORMATS.
|
|
21
|
-
|
|
11
|
+
var formatDate = function (str, format) {
|
|
12
|
+
var _a;
|
|
13
|
+
var dateObj = new Date(str);
|
|
14
|
+
var cleanMonthNumber = dateObj.getMonth() + 1;
|
|
15
|
+
var monthNumberInTwoDigits = String(cleanMonthNumber).length < 2 ? "0".concat(cleanMonthNumber) : cleanMonthNumber;
|
|
16
|
+
var cleanDateNumber = dateObj.getDate();
|
|
17
|
+
var dateNumberInTowDigits = String(cleanDateNumber).length < 2 ? "0".concat(cleanDateNumber) : cleanDateNumber;
|
|
18
|
+
var dateMap = (_a = {},
|
|
19
|
+
_a[DATE_FORMATS.LOCALE_DATE] = dateObj.toLocaleDateString(),
|
|
20
|
+
_a[DATE_FORMATS.DD_MM] = "".concat(dateObj.getDate(), " ").concat((0, get_month_name_1.getMonthName)(dateObj.getMonth())),
|
|
21
|
+
_a[DATE_FORMATS.YYYY_MM_DD] = "".concat(dateObj.getFullYear(), "-").concat(monthNumberInTwoDigits, "-").concat(dateNumberInTowDigits),
|
|
22
|
+
_a);
|
|
22
23
|
return dateMap[format];
|
|
23
24
|
};
|
|
24
25
|
exports.formatDate = formatDate;
|
|
@@ -2,20 +2,21 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.generateBlogSchema = void 0;
|
|
5
|
-
|
|
5
|
+
var generateBlogSchema = function (_a) {
|
|
6
|
+
var authorImage = _a.authorImage, authorName = _a.authorName, banner = _a.banner, createdAt = _a.createdAt, excerpt = _a.excerpt, title = _a.title, updatedAt = _a.updatedAt, url = _a.url;
|
|
6
7
|
return {
|
|
7
8
|
"@context": "https://schema.org",
|
|
8
9
|
"@type": "BlogPosting",
|
|
9
|
-
"headline":
|
|
10
|
-
"dateModified":
|
|
11
|
-
"datePublished":
|
|
12
|
-
"description":
|
|
13
|
-
"image":
|
|
14
|
-
"url":
|
|
10
|
+
"headline": "".concat(title),
|
|
11
|
+
"dateModified": "".concat(updatedAt),
|
|
12
|
+
"datePublished": "".concat(createdAt),
|
|
13
|
+
"description": "".concat(excerpt),
|
|
14
|
+
"image": "".concat(banner),
|
|
15
|
+
"url": "".concat(url),
|
|
15
16
|
"author": {
|
|
16
17
|
"@type": "Person",
|
|
17
|
-
"name":
|
|
18
|
-
"url":
|
|
18
|
+
"name": "".concat(authorName),
|
|
19
|
+
"url": "".concat(authorImage),
|
|
19
20
|
},
|
|
20
21
|
};
|
|
21
22
|
};
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.generateBreadcrumbSchema = void 0;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
var generateBreadcrumbSchema = function (_a) {
|
|
6
|
+
var data = _a.data, baseUrl = _a.baseUrl;
|
|
7
|
+
var items = data.map(function (text, index) {
|
|
8
|
+
var urlItem = '';
|
|
8
9
|
if (text === 'Home') {
|
|
9
10
|
urlItem = baseUrl;
|
|
10
11
|
}
|
|
11
12
|
else {
|
|
12
|
-
urlItem =
|
|
13
|
+
urlItem = "".concat(baseUrl, "/").concat(text.toLowerCase());
|
|
13
14
|
}
|
|
14
15
|
return ({
|
|
15
16
|
"@type": "ListItem",
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.generateFAQSchema = void 0;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
var generateFAQSchema = function (_a) {
|
|
6
|
+
var data = _a.data;
|
|
7
|
+
var items = data.map(function (_a) {
|
|
8
|
+
var answer = _a.answer, question = _a.question;
|
|
7
9
|
return ({
|
|
8
10
|
"@type": "Question",
|
|
9
11
|
"name": question,
|
|
10
12
|
"acceptedAnswer": {
|
|
11
13
|
"@type": "Answer",
|
|
12
|
-
"text":
|
|
14
|
+
"text": "<p>".concat(answer, "</p>")
|
|
13
15
|
},
|
|
14
16
|
});
|
|
15
17
|
});
|
package/general/generate-grid.js
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.generateGrid = void 0;
|
|
14
14
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
var generateGrid = function (array) {
|
|
16
|
+
var gridMap = {
|
|
17
17
|
1: {
|
|
18
18
|
col: '1fr',
|
|
19
19
|
row: '1fr',
|
|
@@ -2,25 +2,26 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.generateOrganizationSchema = void 0;
|
|
5
|
-
|
|
5
|
+
var generateOrganizationSchema = function (_a) {
|
|
6
|
+
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;
|
|
6
7
|
return {
|
|
7
8
|
"@context": "https://schema.org",
|
|
8
9
|
"@type": "Organization",
|
|
9
|
-
"image":
|
|
10
|
-
"url":
|
|
10
|
+
"image": "".concat(image),
|
|
11
|
+
"url": "".concat(baseUrl),
|
|
11
12
|
"sameAs": sameAsArr,
|
|
12
|
-
"logo":
|
|
13
|
-
"name":
|
|
14
|
-
"description":
|
|
15
|
-
"email":
|
|
16
|
-
"telephone":
|
|
13
|
+
"logo": "".concat(logo),
|
|
14
|
+
"name": "".concat(appName),
|
|
15
|
+
"description": "".concat(description),
|
|
16
|
+
"email": "".concat(email),
|
|
17
|
+
"telephone": "".concat(telephone),
|
|
17
18
|
"address": {
|
|
18
19
|
"@type": "PostalAddress",
|
|
19
|
-
"streetAddress":
|
|
20
|
-
"addressLocality":
|
|
21
|
-
"addressCountry":
|
|
22
|
-
"addressRegion":
|
|
23
|
-
"postalCode":
|
|
20
|
+
"streetAddress": "".concat(streetAddress),
|
|
21
|
+
"addressLocality": "".concat(addressLocality),
|
|
22
|
+
"addressCountry": "".concat(addressCountry),
|
|
23
|
+
"addressRegion": "".concat(addressRegion),
|
|
24
|
+
"postalCode": "".concat(postalCode),
|
|
24
25
|
},
|
|
25
26
|
};
|
|
26
27
|
};
|
package/general/get-day-name.js
CHANGED
package/general/get-full-name.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFullName = void 0;
|
|
4
|
-
|
|
4
|
+
var getFullName = function (_a) {
|
|
5
|
+
var firstName = _a.firstName, lastName = _a.lastName;
|
|
6
|
+
return "".concat(firstName, " ").concat(lastName);
|
|
7
|
+
};
|
|
5
8
|
exports.getFullName = getFullName;
|
package/general/get-href.js
CHANGED
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
/** End file docs */
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.getHref = void 0;
|
|
12
|
-
|
|
12
|
+
var getHref = function () { return window && window.location.href; };
|
|
13
13
|
exports.getHref = getHref;
|
package/general/get-pathname.js
CHANGED
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
/** End file docs */
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.getPathname = void 0;
|
|
12
|
-
|
|
12
|
+
var getPathname = function () { return (window && window.location.pathname.substring(0, window.location.pathname.length - 1)); };
|
|
13
13
|
exports.getPathname = getPathname;
|
package/general/index.d.ts
CHANGED
|
@@ -31,8 +31,8 @@ export * from './resolve-initials';
|
|
|
31
31
|
export * from './slugify';
|
|
32
32
|
export * from './text-to-enum';
|
|
33
33
|
export * from './truncate-text';
|
|
34
|
-
export * from './upload-
|
|
35
|
-
export * from './upload-
|
|
34
|
+
export * from './upload-blob-to-private-supabase';
|
|
35
|
+
export * from './upload-blob-to-public-supabase';
|
|
36
36
|
export * from './upload-image-to-private-supabase';
|
|
37
37
|
export * from './upload-image-to-public-supabase';
|
|
38
38
|
export * from './url-to-sentence-case';
|
package/general/index.js
CHANGED
|
@@ -48,8 +48,8 @@ __exportStar(require("./resolve-initials"), exports);
|
|
|
48
48
|
__exportStar(require("./slugify"), exports);
|
|
49
49
|
__exportStar(require("./text-to-enum"), exports);
|
|
50
50
|
__exportStar(require("./truncate-text"), exports);
|
|
51
|
-
__exportStar(require("./upload-
|
|
52
|
-
__exportStar(require("./upload-
|
|
51
|
+
__exportStar(require("./upload-blob-to-private-supabase"), exports);
|
|
52
|
+
__exportStar(require("./upload-blob-to-public-supabase"), exports);
|
|
53
53
|
__exportStar(require("./upload-image-to-private-supabase"), exports);
|
|
54
54
|
__exportStar(require("./upload-image-to-public-supabase"), exports);
|
|
55
55
|
__exportStar(require("./url-to-sentence-case"), exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isNextButtonDisabled = void 0;
|
|
4
|
-
|
|
4
|
+
var isNextButtonDisabled = function (currentPage, totalPages) { return currentPage >= totalPages; };
|
|
5
5
|
exports.isNextButtonDisabled = isNextButtonDisabled;
|
package/general/is-odd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isPreviousButtonDisabled = void 0;
|
|
4
|
-
|
|
4
|
+
var isPreviousButtonDisabled = function (currentPage) { return currentPage <= 1; };
|
|
5
5
|
exports.isPreviousButtonDisabled = isPreviousButtonDisabled;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.removeDataImagePrefix = void 0;
|
|
4
|
-
|
|
5
|
-
.replace(/data:image\/jpeg;base64,/i, '');
|
|
4
|
+
var removeDataImagePrefix = function (base64) { return base64
|
|
5
|
+
.replace(/data:image\/jpeg;base64,/i, ''); };
|
|
6
6
|
exports.removeDataImagePrefix = removeDataImagePrefix;
|
package/general/repeat-times.js
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.repeatTimes = void 0;
|
|
16
16
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
var check_even_odd_length_1 = require("./check-even-odd-length");
|
|
18
|
+
var repeatTimes = function (str, arr) {
|
|
19
|
+
var stringToRepeat = str.repeat(arr.length / (0, check_even_odd_length_1.checkEvenOddLength)(arr));
|
|
20
20
|
return stringToRepeat;
|
|
21
21
|
};
|
|
22
22
|
exports.repeatTimes = repeatTimes;
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
/** End file docs */
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.resolveAnchorLink = void 0;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
phone:
|
|
17
|
-
email:
|
|
14
|
+
var resolveAnchorLink = function (string) {
|
|
15
|
+
var anchorMap = {
|
|
16
|
+
phone: "tel:".concat(string),
|
|
17
|
+
email: "mailto:".concat(string),
|
|
18
18
|
url: string,
|
|
19
19
|
};
|
|
20
20
|
if (string.match(/^[+]/))
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
/** End file docs */
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.resolveCurrentDate = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
var resolveCurrentDate = function () {
|
|
14
|
+
var currentDate = new Date();
|
|
15
15
|
return currentDate
|
|
16
16
|
.toLocaleString('en-GB', {
|
|
17
17
|
weekday: 'long',
|
package/general/resolve-grid.js
CHANGED
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.resolveGrid = void 0;
|
|
15
15
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
16
|
-
|
|
16
|
+
var resolveGrid = function (array, gridSize) { return "repeat(".concat(array.length, ", ").concat(gridSize, ")"); };
|
|
17
17
|
exports.resolveGrid = resolveGrid;
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
/** End file docs */
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.resolveInitials = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
var resolveInitials = function (str) {
|
|
14
|
+
var arr = str.split(' ');
|
|
15
15
|
return arr[0][0].toUpperCase() + arr[1][0].toUpperCase();
|
|
16
16
|
};
|
|
17
17
|
exports.resolveInitials = resolveInitials;
|
package/general/set-timezone.js
CHANGED
|
@@ -4,6 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.setTimezone = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.setTimezone = (0, lodash_curry_1.default)((date, timezone
|
|
7
|
+
var date_fns_tz_1 = require("date-fns-tz");
|
|
8
|
+
var lodash_curry_1 = __importDefault(require("lodash.curry"));
|
|
9
|
+
exports.setTimezone = (0, lodash_curry_1.default)(function (date, timezone) {
|
|
10
|
+
if (timezone === void 0) { timezone = 'Asia/Karachi'; }
|
|
11
|
+
return (0, date_fns_tz_1.utcToZonedTime)(date, timezone);
|
|
12
|
+
});
|
package/general/slugify.js
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
/** End file docs */
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.slugify = void 0;
|
|
13
|
-
|
|
13
|
+
var slugify = function (str) { return str
|
|
14
14
|
.replaceAll(/[’|&;$%@"<>/()+,:?]/gm, '')
|
|
15
15
|
.toLowerCase()
|
|
16
16
|
.split(' ')
|
|
17
|
-
.join('-');
|
|
17
|
+
.join('-'); };
|
|
18
18
|
exports.slugify = slugify;
|
package/general/text-to-enum.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.textToEnum = void 0;
|
|
4
|
-
|
|
4
|
+
var textToEnum = function (text) { return text.split(' ').map(function (item) { return item.toUpperCase(); }).join('_'); };
|
|
5
5
|
exports.textToEnum = textToEnum;
|
|
@@ -10,5 +10,5 @@
|
|
|
10
10
|
/** End file docs */
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.textToSentenceCase = void 0;
|
|
13
|
-
|
|
13
|
+
var textToSentenceCase = function (text) { return text.charAt(0).toUpperCase() + text.slice(1); };
|
|
14
14
|
exports.textToSentenceCase = textToSentenceCase;
|
package/general/truncate-text.js
CHANGED
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
/** End file docs */
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.truncateText = void 0;
|
|
15
|
-
|
|
15
|
+
var truncateText = function (string, length) { return "".concat(string.substring(0, length), "..."); };
|
|
16
16
|
exports.truncateText = truncateText;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface UploadBlobToPrivateSupabaseArgs {
|
|
2
|
+
blob: Blob;
|
|
3
|
+
contentType: string;
|
|
4
|
+
fileRef: string;
|
|
5
|
+
supabase: any;
|
|
6
|
+
upsert: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const uploadBlobToPrivateSupabase: ({ blob, contentType, fileRef, supabase, upsert, }: UploadBlobToPrivateSupabaseArgs) => Promise<{
|
|
9
|
+
data: any;
|
|
10
|
+
error: any;
|
|
11
|
+
}>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
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
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.uploadBlobToPrivateSupabase = void 0;
|
|
41
|
+
var uploadBlobToPrivateSupabase = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
42
|
+
var _c, data, error;
|
|
43
|
+
var blob = _b.blob, contentType = _b.contentType, fileRef = _b.fileRef, supabase = _b.supabase, upsert = _b.upsert;
|
|
44
|
+
return __generator(this, function (_d) {
|
|
45
|
+
switch (_d.label) {
|
|
46
|
+
case 0: return [4 /*yield*/, supabase.storage
|
|
47
|
+
.from(process.env.NEXT_PUBLIC_SUPABASE_PRIVATE_BUCKET)
|
|
48
|
+
.upload(fileRef, blob, {
|
|
49
|
+
cacheControl: process.env.NEXT_PUBLIC_SUPABASE_CACHE_CONTROL,
|
|
50
|
+
contentType: contentType,
|
|
51
|
+
upsert: upsert,
|
|
52
|
+
})];
|
|
53
|
+
case 1:
|
|
54
|
+
_c = _d.sent(), data = _c.data, error = _c.error;
|
|
55
|
+
return [2 /*return*/, {
|
|
56
|
+
data: data,
|
|
57
|
+
error: error,
|
|
58
|
+
}];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}); };
|
|
62
|
+
exports.uploadBlobToPrivateSupabase = uploadBlobToPrivateSupabase;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface UploadBlobToPublicSupabaseArgs {
|
|
2
|
+
blob: Blob;
|
|
3
|
+
contentType: string;
|
|
4
|
+
fileRef: string;
|
|
5
|
+
supabase: any;
|
|
6
|
+
upsert: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const uploadBlobToPublicSupabase: ({ blob, contentType, fileRef, supabase, upsert, }: UploadBlobToPublicSupabaseArgs) => Promise<{
|
|
9
|
+
data: any;
|
|
10
|
+
error: any;
|
|
11
|
+
}>;
|