tek-wallet 0.0.1
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/dist/app/api/auth/[...nextauth]/functions/refreshTokenKeycloak.d.ts +6 -0
- package/dist/app/api/auth/[...nextauth]/functions/refreshTokenKeycloak.js +84 -0
- package/dist/app/api/auth/[...nextauth]/route.d.ts +2 -0
- package/dist/app/api/auth/[...nextauth]/route.js +148 -0
- package/dist/app/api/auth/[...nextauth]/type.d.ts +4 -0
- package/dist/app/api/auth/[...nextauth]/type.js +8 -0
- package/dist/components/layouts/ChildPageLayout/index.d.ts +15 -0
- package/dist/components/layouts/ChildPageLayout/index.js +37 -0
- package/dist/components/layouts/DefaultPageLayout/index.d.ts +5 -0
- package/dist/components/layouts/DefaultPageLayout/index.js +12 -0
- package/dist/components/layouts/MainLayout/index.d.ts +5 -0
- package/dist/components/layouts/MainLayout/index.js +13 -0
- package/dist/components/ui/BackArrow/index.d.ts +5 -0
- package/dist/components/ui/BackArrow/index.js +36 -0
- package/dist/components/ui/BackHeader/index.d.ts +8 -0
- package/dist/components/ui/BackHeader/index.js +24 -0
- package/dist/components/ui/Button/index.d.ts +15 -0
- package/dist/components/ui/Button/index.js +60 -0
- package/dist/components/ui/DrawerComponent/index.d.ts +19 -0
- package/dist/components/ui/DrawerComponent/index.js +48 -0
- package/dist/components/ui/Icon/index.d.ts +7 -0
- package/dist/components/ui/Icon/index.js +36 -0
- package/dist/components/ui/Image/index.d.ts +8 -0
- package/dist/components/ui/Image/index.js +13 -0
- package/dist/components/ui/OTP/index.d.ts +11 -0
- package/dist/components/ui/OTP/index.js +54 -0
- package/dist/components/ui/PageHeader/index.d.ts +7 -0
- package/dist/components/ui/PageHeader/index.js +14 -0
- package/dist/components/ui/RequireConnect/index.d.ts +6 -0
- package/dist/components/ui/RequireConnect/index.js +66 -0
- package/dist/components/ui/StatusDisplay/index.d.ts +14 -0
- package/dist/components/ui/StatusDisplay/index.js +30 -0
- package/dist/components/ui/SwiperControlled/index.d.ts +18 -0
- package/dist/components/ui/SwiperControlled/index.js +64 -0
- package/dist/components/ui/Text/index.d.ts +8 -0
- package/dist/components/ui/Text/index.js +37 -0
- package/dist/components/ui/TheBackground/index.d.ts +6 -0
- package/dist/components/ui/TheBackground/index.js +14 -0
- package/dist/components/views/AuthView/index.d.ts +5 -0
- package/dist/components/views/AuthView/index.js +65 -0
- package/dist/components/views/CreateWalletView/index.d.ts +10 -0
- package/dist/components/views/CreateWalletView/index.js +188 -0
- package/dist/components/views/ImportWalletView/index.d.ts +10 -0
- package/dist/components/views/ImportWalletView/index.js +102 -0
- package/dist/configs/app/index.d.ts +3 -0
- package/dist/configs/app/index.js +11 -0
- package/dist/configs/app/type.d.ts +5 -0
- package/dist/configs/app/type.js +7 -0
- package/dist/hooks/useCustomRouter.d.ts +3 -0
- package/dist/hooks/useCustomRouter.js +23 -0
- package/dist/hooks/useFormatter.d.ts +4 -0
- package/dist/hooks/useFormatter.js +28 -0
- package/dist/hooks/useTekWallet.d.ts +7 -0
- package/dist/hooks/useTekWallet.js +25 -0
- package/dist/hooks/useVibrateEffect.d.ts +5 -0
- package/dist/hooks/useVibrateEffect.js +12 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +14 -0
- package/dist/providers/AuthProvider/index.d.ts +5 -0
- package/dist/providers/AuthProvider/index.js +45 -0
- package/dist/providers/AuthProvider/type.d.ts +4 -0
- package/dist/providers/AuthProvider/type.js +8 -0
- package/dist/providers/TekWalletProvider/index.d.ts +8 -0
- package/dist/providers/TekWalletProvider/index.js +15 -0
- package/dist/services/axios/clients/generalRequest.d.ts +2 -0
- package/dist/services/axios/clients/generalRequest.js +11 -0
- package/dist/services/axios/clients/userClientRequest.d.ts +3 -0
- package/dist/services/axios/clients/userClientRequest.js +25 -0
- package/dist/services/axios/create-wallet-service/createWalletService.d.ts +7 -0
- package/dist/services/axios/create-wallet-service/createWalletService.js +54 -0
- package/dist/services/axios/create-wallet-service/type.d.ts +43 -0
- package/dist/services/axios/create-wallet-service/type.js +2 -0
- package/dist/services/axios/get-balance-service/getBalanceService.d.ts +3 -0
- package/dist/services/axios/get-balance-service/getBalanceService.js +61 -0
- package/dist/services/axios/get-balance-service/type.d.ts +37 -0
- package/dist/services/axios/get-balance-service/type.js +2 -0
- package/dist/services/axios/import-wallet-service/importWalletService.d.ts +7 -0
- package/dist/services/axios/import-wallet-service/importWalletService.js +54 -0
- package/dist/services/axios/import-wallet-service/type.d.ts +28 -0
- package/dist/services/axios/import-wallet-service/type.js +2 -0
- package/dist/store/Provider.d.ts +4 -0
- package/dist/store/Provider.js +11 -0
- package/dist/store/auth/authSlice.d.ts +4 -0
- package/dist/store/auth/authSlice.js +26 -0
- package/dist/store/auth/authThunk.d.ts +10 -0
- package/dist/store/auth/authThunk.js +62 -0
- package/dist/store/auth/type.d.ts +4 -0
- package/dist/store/auth/type.js +2 -0
- package/dist/store/hooks.d.ts +7 -0
- package/dist/store/hooks.js +7 -0
- package/dist/store/store.d.ts +11 -0
- package/dist/store/store.js +16 -0
- package/dist/store/tokens/tokenThunk.d.ts +10 -0
- package/dist/store/tokens/tokenThunk.js +55 -0
- package/dist/store/tokens/tokensSlice.d.ts +4 -0
- package/dist/store/tokens/tokensSlice.js +26 -0
- package/dist/store/tokens/type.d.ts +8 -0
- package/dist/store/tokens/type.js +2 -0
- package/dist/theme/mui/index.d.ts +4 -0
- package/dist/theme/mui/index.js +14 -0
- package/dist/theme/mui/theme.d.ts +2 -0
- package/dist/theme/mui/theme.js +14 -0
- package/dist/types/ui.d.ts +6 -0
- package/dist/types/ui.js +2 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +15 -0
- package/dist/utils/formatDate.d.ts +18 -0
- package/dist/utils/formatDate.js +121 -0
- package/dist/utils/formatter.d.ts +4 -0
- package/dist/utils/formatter.js +66 -0
- package/dist/utils/getIcon.d.ts +1 -0
- package/dist/utils/getIcon.js +6 -0
- package/dist/utils/getImage.d.ts +1 -0
- package/dist/utils/getImage.js +7 -0
- package/dist/utils/getMaxTime.d.ts +5 -0
- package/dist/utils/getMaxTime.js +16 -0
- package/dist/utils/getStandardNumber.d.ts +1 -0
- package/dist/utils/getStandardNumber.js +20 -0
- package/dist/utils/lengthFromDotToFirstNonZero.d.ts +1 -0
- package/dist/utils/lengthFromDotToFirstNonZero.js +18 -0
- package/dist/utils/reduceZeroNoNecessary.d.ts +1 -0
- package/dist/utils/reduceZeroNoNecessary.js +18 -0
- package/dist/utils/roundToTwoSignificantDecimals.d.ts +1 -0
- package/dist/utils/roundToTwoSignificantDecimals.js +26 -0
- package/package.json +62 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var styles_1 = require("@mui/material/styles");
|
|
4
|
+
var theme = (0, styles_1.createTheme)({
|
|
5
|
+
palette: {
|
|
6
|
+
primary: {
|
|
7
|
+
main: "#ffffff",
|
|
8
|
+
},
|
|
9
|
+
secondary: {
|
|
10
|
+
main: "#01FF00",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
exports.default = theme;
|
package/dist/types/ui.js
ADDED
package/dist/utils/cn.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var clsx_1 = __importDefault(require("clsx"));
|
|
7
|
+
// import { twMerge } from "tailwind-merge";
|
|
8
|
+
var cn = function () {
|
|
9
|
+
var inputs = [];
|
|
10
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
11
|
+
inputs[_i] = arguments[_i];
|
|
12
|
+
}
|
|
13
|
+
return (0, clsx_1.default)(inputs);
|
|
14
|
+
};
|
|
15
|
+
exports.default = cn;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Locale } from "date-fns/locale";
|
|
2
|
+
export declare enum Format {
|
|
3
|
+
DATE_BEFORE_MONTH = "dd MMM, yyyy",
|
|
4
|
+
DATE_AFTER_MONTH = "MMM dd, yyyy",
|
|
5
|
+
DATE_AFTER_MONTH_WITH_TIME = "MMM dd, yyyy '-' HH:mm:ss",
|
|
6
|
+
DATE_BEFORE_MONTH_WITH_TIME = "dd MMM, yyyy '-' HH:mm:ss"
|
|
7
|
+
}
|
|
8
|
+
export interface DateFormatType {
|
|
9
|
+
locale: Locale;
|
|
10
|
+
format: Format;
|
|
11
|
+
}
|
|
12
|
+
export type BCP47LanguageTag = "af-ZA" | "ar-SA" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "bs-BA" | "ca-ES" | "cs-CZ" | "cy-GB" | "da-DK" | "de-AT" | "de-CH" | "de-DE" | "el-GR" | "en-AU" | "en-CA" | "en-GB" | "en-IE" | "en-IN" | "en-NZ" | "en-US" | "en-ZA" | "es-AR" | "es-CL" | "es-CO" | "es-ES" | "es-MX" | "es-PE" | "et-EE" | "fa-IR" | "fi-FI" | "fr-BE" | "fr-CA" | "fr-CH" | "fr-FR" | "gl-ES" | "gu-IN" | "he-IL" | "hi-IN" | "hr-HR" | "hu-HU" | "id-ID" | "is-IS" | "it-CH" | "it-IT" | "ja-JP" | "km-KH" | "kn-IN" | "ko-KR" | "lt-LT" | "lv-LV" | "mr-IN" | "ms-MY" | "nb-NO" | "ne-NP" | "nl-BE" | "nl-NL" | "pa-IN" | "pl-PL" | "pt-BR" | "pt-PT" | "ro-RO" | "ru-RU" | "sk-SK" | "sl-SI" | "sq-AL" | "sr-RS" | "sv-FI" | "sv-SE" | "ta-IN" | "te-IN" | "th-TH" | "tr-TR" | "uk-UA" | "vi-VN" | "zh-CN" | "zh-HK" | "zh-TW";
|
|
13
|
+
export declare function getLocaleInLocal(): {
|
|
14
|
+
bcp47locale: BCP47LanguageTag;
|
|
15
|
+
localeInDateFns: Locale;
|
|
16
|
+
formatInDateFns: Format;
|
|
17
|
+
};
|
|
18
|
+
export default function formatDate(date: string | number): string;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Format = void 0;
|
|
4
|
+
exports.getLocaleInLocal = getLocaleInLocal;
|
|
5
|
+
exports.default = formatDate;
|
|
6
|
+
var date_fns_1 = require("date-fns");
|
|
7
|
+
var locale_1 = require("date-fns/locale");
|
|
8
|
+
var Format;
|
|
9
|
+
(function (Format) {
|
|
10
|
+
Format["DATE_BEFORE_MONTH"] = "dd MMM, yyyy";
|
|
11
|
+
Format["DATE_AFTER_MONTH"] = "MMM dd, yyyy";
|
|
12
|
+
Format["DATE_AFTER_MONTH_WITH_TIME"] = "MMM dd, yyyy '-' HH:mm:ss";
|
|
13
|
+
Format["DATE_BEFORE_MONTH_WITH_TIME"] = "dd MMM, yyyy '-' HH:mm:ss";
|
|
14
|
+
})(Format || (exports.Format = Format = {}));
|
|
15
|
+
var supportedLocales = {
|
|
16
|
+
"af-ZA": { locale: locale_1.af, format: Format.DATE_AFTER_MONTH },
|
|
17
|
+
"ar-SA": { locale: locale_1.arSA, format: Format.DATE_AFTER_MONTH },
|
|
18
|
+
"az-AZ": { locale: locale_1.az, format: Format.DATE_AFTER_MONTH },
|
|
19
|
+
"be-BY": { locale: locale_1.be, format: Format.DATE_AFTER_MONTH },
|
|
20
|
+
"bg-BG": { locale: locale_1.bg, format: Format.DATE_AFTER_MONTH },
|
|
21
|
+
"bn-IN": { locale: locale_1.bn, format: Format.DATE_AFTER_MONTH },
|
|
22
|
+
"bs-BA": { locale: locale_1.bs, format: Format.DATE_AFTER_MONTH },
|
|
23
|
+
"ca-ES": { locale: locale_1.ca, format: Format.DATE_AFTER_MONTH },
|
|
24
|
+
"cs-CZ": { locale: locale_1.cs, format: Format.DATE_AFTER_MONTH },
|
|
25
|
+
"cy-GB": { locale: locale_1.cy, format: Format.DATE_AFTER_MONTH },
|
|
26
|
+
"da-DK": { locale: locale_1.da, format: Format.DATE_AFTER_MONTH },
|
|
27
|
+
"de-AT": { locale: locale_1.deAT, format: Format.DATE_AFTER_MONTH },
|
|
28
|
+
"de-CH": { locale: locale_1.de, format: Format.DATE_AFTER_MONTH },
|
|
29
|
+
"de-DE": { locale: locale_1.de, format: Format.DATE_AFTER_MONTH },
|
|
30
|
+
"el-GR": { locale: locale_1.el, format: Format.DATE_AFTER_MONTH },
|
|
31
|
+
"en-AU": { locale: locale_1.enAU, format: Format.DATE_AFTER_MONTH },
|
|
32
|
+
"en-CA": { locale: locale_1.enCA, format: Format.DATE_AFTER_MONTH },
|
|
33
|
+
"en-GB": { locale: locale_1.enGB, format: Format.DATE_AFTER_MONTH },
|
|
34
|
+
"en-IE": { locale: locale_1.enIE, format: Format.DATE_AFTER_MONTH },
|
|
35
|
+
"en-IN": { locale: locale_1.enIN, format: Format.DATE_AFTER_MONTH },
|
|
36
|
+
"en-NZ": { locale: locale_1.enNZ, format: Format.DATE_AFTER_MONTH },
|
|
37
|
+
"en-US": { locale: locale_1.enUS, format: Format.DATE_AFTER_MONTH },
|
|
38
|
+
"en-ZA": { locale: locale_1.enZA, format: Format.DATE_AFTER_MONTH },
|
|
39
|
+
"es-AR": { locale: locale_1.es, format: Format.DATE_AFTER_MONTH },
|
|
40
|
+
"es-CL": { locale: locale_1.es, format: Format.DATE_AFTER_MONTH },
|
|
41
|
+
"es-CO": { locale: locale_1.es, format: Format.DATE_AFTER_MONTH },
|
|
42
|
+
"es-ES": { locale: locale_1.es, format: Format.DATE_AFTER_MONTH },
|
|
43
|
+
"es-MX": { locale: locale_1.es, format: Format.DATE_AFTER_MONTH },
|
|
44
|
+
"es-PE": { locale: locale_1.es, format: Format.DATE_AFTER_MONTH },
|
|
45
|
+
"et-EE": { locale: locale_1.et, format: Format.DATE_AFTER_MONTH },
|
|
46
|
+
"fa-IR": { locale: locale_1.faIR, format: Format.DATE_AFTER_MONTH },
|
|
47
|
+
"fi-FI": { locale: locale_1.fi, format: Format.DATE_AFTER_MONTH },
|
|
48
|
+
"fr-BE": { locale: locale_1.fr, format: Format.DATE_AFTER_MONTH },
|
|
49
|
+
"fr-CA": { locale: locale_1.frCA, format: Format.DATE_AFTER_MONTH },
|
|
50
|
+
"fr-CH": { locale: locale_1.frCH, format: Format.DATE_AFTER_MONTH },
|
|
51
|
+
"fr-FR": { locale: locale_1.fr, format: Format.DATE_AFTER_MONTH },
|
|
52
|
+
"gl-ES": { locale: locale_1.gl, format: Format.DATE_AFTER_MONTH },
|
|
53
|
+
"gu-IN": { locale: locale_1.gu, format: Format.DATE_AFTER_MONTH },
|
|
54
|
+
"he-IL": { locale: locale_1.he, format: Format.DATE_AFTER_MONTH },
|
|
55
|
+
"hi-IN": { locale: locale_1.hi, format: Format.DATE_AFTER_MONTH },
|
|
56
|
+
"hr-HR": { locale: locale_1.hr, format: Format.DATE_AFTER_MONTH },
|
|
57
|
+
"hu-HU": { locale: locale_1.hu, format: Format.DATE_AFTER_MONTH },
|
|
58
|
+
"id-ID": { locale: locale_1.id, format: Format.DATE_AFTER_MONTH },
|
|
59
|
+
"is-IS": { locale: locale_1.is, format: Format.DATE_AFTER_MONTH },
|
|
60
|
+
"it-CH": { locale: locale_1.itCH, format: Format.DATE_AFTER_MONTH },
|
|
61
|
+
"it-IT": { locale: locale_1.it, format: Format.DATE_AFTER_MONTH },
|
|
62
|
+
"ja-JP": { locale: locale_1.ja, format: Format.DATE_AFTER_MONTH },
|
|
63
|
+
"km-KH": { locale: locale_1.km, format: Format.DATE_AFTER_MONTH },
|
|
64
|
+
"kn-IN": { locale: locale_1.kn, format: Format.DATE_AFTER_MONTH },
|
|
65
|
+
"ko-KR": { locale: locale_1.ko, format: Format.DATE_AFTER_MONTH },
|
|
66
|
+
"lt-LT": { locale: locale_1.lt, format: Format.DATE_AFTER_MONTH },
|
|
67
|
+
"lv-LV": { locale: locale_1.lv, format: Format.DATE_AFTER_MONTH },
|
|
68
|
+
"mr-IN": { locale: locale_1.vi, format: Format.DATE_AFTER_MONTH },
|
|
69
|
+
"ms-MY": { locale: locale_1.ms, format: Format.DATE_AFTER_MONTH },
|
|
70
|
+
"nb-NO": { locale: locale_1.nb, format: Format.DATE_AFTER_MONTH },
|
|
71
|
+
"ne-NP": { locale: locale_1.vi, format: Format.DATE_AFTER_MONTH },
|
|
72
|
+
"nl-BE": { locale: locale_1.nlBE, format: Format.DATE_AFTER_MONTH },
|
|
73
|
+
"nl-NL": { locale: locale_1.nl, format: Format.DATE_AFTER_MONTH },
|
|
74
|
+
"pa-IN": { locale: locale_1.vi, format: Format.DATE_AFTER_MONTH },
|
|
75
|
+
"pl-PL": { locale: locale_1.pl, format: Format.DATE_AFTER_MONTH },
|
|
76
|
+
"pt-BR": { locale: locale_1.ptBR, format: Format.DATE_AFTER_MONTH },
|
|
77
|
+
"pt-PT": { locale: locale_1.pt, format: Format.DATE_AFTER_MONTH },
|
|
78
|
+
"ro-RO": { locale: locale_1.ro, format: Format.DATE_AFTER_MONTH },
|
|
79
|
+
"ru-RU": { locale: locale_1.ru, format: Format.DATE_AFTER_MONTH },
|
|
80
|
+
"sk-SK": { locale: locale_1.sk, format: Format.DATE_AFTER_MONTH },
|
|
81
|
+
"sl-SI": { locale: locale_1.sl, format: Format.DATE_AFTER_MONTH },
|
|
82
|
+
"sq-AL": { locale: locale_1.sq, format: Format.DATE_AFTER_MONTH },
|
|
83
|
+
"sr-RS": { locale: locale_1.sr, format: Format.DATE_AFTER_MONTH },
|
|
84
|
+
"sv-FI": { locale: locale_1.sv, format: Format.DATE_AFTER_MONTH },
|
|
85
|
+
"sv-SE": { locale: locale_1.sv, format: Format.DATE_AFTER_MONTH },
|
|
86
|
+
"ta-IN": { locale: locale_1.ta, format: Format.DATE_AFTER_MONTH },
|
|
87
|
+
"te-IN": { locale: locale_1.te, format: Format.DATE_AFTER_MONTH },
|
|
88
|
+
"th-TH": { locale: locale_1.th, format: Format.DATE_AFTER_MONTH },
|
|
89
|
+
"tr-TR": { locale: locale_1.tr, format: Format.DATE_AFTER_MONTH },
|
|
90
|
+
"uk-UA": { locale: locale_1.uk, format: Format.DATE_AFTER_MONTH },
|
|
91
|
+
"vi-VN": { locale: locale_1.vi, format: Format.DATE_BEFORE_MONTH },
|
|
92
|
+
"zh-CN": { locale: locale_1.zhCN, format: Format.DATE_AFTER_MONTH },
|
|
93
|
+
"zh-HK": { locale: locale_1.zhHK, format: Format.DATE_AFTER_MONTH },
|
|
94
|
+
"zh-TW": { locale: locale_1.zhTW, format: Format.DATE_AFTER_MONTH },
|
|
95
|
+
};
|
|
96
|
+
function getLocaleInLocal() {
|
|
97
|
+
var _a, _b, _c;
|
|
98
|
+
var localeFromLocal = localStorage === null || localStorage === void 0 ? void 0 : localStorage.getItem("locale");
|
|
99
|
+
var bcp47locale = ((_a = Object.keys(supportedLocales)) === null || _a === void 0 ? void 0 : _a.includes(localeFromLocal))
|
|
100
|
+
? localeFromLocal
|
|
101
|
+
: "en-US";
|
|
102
|
+
return {
|
|
103
|
+
bcp47locale: bcp47locale,
|
|
104
|
+
localeInDateFns: (_b = supportedLocales[bcp47locale]) === null || _b === void 0 ? void 0 : _b.locale,
|
|
105
|
+
formatInDateFns: (_c = supportedLocales[bcp47locale]) === null || _c === void 0 ? void 0 : _c.format,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function formatDate(date) {
|
|
109
|
+
try {
|
|
110
|
+
var _a = getLocaleInLocal(), localeInDateFns = _a.localeInDateFns, formatInDateFns = _a.formatInDateFns;
|
|
111
|
+
var dateObj = new Date(date);
|
|
112
|
+
var dateString = (0, date_fns_1.format)(dateObj, formatInDateFns, {
|
|
113
|
+
locale: localeInDateFns,
|
|
114
|
+
});
|
|
115
|
+
return dateString;
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
console.error(err);
|
|
119
|
+
return "--";
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.formatNumber = formatNumber;
|
|
7
|
+
var getStandardNumber_1 = __importDefault(require("./getStandardNumber"));
|
|
8
|
+
function formatNumber(num) {
|
|
9
|
+
if (num >= 1000000000000) {
|
|
10
|
+
return formatter((num / 1000000000000).toFixed(2)) + "T";
|
|
11
|
+
}
|
|
12
|
+
else if (num >= 1000000000) {
|
|
13
|
+
return formatter((num / 1000000000).toFixed(2)) + "B";
|
|
14
|
+
}
|
|
15
|
+
else if (num >= 1000000) {
|
|
16
|
+
return formatter((num / 1000000).toFixed(2)) + "M";
|
|
17
|
+
}
|
|
18
|
+
else if (num >= 1000) {
|
|
19
|
+
return formatter((num / 1000).toFixed(2)) + "K";
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return num.toString();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
var formatter = function (value, useCompact, useCompactOnThousand, lengthAllowedPassed) {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
if (useCompact === void 0) { useCompact = true; }
|
|
28
|
+
if (useCompactOnThousand === void 0) { useCompactOnThousand = false; }
|
|
29
|
+
try {
|
|
30
|
+
if (value == undefined)
|
|
31
|
+
return "";
|
|
32
|
+
var lengthAllowed = lengthAllowedPassed !== null && lengthAllowedPassed !== void 0 ? lengthAllowedPassed : 8;
|
|
33
|
+
var thousandsSeparator = ",";
|
|
34
|
+
var number = Number(value.toString());
|
|
35
|
+
if (number > 1000 && useCompactOnThousand) {
|
|
36
|
+
return formatNumber(number);
|
|
37
|
+
}
|
|
38
|
+
if (number > 1000000 && useCompact) {
|
|
39
|
+
return formatNumber(number);
|
|
40
|
+
}
|
|
41
|
+
var numberToString = (0, getStandardNumber_1.default)(number);
|
|
42
|
+
if (numberToString.includes(".")) {
|
|
43
|
+
// is not natural number
|
|
44
|
+
var indexOfDecimalDot = numberToString.indexOf(".");
|
|
45
|
+
var before = numberToString.slice(0, indexOfDecimalDot);
|
|
46
|
+
var after = numberToString.slice(indexOfDecimalDot + 1, indexOfDecimalDot +
|
|
47
|
+
1 +
|
|
48
|
+
(lengthAllowed - (before === null || before === void 0 ? void 0 : before.length) - 1 <= 1
|
|
49
|
+
? 2
|
|
50
|
+
: lengthAllowed - (before === null || before === void 0 ? void 0 : before.length) - 1));
|
|
51
|
+
var beforeFormatted = before.replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSeparator);
|
|
52
|
+
var afterFormatted = (_b = (_a = Number("0.".concat(after))) === null || _a === void 0 ? void 0 : _a.toString()) === null || _b === void 0 ? void 0 : _b.replace("0.", "");
|
|
53
|
+
return "".concat(beforeFormatted).concat(+afterFormatted ? "." + afterFormatted : "");
|
|
54
|
+
// return afterFormatted;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
//is natural number
|
|
58
|
+
return "".concat(number).replace(/\B(?=(\d{3})+(?!\d))/g, thousandsSeparator);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
console.error(err);
|
|
63
|
+
return "--";
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
exports.default = formatter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getIcon(name: string, fileExtension?: "svg" | "png" | "gif"): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getImage(name: string, fileType?: string): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var date_fns_1 = require("date-fns");
|
|
4
|
+
var getMaxTime = function (startDate, endDate) {
|
|
5
|
+
try {
|
|
6
|
+
return {
|
|
7
|
+
startDate: (0, date_fns_1.startOfDay)(new Date(startDate)).toISOString(),
|
|
8
|
+
endDate: (0, date_fns_1.endOfDay)(new Date(endDate)).toISOString(),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
console.error("🚀 ~ getMaxTime ~ error:", error);
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
exports.default = getMaxTime;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getStandardNumber(value: number | string): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = getStandardNumber;
|
|
4
|
+
function getStandardNumber(value) {
|
|
5
|
+
var stringValue = "" + value;
|
|
6
|
+
if (!stringValue.includes("e-")) {
|
|
7
|
+
return stringValue;
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
var beforeE = stringValue
|
|
11
|
+
.slice(0, stringValue.indexOf("e-"))
|
|
12
|
+
.replace(".", "");
|
|
13
|
+
var afterE = stringValue.slice(stringValue.indexOf("e-") + 2);
|
|
14
|
+
var result = "";
|
|
15
|
+
for (var i = 0; i < +afterE + 1; i++) {
|
|
16
|
+
result += i != 1 ? "0" : ".";
|
|
17
|
+
}
|
|
18
|
+
return result + beforeE;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function lengthFromDotToFirstNonZero(numString: string): number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = lengthFromDotToFirstNonZero;
|
|
4
|
+
function lengthFromDotToFirstNonZero(numString) {
|
|
5
|
+
var dotIndex = numString.indexOf(".");
|
|
6
|
+
if (dotIndex === -1) {
|
|
7
|
+
return -1;
|
|
8
|
+
}
|
|
9
|
+
var firstNonZeroIndex = dotIndex + 1;
|
|
10
|
+
while (firstNonZeroIndex < (numString === null || numString === void 0 ? void 0 : numString.length) &&
|
|
11
|
+
numString[firstNonZeroIndex] === "0") {
|
|
12
|
+
firstNonZeroIndex++;
|
|
13
|
+
}
|
|
14
|
+
if (firstNonZeroIndex >= (numString === null || numString === void 0 ? void 0 : numString.length)) {
|
|
15
|
+
return -1;
|
|
16
|
+
}
|
|
17
|
+
return firstNonZeroIndex - dotIndex - 1;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function reduceZeroNoNecessary(num: number): number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = reduceZeroNoNecessary;
|
|
4
|
+
function reduceZeroNoNecessary(num) {
|
|
5
|
+
var stringValue = num + "";
|
|
6
|
+
var indexOfDot = stringValue.indexOf(".");
|
|
7
|
+
if (indexOfDot == -1)
|
|
8
|
+
return num;
|
|
9
|
+
var length = stringValue.length;
|
|
10
|
+
var result = stringValue;
|
|
11
|
+
for (var i = length; i > 0; i--) {
|
|
12
|
+
if (+stringValue[i] > 0) {
|
|
13
|
+
break;
|
|
14
|
+
}
|
|
15
|
+
result.slice(0, -1);
|
|
16
|
+
}
|
|
17
|
+
return +result;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function roundToTwoSignificantDecimals(num: number): number;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = roundToTwoSignificantDecimals;
|
|
7
|
+
var reduceZeroNoNecessary_1 = __importDefault(require("../utils/reduceZeroNoNecessary"));
|
|
8
|
+
function roundToTwoSignificantDecimals(num) {
|
|
9
|
+
var _a;
|
|
10
|
+
try {
|
|
11
|
+
if (num >= 1) {
|
|
12
|
+
num = Math.floor(+num * 100) / 100;
|
|
13
|
+
}
|
|
14
|
+
var stringValue = num + "";
|
|
15
|
+
var indexOfDot_1 = stringValue.indexOf(".");
|
|
16
|
+
if (indexOfDot_1 == -1)
|
|
17
|
+
return num;
|
|
18
|
+
var indexOfFirstNumberNotZeroAfterDot = (_a = stringValue
|
|
19
|
+
.split("")) === null || _a === void 0 ? void 0 : _a.findIndex(function (char, i) { return +char != 0 && i > indexOfDot_1; });
|
|
20
|
+
var numOfNumberRemain = indexOfFirstNumberNotZeroAfterDot - indexOfDot_1 + 1;
|
|
21
|
+
return (0, reduceZeroNoNecessary_1.default)(Math.floor(+num * Math.pow(10, numOfNumberRemain)) / Math.pow(10, numOfNumberRemain));
|
|
22
|
+
}
|
|
23
|
+
catch (_b) {
|
|
24
|
+
return num;
|
|
25
|
+
}
|
|
26
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tek-wallet",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "A custom React provider with TypeScript support",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"clean": "rm -rf dist",
|
|
9
|
+
"build": "npm run format && tsc",
|
|
10
|
+
"format": "prettier --write . && eslint --fix --ignore-pattern .next --ignore-pattern node_modules",
|
|
11
|
+
"version:patch": "npm version patch",
|
|
12
|
+
"version:minor": "npm version minor",
|
|
13
|
+
"version:major": "npm version major",
|
|
14
|
+
"prepublish": "npm run clean && npm run build",
|
|
15
|
+
"publish:patch": "npm run version:patch && npm publish",
|
|
16
|
+
"publish:minor": "npm run version:minor && npm publish",
|
|
17
|
+
"publish:major": "npm run version:major && npm publish",
|
|
18
|
+
"release": "npm run clean && npm version patch && npm run build"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"react",
|
|
22
|
+
"auth",
|
|
23
|
+
"authentication",
|
|
24
|
+
"authjs"
|
|
25
|
+
],
|
|
26
|
+
"author": "",
|
|
27
|
+
"license": "ISC",
|
|
28
|
+
"type": "commonjs",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@mui/material": "^6.4.7",
|
|
31
|
+
"@reduxjs/toolkit": "^2.6.1",
|
|
32
|
+
"axios": "^1.8.4",
|
|
33
|
+
"clsx": "^2.1.1",
|
|
34
|
+
"date-fns": "^4.1.0",
|
|
35
|
+
"jsonwebtoken": "^9.0.2",
|
|
36
|
+
"next": "^15.2.4",
|
|
37
|
+
"next-auth": "^4.24.11",
|
|
38
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
39
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
40
|
+
"react-otp-input": "^3.1.1",
|
|
41
|
+
"react-redux": "^9.2.0",
|
|
42
|
+
"swiper": "^11.2.4"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
46
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/jsonwebtoken": "^9.0.9",
|
|
50
|
+
"@types/node": "^22.14.0",
|
|
51
|
+
"@types/react": "^18.2.0",
|
|
52
|
+
"@types/react-dom": "^18.2.0",
|
|
53
|
+
"typescript": "^5.8.3",
|
|
54
|
+
"@eslint/eslintrc": "^3",
|
|
55
|
+
"eslint": "^9",
|
|
56
|
+
"eslint-config-next": "15.1.7",
|
|
57
|
+
"prettier": "^3.5.3"
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"dist/**/*"
|
|
61
|
+
]
|
|
62
|
+
}
|