tek-wallet 0.0.755 → 0.0.757
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/components/TekWallet/components/ui/ActivitiesTypeSlice/index.d.ts +3 -0
- package/dist/components/TekWallet/components/ui/ActivitiesTypeSlice/index.js +7 -7
- package/dist/components/TekWallet/components/ui/ActivityDetail/index.js +5 -5
- package/dist/components/TekWallet/components/ui/ActivityItem/index.js +9 -4
- package/dist/components/TekWallet/components/ui/AmountGroupAndChart/index.js +103 -101
- package/dist/components/TekWallet/components/ui/AnalyticGroup/index.d.ts +2 -1
- package/dist/components/TekWallet/components/ui/AnalyticGroup/index.js +47 -32
- package/dist/components/TekWallet/components/ui/CopyTextComponent/index.js +1 -1
- package/dist/components/TekWallet/components/ui/FiatDeposit/index.js +37 -39
- package/dist/components/TekWallet/components/ui/HistorySwap/index.js +1 -2
- package/dist/components/TekWallet/components/ui/NeonLineChart/index.d.ts +6 -5
- package/dist/components/TekWallet/components/ui/NeonLineChart/index.js +2 -2
- package/dist/components/TekWallet/components/ui/ReceiveFunction/index.js +4 -3
- package/dist/components/TekWallet/components/ui/ReceiveHistory/index.js +1 -2
- package/dist/components/TekWallet/components/ui/SmartList/index.d.ts +0 -1
- package/dist/components/TekWallet/components/ui/SmartList/index.js +5 -4
- package/dist/components/TekWallet/components/ui/SvgPath/index.d.ts +1 -0
- package/dist/components/TekWallet/components/ui/SvgPath/index.js +3 -2
- package/dist/components/TekWallet/components/ui/SwapToken/index.js +0 -5
- package/dist/components/TekWallet/components/ui/SwiperControlled/index.js +5 -1
- package/dist/components/TekWallet/components/ui/TimeFilter/index.d.ts +4 -3
- package/dist/components/TekWallet/components/ui/TimeFilter/index.js +27 -30
- package/dist/components/TekWallet/components/ui/TokenItem/index.js +11 -6
- package/dist/components/TekWallet/components/ui/TokensBoard/index.js +1 -3
- package/dist/components/TekWallet/components/views/ActivityView/index.d.ts +10 -0
- package/dist/components/TekWallet/components/views/ActivityView/index.js +64 -0
- package/dist/components/TekWallet/components/views/AssetView/index.js +69 -6
- package/dist/components/TekWallet/components/views/TekWalletView/index.js +1 -1
- package/dist/components/TekWallet/components/views/TekWalletView/routes.d.ts +5 -4
- package/dist/components/TekWallet/components/views/TekWalletView/routes.js +11 -5
- package/dist/components/TekWallet/const/app.config.d.ts +1 -0
- package/dist/components/TekWallet/const/app.config.js +4 -0
- package/dist/components/TekWallet/index.d.ts +1 -1
- package/dist/components/TekWallet/index.js +1 -1
- package/dist/components/TekWallet/providers/ActivitiesProvider/const.d.ts +1 -1
- package/dist/components/TekWallet/providers/ActivitiesProvider/const.js +1 -1
- package/dist/components/TekWallet/providers/ActivitiesProvider/functions/sortActivity.d.ts +3 -0
- package/dist/components/TekWallet/providers/ActivitiesProvider/functions/sortActivity.js +8 -0
- package/dist/components/TekWallet/providers/ActivitiesProvider/index.js +55 -51
- package/dist/components/TekWallet/providers/ActivitiesProvider/type.d.ts +1 -1
- package/dist/components/TekWallet/providers/WalletDataProvider/index.js +2 -0
- package/dist/components/TekWallet/providers/WalletDataProviderNoImport/index.js +41 -6
- package/dist/components/TekWallet/services/axios/get-activities-service/index.js +0 -3
- package/dist/components/TekWallet/services/axios/get-activities-service/type.d.ts +4 -4
- package/dist/components/TekWallet/services/axios/get-balance-analytic/index.d.ts +3 -0
- package/dist/components/TekWallet/services/axios/get-balance-analytic/index.js +56 -0
- package/dist/components/TekWallet/services/axios/get-balance-analytic/type.d.ts +18 -0
- package/dist/components/TekWallet/services/axios/get-balance-analytic/type.js +2 -0
- package/dist/components/TekWallet/store/balance/index.d.ts +15 -0
- package/dist/components/TekWallet/store/balance/index.js +24 -0
- package/dist/components/TekWallet/store/balance/type.d.ts +9 -0
- package/dist/components/TekWallet/store/balance/type.js +2 -0
- package/dist/components/TekWallet/store/createStorage.d.ts +3 -0
- package/dist/components/TekWallet/store/createStorage.js +17 -0
- package/dist/components/TekWallet/store/user/index.d.ts +15 -0
- package/dist/components/TekWallet/store/user/index.js +52 -0
- package/dist/components/TekWallet/store/user/type.d.ts +38 -0
- package/dist/components/TekWallet/store/user/type.js +9 -0
- package/dist/components/TekWallet/types/expose-type.d.ts +3 -0
- package/package.json +3 -2
- package/dist/components/TekWallet/components/ui/Activities/index.d.ts +0 -12
- package/dist/components/TekWallet/components/ui/Activities/index.js +0 -117
|
@@ -90,6 +90,9 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
90
90
|
var react_1 = __importStar(require("react"));
|
|
91
91
|
var userClientRequest_1 = require("../../services/axios/clients/userClientRequest");
|
|
92
92
|
var getBalanceService_1 = __importDefault(require("../../services/axios/get-balance-service/getBalanceService"));
|
|
93
|
+
var get_balance_analytic_1 = __importDefault(require("../../services/axios/get-balance-analytic"));
|
|
94
|
+
var balance_1 = __importDefault(require("../../store/balance"));
|
|
95
|
+
var user_1 = __importDefault(require("../../store/user"));
|
|
93
96
|
exports.initialWalletDataNoImport = {
|
|
94
97
|
isSSO: true,
|
|
95
98
|
isAuthenticated: false,
|
|
@@ -107,6 +110,7 @@ exports.initialWalletDataNoImport = {
|
|
|
107
110
|
createWallet: function () { return Promise.resolve({}); },
|
|
108
111
|
importWallet: function () { return Promise.resolve({}); },
|
|
109
112
|
getSeedPhrase: function () { return Promise.resolve({}); },
|
|
113
|
+
updateBalanceAnalytic: function () { return Promise.resolve(null); },
|
|
110
114
|
};
|
|
111
115
|
//
|
|
112
116
|
exports.WalletDataNoImportContext = react_1.default.createContext(exports.initialWalletDataNoImport);
|
|
@@ -116,12 +120,42 @@ function WalletDataProviderNoImport(_a) {
|
|
|
116
120
|
var _b = react_1.default.useState(!!accessToken), isAuthenticated = _b[0], setIsAuthenticated = _b[1];
|
|
117
121
|
var _c = react_1.default.useState(exports.initialWalletDataNoImport.isInitPasscode), isInitPasscode = _c[0], setIsInitPasscode = _c[1];
|
|
118
122
|
var _d = react_1.default.useState(exports.initialWalletDataNoImport.isTokensLoading), isTokensLoading = _d[0], setIsTokensLoading = _d[1];
|
|
119
|
-
var _e = react_1.default.useState(exports.initialWalletDataNoImport.tokens), tokens = _e[0],
|
|
123
|
+
var _e = react_1.default.useState(exports.initialWalletDataNoImport.tokens), tokens = _e[0], setTokensState = _e[1];
|
|
120
124
|
var _f = react_1.default.useState(exports.initialWalletDataNoImport.masterWallet), masterWallet = _f[0], setMasterWallet = _f[1];
|
|
121
125
|
var _g = react_1.default.useState(exports.initialWalletDataNoImport.policyInfo), policyInfo = _g[0], setPolicyInfo = _g[1];
|
|
122
126
|
var _h = react_1.default.useState(exports.initialWalletDataNoImport.blockchainWallets), blockchainWallets = _h[0], setBlockchainWallets = _h[1];
|
|
123
|
-
var
|
|
127
|
+
var setBalanceAnalytic = (0, balance_1.default)(function (state) { return state.setAnalytic; });
|
|
128
|
+
var setTokensStore = (0, balance_1.default)(function (state) { return state.setTokens; });
|
|
129
|
+
var timeRangeTracking = (0, user_1.default)(function (state) { return state.settings.balance.timeRangeTracking; });
|
|
130
|
+
var setTokens = (0, react_1.useCallback)(function (tokens) {
|
|
131
|
+
setTokensState(tokens);
|
|
132
|
+
setTokensStore(tokens);
|
|
133
|
+
}, [setTokensState, setTokensStore]);
|
|
134
|
+
var updateBalanceAnalytic = (0, react_1.useCallback)(function (reportPeriod) { return __awaiter(_this, void 0, void 0, function () {
|
|
124
135
|
var response, error_1;
|
|
136
|
+
return __generator(this, function (_a) {
|
|
137
|
+
switch (_a.label) {
|
|
138
|
+
case 0:
|
|
139
|
+
_a.trys.push([0, 2, , 3]);
|
|
140
|
+
return [4 /*yield*/, (0, get_balance_analytic_1.default)({
|
|
141
|
+
report_period: reportPeriod,
|
|
142
|
+
})];
|
|
143
|
+
case 1:
|
|
144
|
+
response = _a.sent();
|
|
145
|
+
if (response === null || response === void 0 ? void 0 : response.success) {
|
|
146
|
+
setBalanceAnalytic(response);
|
|
147
|
+
}
|
|
148
|
+
return [2 /*return*/, response];
|
|
149
|
+
case 2:
|
|
150
|
+
error_1 = _a.sent();
|
|
151
|
+
console.error("🚀 ~ updateBalanceAnalytic ~ error:", error_1);
|
|
152
|
+
return [2 /*return*/, null];
|
|
153
|
+
case 3: return [2 /*return*/];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}); }, [setBalanceAnalytic]);
|
|
157
|
+
var updateWalletDetail = (0, react_1.useCallback)(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
158
|
+
var response, error_2;
|
|
125
159
|
return __generator(this, function (_a) {
|
|
126
160
|
switch (_a.label) {
|
|
127
161
|
case 0:
|
|
@@ -141,16 +175,17 @@ function WalletDataProviderNoImport(_a) {
|
|
|
141
175
|
}); }));
|
|
142
176
|
setPolicyInfo(response === null || response === void 0 ? void 0 : response.policy_info);
|
|
143
177
|
setIsTokensLoading(false);
|
|
178
|
+
updateBalanceAnalytic(timeRangeTracking);
|
|
144
179
|
return [3 /*break*/, 3];
|
|
145
180
|
case 2:
|
|
146
|
-
|
|
147
|
-
console.error("🚀 ~ getBalance ~ error:",
|
|
181
|
+
error_2 = _a.sent();
|
|
182
|
+
console.error("🚀 ~ getBalance ~ error:", error_2);
|
|
148
183
|
setIsTokensLoading(false);
|
|
149
184
|
return [3 /*break*/, 3];
|
|
150
185
|
case 3: return [2 /*return*/];
|
|
151
186
|
}
|
|
152
187
|
});
|
|
153
|
-
}); }, [isTokensLoading]);
|
|
188
|
+
}); }, [isTokensLoading, setTokens, updateBalanceAnalytic, timeRangeTracking]);
|
|
154
189
|
react_1.default.useEffect(function () {
|
|
155
190
|
setIsAuthenticated(!!accessToken);
|
|
156
191
|
}, [accessToken]);
|
|
@@ -165,6 +200,6 @@ function WalletDataProviderNoImport(_a) {
|
|
|
165
200
|
setTokens(undefined);
|
|
166
201
|
}
|
|
167
202
|
}, [isAuthenticated]);
|
|
168
|
-
return ((0, jsx_runtime_1.jsx)(exports.WalletDataNoImportContext.Provider, { value: __assign(__assign({}, exports.initialWalletDataNoImport), { isAuthenticated: isAuthenticated, isInitPasscode: isInitPasscode, tokens: tokens, isTokensLoading: isTokensLoading, masterWallet: masterWallet, blockchainWallets: blockchainWallets, policyInfo: policyInfo, updateWalletDetail: updateWalletDetail }), children: children }));
|
|
203
|
+
return ((0, jsx_runtime_1.jsx)(exports.WalletDataNoImportContext.Provider, { value: __assign(__assign({}, exports.initialWalletDataNoImport), { isAuthenticated: isAuthenticated, isInitPasscode: isInitPasscode, tokens: tokens, isTokensLoading: isTokensLoading, masterWallet: masterWallet, blockchainWallets: blockchainWallets, policyInfo: policyInfo, updateWalletDetail: updateWalletDetail, updateBalanceAnalytic: updateBalanceAnalytic }), children: children }));
|
|
169
204
|
}
|
|
170
205
|
exports.default = WalletDataProviderNoImport;
|
|
@@ -51,9 +51,6 @@ var getActivitiesServices = function (query) { return __awaiter(void 0, void 0,
|
|
|
51
51
|
}
|
|
52
52
|
return [4 /*yield*/, userClientRequest_1.default.get("/transaction/list", {
|
|
53
53
|
params: query,
|
|
54
|
-
paramsSerializer: {
|
|
55
|
-
indexes: null,
|
|
56
|
-
},
|
|
57
54
|
})];
|
|
58
55
|
case 1:
|
|
59
56
|
response = _a.sent();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Paginated, Currency, NetworkData } from "../type";
|
|
2
2
|
export interface GetActivitiesServiceQuery {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
from_date?: string;
|
|
6
|
-
to_date?: string;
|
|
3
|
+
limit?: number;
|
|
4
|
+
last_date_created?: string | null;
|
|
7
5
|
transaction_types?: TransactionSlug;
|
|
8
6
|
transaction_status?: TransactionStatus | TransactionStatus[];
|
|
7
|
+
from_date?: string;
|
|
8
|
+
to_date?: string;
|
|
9
9
|
}
|
|
10
10
|
export interface GetActivitiesServiceResponse {
|
|
11
11
|
success: boolean;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
var userClientRequest_1 = __importDefault(require("../clients/userClientRequest"));
|
|
43
|
+
var getBalanceAnalytic = function (query) { return __awaiter(void 0, void 0, void 0, function () {
|
|
44
|
+
var response;
|
|
45
|
+
return __generator(this, function (_a) {
|
|
46
|
+
switch (_a.label) {
|
|
47
|
+
case 0: return [4 /*yield*/, userClientRequest_1.default.get("/wallets/user-total-assets", {
|
|
48
|
+
params: query,
|
|
49
|
+
})];
|
|
50
|
+
case 1:
|
|
51
|
+
response = _a.sent();
|
|
52
|
+
return [2 /*return*/, response === null || response === void 0 ? void 0 : response.data];
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}); };
|
|
56
|
+
exports.default = getBalanceAnalytic;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface GetBalanceAnalyticQuery {
|
|
2
|
+
take?: number;
|
|
3
|
+
report_period?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface GetBalanceAnalyticResponse {
|
|
6
|
+
success: boolean;
|
|
7
|
+
message: string;
|
|
8
|
+
labels: string[];
|
|
9
|
+
pnl_percent: number;
|
|
10
|
+
pnl: number;
|
|
11
|
+
data: StatisticData[];
|
|
12
|
+
timestamp: string;
|
|
13
|
+
}
|
|
14
|
+
export interface StatisticData {
|
|
15
|
+
name?: string;
|
|
16
|
+
values?: number[];
|
|
17
|
+
pnl_percent?: number;
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BalanceStore } from "./type";
|
|
2
|
+
declare const useBalanceStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<BalanceStore>, "setState" | "persist"> & {
|
|
3
|
+
setState(partial: BalanceStore | Partial<BalanceStore> | ((state: BalanceStore) => BalanceStore | Partial<BalanceStore>), replace?: false | undefined): unknown;
|
|
4
|
+
setState(state: BalanceStore | ((state: BalanceStore) => BalanceStore), replace: true): unknown;
|
|
5
|
+
persist: {
|
|
6
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<BalanceStore, BalanceStore, unknown>>) => void;
|
|
7
|
+
clearStorage: () => void;
|
|
8
|
+
rehydrate: () => Promise<void> | void;
|
|
9
|
+
hasHydrated: () => boolean;
|
|
10
|
+
onHydrate: (fn: (state: BalanceStore) => void) => () => void;
|
|
11
|
+
onFinishHydration: (fn: (state: BalanceStore) => void) => () => void;
|
|
12
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<BalanceStore, BalanceStore, unknown>>;
|
|
13
|
+
};
|
|
14
|
+
}>;
|
|
15
|
+
export default useBalanceStore;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 zustand_1 = require("zustand");
|
|
7
|
+
var middleware_1 = require("zustand/middleware");
|
|
8
|
+
var createStorage_1 = __importDefault(require("../createStorage"));
|
|
9
|
+
var app_config_1 = require("../../const/app.config");
|
|
10
|
+
var storage = (0, createStorage_1.default)();
|
|
11
|
+
var useBalanceStore = (0, zustand_1.create)()((0, middleware_1.persist)(function (set) { return ({
|
|
12
|
+
analytic: undefined,
|
|
13
|
+
setAnalytic: function (analytic) { return set({ analytic: analytic }); },
|
|
14
|
+
tokens: undefined,
|
|
15
|
+
setTokens: function (tokens) {
|
|
16
|
+
var totalBalanceInUSD = tokens === null || tokens === void 0 ? void 0 : tokens.reduce(function (acc, token) { return acc + Number(token.total_value) * Number(token.usd_rate); }, 0);
|
|
17
|
+
set({ tokens: tokens, totalBalanceInUSD: totalBalanceInUSD });
|
|
18
|
+
},
|
|
19
|
+
totalBalanceInUSD: undefined,
|
|
20
|
+
}); }, {
|
|
21
|
+
name: "".concat(app_config_1.APP_NAME, "_balance"),
|
|
22
|
+
storage: storage,
|
|
23
|
+
}));
|
|
24
|
+
exports.default = useBalanceStore;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GetBalanceAnalyticResponse } from "../../services/axios/get-balance-analytic/type";
|
|
2
|
+
import { Balance } from "../../types/expose-type";
|
|
3
|
+
export interface BalanceStore {
|
|
4
|
+
analytic?: GetBalanceAnalyticResponse;
|
|
5
|
+
setAnalytic: (analytic: GetBalanceAnalyticResponse) => void;
|
|
6
|
+
tokens?: Balance[];
|
|
7
|
+
setTokens: (tokens?: Balance[]) => void;
|
|
8
|
+
totalBalanceInUSD?: number;
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var createStorage = function () {
|
|
4
|
+
return ({
|
|
5
|
+
getItem: function (name) {
|
|
6
|
+
var str = localStorage.getItem(name);
|
|
7
|
+
if (!str)
|
|
8
|
+
return null;
|
|
9
|
+
return JSON.parse(str);
|
|
10
|
+
},
|
|
11
|
+
setItem: function (name, value) {
|
|
12
|
+
localStorage.setItem(name, JSON.stringify(value));
|
|
13
|
+
},
|
|
14
|
+
removeItem: function (name) { return localStorage.removeItem(name); },
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
exports.default = createStorage;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UserStore } from "./type";
|
|
2
|
+
declare const useUserStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<UserStore>, "setState" | "persist"> & {
|
|
3
|
+
setState(partial: UserStore | Partial<UserStore> | ((state: UserStore) => UserStore | Partial<UserStore>), replace?: false | undefined): unknown;
|
|
4
|
+
setState(state: UserStore | ((state: UserStore) => UserStore), replace: true): unknown;
|
|
5
|
+
persist: {
|
|
6
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<UserStore, UserStore, unknown>>) => void;
|
|
7
|
+
clearStorage: () => void;
|
|
8
|
+
rehydrate: () => Promise<void> | void;
|
|
9
|
+
hasHydrated: () => boolean;
|
|
10
|
+
onHydrate: (fn: (state: UserStore) => void) => () => void;
|
|
11
|
+
onFinishHydration: (fn: (state: UserStore) => void) => () => void;
|
|
12
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<UserStore, UserStore, unknown>>;
|
|
13
|
+
};
|
|
14
|
+
}>;
|
|
15
|
+
export default useUserStore;
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
var zustand_1 = require("zustand");
|
|
18
|
+
var middleware_1 = require("zustand/middleware");
|
|
19
|
+
var createStorage_1 = __importDefault(require("../createStorage"));
|
|
20
|
+
var app_config_1 = require("../../const/app.config");
|
|
21
|
+
var TimeFilter_1 = require("../../components/ui/TimeFilter");
|
|
22
|
+
var storage = (0, createStorage_1.default)();
|
|
23
|
+
var useUserStore = (0, zustand_1.create)()((0, middleware_1.persist)(function (set) { return ({
|
|
24
|
+
userInfo: undefined,
|
|
25
|
+
setUserInfo: function (userInfo) { return set({ userInfo: userInfo }); },
|
|
26
|
+
settings: {
|
|
27
|
+
balance: {
|
|
28
|
+
isShowBalance: false,
|
|
29
|
+
hideSmallAssets: false,
|
|
30
|
+
timeRangeTracking: TimeFilter_1.TimeFilterType.SEVEN_DAYS,
|
|
31
|
+
},
|
|
32
|
+
sounds: {
|
|
33
|
+
generalVolume: 0.5,
|
|
34
|
+
sounds: {},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
setSettings: function (settings) { return set({ settings: settings }); },
|
|
38
|
+
setTimeRangeTracking: function (timeRangeTracking) {
|
|
39
|
+
return set(function (state) { return ({
|
|
40
|
+
settings: __assign(__assign({}, state.settings), { balance: __assign(__assign({}, state.settings.balance), { timeRangeTracking: timeRangeTracking }) }),
|
|
41
|
+
}); });
|
|
42
|
+
},
|
|
43
|
+
toggleShowBalance: function () {
|
|
44
|
+
return set(function (state) { return ({
|
|
45
|
+
settings: __assign(__assign({}, state.settings), { balance: __assign(__assign({}, state.settings.balance), { isShowBalance: !state.settings.balance.isShowBalance }) }),
|
|
46
|
+
}); });
|
|
47
|
+
},
|
|
48
|
+
}); }, {
|
|
49
|
+
name: "".concat(app_config_1.APP_NAME, "_user"),
|
|
50
|
+
storage: storage,
|
|
51
|
+
}));
|
|
52
|
+
exports.default = useUserStore;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { TimeFilterType } from "../../components/ui/TimeFilter";
|
|
2
|
+
export interface UserStore {
|
|
3
|
+
userInfo?: UserInfo;
|
|
4
|
+
setUserInfo: (userInfo: UserInfo) => void;
|
|
5
|
+
settings: UserSettings;
|
|
6
|
+
setSettings: (settings: UserSettings) => void;
|
|
7
|
+
toggleShowBalance: () => void;
|
|
8
|
+
setTimeRangeTracking: (timeRangeTracking: TimeFilterType) => void;
|
|
9
|
+
}
|
|
10
|
+
export type UserInfo = {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
email: string;
|
|
14
|
+
};
|
|
15
|
+
export type UserSettings = {
|
|
16
|
+
balance: BalanceSetting;
|
|
17
|
+
sounds: SoundSetting;
|
|
18
|
+
};
|
|
19
|
+
export interface BalanceSetting {
|
|
20
|
+
isShowBalance: boolean;
|
|
21
|
+
hideSmallAssets: boolean;
|
|
22
|
+
timeRangeTracking: TimeFilterType;
|
|
23
|
+
}
|
|
24
|
+
export interface SoundSetting {
|
|
25
|
+
generalVolume: number;
|
|
26
|
+
sounds: Partial<Record<SoundTypes, Sound>>;
|
|
27
|
+
}
|
|
28
|
+
export interface Sound {
|
|
29
|
+
type: SoundTypes;
|
|
30
|
+
name: string;
|
|
31
|
+
url: string;
|
|
32
|
+
volume: number;
|
|
33
|
+
}
|
|
34
|
+
export declare enum SoundTypes {
|
|
35
|
+
CLICK = "click",
|
|
36
|
+
NOTIFICATION = "notification",
|
|
37
|
+
MESSAGE = "message"
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SoundTypes = void 0;
|
|
4
|
+
var SoundTypes;
|
|
5
|
+
(function (SoundTypes) {
|
|
6
|
+
SoundTypes["CLICK"] = "click";
|
|
7
|
+
SoundTypes["NOTIFICATION"] = "notification";
|
|
8
|
+
SoundTypes["MESSAGE"] = "message";
|
|
9
|
+
})(SoundTypes || (exports.SoundTypes = SoundTypes = {}));
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { TimeFilterType } from "../components/ui/TimeFilter";
|
|
1
2
|
import { ActivitiesProviderDataType } from "../providers/ActivitiesProvider/type";
|
|
2
3
|
import { LockTokensProviderDataType } from "../providers/LockTokenProvider/type";
|
|
3
4
|
import { RealtimeProviderDataType } from "../providers/RealtimeProvider/type";
|
|
4
5
|
import { SwapProviderDataType } from "../providers/SwapProvider/type";
|
|
5
6
|
import { PolicyInfoType } from "../services/axios/authentication-by-passcode-service/type";
|
|
7
|
+
import { GetBalanceAnalyticResponse } from "../services/axios/get-balance-analytic/type";
|
|
6
8
|
import { TransferInternalCurrency } from "../services/axios/get-send-tokens-list-service/type";
|
|
7
9
|
import { WithdrawCurrency } from "../services/axios/get-withdraw-tokens-list-service/type";
|
|
8
10
|
import { Currency, NetworkData, Paginated } from "../services/axios/type";
|
|
@@ -75,6 +77,7 @@ export interface WalletProviderDataType {
|
|
|
75
77
|
policyInfo?: PolicyInfoType | undefined;
|
|
76
78
|
updateLogin: () => void;
|
|
77
79
|
updateWalletDetail: () => void;
|
|
80
|
+
updateBalanceAnalytic: (reportPeriod?: TimeFilterType) => Promise<GetBalanceAnalyticResponse | null>;
|
|
78
81
|
disconnect: () => void;
|
|
79
82
|
createWallet: (body: CreateWalletServiceBody, onStart?: () => void, onSuccess?: (data?: CreateWalletServiceResponse) => void, onError?: (error?: Error) => void) => Promise<CreateWalletServiceResponse>;
|
|
80
83
|
importWallet: (body: ImportWalletServiceBody, onStart?: () => void, onSuccess?: (data?: ImportWalletServiceResponse) => void, onError?: (error?: Error) => void) => Promise<ImportWalletServiceResponse>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tek-wallet",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.757",
|
|
4
4
|
"description": "A custom React provider with TypeScript support",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -63,7 +63,8 @@
|
|
|
63
63
|
"ton-crypto": "^3.2.0",
|
|
64
64
|
"usehooks-ts": "^3.1.1",
|
|
65
65
|
"uuid": "^11.1.0",
|
|
66
|
-
"xhub-keyboard": "^0.0.23"
|
|
66
|
+
"xhub-keyboard": "^0.0.23",
|
|
67
|
+
"zustand": "^5.0.8"
|
|
67
68
|
},
|
|
68
69
|
"peerDependencies": {
|
|
69
70
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { GeneralProps, UnknownFunction } from "../../../types/ui";
|
|
2
|
-
interface ActivitiesProps extends GeneralProps {
|
|
3
|
-
onClose?: UnknownFunction;
|
|
4
|
-
onOpen?: UnknownFunction;
|
|
5
|
-
}
|
|
6
|
-
export type ActivitiesRef = {
|
|
7
|
-
open: () => void;
|
|
8
|
-
close: () => void;
|
|
9
|
-
openTab: (index: number) => void;
|
|
10
|
-
};
|
|
11
|
-
export declare const Activities: import("react").ForwardRefExoticComponent<ActivitiesProps & import("react").RefAttributes<ActivitiesRef>>;
|
|
12
|
-
export default Activities;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.Activities = void 0;
|
|
41
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
42
|
-
var react_1 = require("react");
|
|
43
|
-
var DrawerComponent_1 = __importStar(require("../DrawerComponent"));
|
|
44
|
-
var RequireConnect_1 = __importDefault(require("../RequireConnect"));
|
|
45
|
-
var ChildPageLayout_1 = __importDefault(require("../../layouts/ChildPageLayout"));
|
|
46
|
-
var PageHeader_1 = __importDefault(require("../PageHeader"));
|
|
47
|
-
var SwiperControlled_1 = __importDefault(require("../SwiperControlled"));
|
|
48
|
-
var useActivities_1 = __importDefault(require("../../../hooks/useActivities"));
|
|
49
|
-
var material_1 = require("@mui/material");
|
|
50
|
-
var ThemeProvider_1 = require("../../../providers/ThemeProvider");
|
|
51
|
-
var react_2 = require("swiper/react");
|
|
52
|
-
var ActivitiesTypeSlice_1 = __importDefault(require("../ActivitiesTypeSlice"));
|
|
53
|
-
exports.Activities = (0, react_1.forwardRef)(function (props, ref) {
|
|
54
|
-
var drawerRef = (0, react_1.useRef)(null);
|
|
55
|
-
var theme = (0, ThemeProvider_1.useTheme)();
|
|
56
|
-
var swiperRef = (0, react_1.useRef)(null);
|
|
57
|
-
var activityTypes = (0, useActivities_1.default)().activityTypes;
|
|
58
|
-
var _a = (0, react_1.useState)(0), activeTab = _a[0], setActiveTab = _a[1];
|
|
59
|
-
var open = function () {
|
|
60
|
-
var _a;
|
|
61
|
-
(_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
62
|
-
};
|
|
63
|
-
var close = function () {
|
|
64
|
-
var _a;
|
|
65
|
-
(_a = drawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
66
|
-
};
|
|
67
|
-
var openTab = function (index) {
|
|
68
|
-
var _a;
|
|
69
|
-
open();
|
|
70
|
-
if (!swiperRef.current)
|
|
71
|
-
return;
|
|
72
|
-
(_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.slideTo(index);
|
|
73
|
-
};
|
|
74
|
-
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
75
|
-
open: open,
|
|
76
|
-
close: close,
|
|
77
|
-
openTab: openTab,
|
|
78
|
-
}); });
|
|
79
|
-
var handleOnClose = function () {
|
|
80
|
-
var _a;
|
|
81
|
-
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
82
|
-
};
|
|
83
|
-
var handleBack = function () {
|
|
84
|
-
close();
|
|
85
|
-
handleOnClose();
|
|
86
|
-
};
|
|
87
|
-
var handleSlideChange = function (index) {
|
|
88
|
-
setActiveTab(index);
|
|
89
|
-
};
|
|
90
|
-
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { disableSwipe: true, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, ref: drawerRef, trigger: props.children, onOpen: props.onOpen, onClose: handleOnClose, children: (0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { header: (0, jsx_runtime_1.jsx)(PageHeader_1.default, { title: "Activities", overrideBack: handleBack }), children: (0, jsx_runtime_1.jsx)(SwiperControlled_1.default, { ref: swiperRef, tabParamName: "activity-tab", swiperProps: {
|
|
91
|
-
slidesPerView: 1,
|
|
92
|
-
spaceBetween: 40,
|
|
93
|
-
}, onTabChange: handleSlideChange, tabs: activityTypes === null || activityTypes === void 0 ? void 0 : activityTypes.map(function (type, index) {
|
|
94
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Tab, { label: type.name, value: index, "data-index": index, sx: {
|
|
95
|
-
padding: "".concat(theme.mixins.customPadding.p8, " ").concat(theme.mixins.customPadding.p16),
|
|
96
|
-
minHeight: "unset",
|
|
97
|
-
minWidth: "unset",
|
|
98
|
-
textTransform: "capitalize",
|
|
99
|
-
color: theme.palette.text.white64,
|
|
100
|
-
transition: "all 0.3s linear",
|
|
101
|
-
borderColor: "currentcolor",
|
|
102
|
-
"&.Mui-selected": {
|
|
103
|
-
color: theme.palette.text.white,
|
|
104
|
-
},
|
|
105
|
-
} }, index));
|
|
106
|
-
}), sx: {
|
|
107
|
-
height: "100%",
|
|
108
|
-
}, swiperStyle: {
|
|
109
|
-
flex: 1,
|
|
110
|
-
}, children: activityTypes === null || activityTypes === void 0 ? void 0 : activityTypes.map(function (type, index) {
|
|
111
|
-
return ((0, jsx_runtime_1.jsx)(react_2.SwiperSlide, { style: {
|
|
112
|
-
position: "relative",
|
|
113
|
-
}, children: (0, jsx_runtime_1.jsx)(ActivitiesTypeSlice_1.default, { type: type, isActive: activeTab === index }) }, index));
|
|
114
|
-
}) }) }) }) }));
|
|
115
|
-
});
|
|
116
|
-
exports.Activities.displayName = "Activities";
|
|
117
|
-
exports.default = exports.Activities;
|