@coopenomics/desktop 2025.11.17-alpha-4 → 2025.11.19-alpha-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/extensions/capital/features/Commit/CreateCommit/ui/CreateCommitButton.vue +4 -4
- package/extensions/capital/pages/ProjectsListPage/ui/ProjectsListPage.vue +3 -3
- package/package.json +6 -6
- package/src/app/layouts/useDefaultLayoutLogic.ts +1 -3
- package/src/entities/CmdkMenu/model/store.ts +6 -6
- package/src/entities/ConnectionAgreement/model/store.ts +10 -3
- package/src/entities/Desktop/model/store.ts +5 -5
- package/src/entities/Session/index.ts +0 -1
- package/src/entities/Session/model/store.ts +31 -0
- package/src/entities/User/index.ts +0 -3
- package/src/features/Provider/api/index.ts +35 -1
- package/src/features/Provider/model/index.ts +66 -2
- package/src/features/User/CreateUser/model/index.ts +1 -3
- package/src/features/User/LoginUser/model/index.ts +8 -11
- package/src/features/User/LoginUser/ui/LoginForm/LoginForm.vue +2 -5
- package/src/features/User/Logout/model/index.ts +3 -3
- package/src/features/User/Logout/ui/LogoutButton/LogoutButton.vue +1 -3
- package/src/pages/Cooperative/ListOfAgenda/ui/ListOfAgendaQuestions.vue +4 -3
- package/src/pages/Cooperative/ListOfMeets/ui/ListOfMeetsPage.vue +4 -4
- package/src/pages/PermissionDenied/PermissionDenied.vue +1 -3
- package/src/pages/Registrator/SignIn/ui/SignInPage.vue +4 -3
- package/src/pages/Registrator/SignUp/SignUp.vue +3 -6
- package/src/pages/Registrator/SignUp/WaitingRegistration.vue +4 -4
- package/src/pages/Union/ConnectionAgreement/ConnectionAgreementPage.vue +23 -19
- package/src/pages/User/PaymentMethodsPage/ui/PaymentMethods.vue +3 -3
- package/src/pages/User/ProfilePage/ui/ProfilePage.vue +10 -10
- package/src/pages/User/WalletPage/ui/WalletPage.vue +0 -2
- package/src/processes/navigation-guard-setup/index.ts +3 -5
- package/src/widgets/ConnectionAgreementStepper/Steps/DomainValidationStep.vue +4 -5
- package/src/widgets/ConnectionDashboard/ui/AxonWallet.vue +185 -0
- package/src/widgets/ConnectionDashboard/ui/ConnectionDashboard.vue +10 -138
- package/src/widgets/ConnectionDashboard/ui/DomainCard.vue +242 -0
- package/src/widgets/ConnectionDashboard/ui/SubscriptionsCard.vue +193 -0
- package/src/widgets/ConnectionDashboard/ui/index.ts +3 -0
- package/src/widgets/Desktop/SecondLevelMenuList/SecondLevelMenuList.vue +8 -8
- package/src/widgets/Desktop/WorkspaceMenu/WorkspaceMenu.vue +3 -3
- package/src/widgets/Header/CommonHeader/MainHeader.vue +2 -3
- package/src/widgets/Header/SettingsDropdown/SettingsDropdown.vue +1 -3
- package/src/widgets/NotificationCenter/NotificationCenter.vue +5 -5
- package/src/widgets/Questions/ui/QuestionCard/QuestionCard.vue +3 -3
- package/src/widgets/User/CoopCard/ui/CoopCard.vue +12 -12
- package/src/widgets/Wallet/MicroWallet/ui/MicroWallet.vue +7 -7
- package/src/widgets/Wallet/WalletWidget/ui/WalletWidget.vue +5 -5
- package/src/entities/Session/composables/useCurrentUser.ts +0 -39
|
@@ -33,7 +33,7 @@ q-btn(
|
|
|
33
33
|
import { ref, watch } from 'vue';
|
|
34
34
|
import { useCreateCommit } from '../model';
|
|
35
35
|
import { useSystemStore } from 'src/entities/System/model';
|
|
36
|
-
import {
|
|
36
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
37
37
|
import { generateUniqueHash } from 'src/shared/lib/utils/generateUniqueHash';
|
|
38
38
|
import { FailAlert, SuccessAlert } from 'src/shared/api/alerts';
|
|
39
39
|
import { ModalBase } from 'src/shared/ui/ModalBase';
|
|
@@ -49,8 +49,8 @@ const props = defineProps<{
|
|
|
49
49
|
}>();
|
|
50
50
|
|
|
51
51
|
const system = useSystemStore();
|
|
52
|
-
const
|
|
53
|
-
const { createCommit, createCommitInput } = useCreateCommit(props.projectHash, username);
|
|
52
|
+
const session = useSessionStore();
|
|
53
|
+
const { createCommit, createCommitInput } = useCreateCommit(props.projectHash, session.username);
|
|
54
54
|
|
|
55
55
|
const loading = ref(false);
|
|
56
56
|
const showDialog = ref(false);
|
|
@@ -88,7 +88,7 @@ const handleCreateCommit = async () => {
|
|
|
88
88
|
coopname: system.info.coopname,
|
|
89
89
|
commit_hours: formData.value.creator_hours,
|
|
90
90
|
project_hash: props.projectHash || createCommitInput.value.project_hash,
|
|
91
|
-
username: username || createCommitInput.value.username,
|
|
91
|
+
username: session.username || createCommitInput.value.username,
|
|
92
92
|
description: formData.value.description,
|
|
93
93
|
meta: JSON.stringify({}),
|
|
94
94
|
};
|
|
@@ -38,7 +38,7 @@ div
|
|
|
38
38
|
)
|
|
39
39
|
|
|
40
40
|
// Floating Action Button для создания проекта
|
|
41
|
-
Fab(v-if='
|
|
41
|
+
Fab(v-if='session.isChairman || session.isMember')
|
|
42
42
|
template(#actions)
|
|
43
43
|
CreateProjectFabAction
|
|
44
44
|
</template>
|
|
@@ -53,11 +53,11 @@ import { Fab } from 'src/shared/ui';
|
|
|
53
53
|
import { CreateProjectFabAction } from 'app/extensions/capital/features/Project/CreateProject';
|
|
54
54
|
import { ProjectsListWidget, ComponentsListWidget, IssuesListWidget, ListFilterWidget } from 'app/extensions/capital/widgets';
|
|
55
55
|
import { useProjectFilters } from 'app/extensions/capital/widgets/ListFilterWidget/useProjectFilters';
|
|
56
|
-
import {
|
|
56
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
57
57
|
import { useProjectStore } from 'app/extensions/capital/entities/Project/model';
|
|
58
58
|
|
|
59
59
|
const router = useRouter();
|
|
60
|
-
const
|
|
60
|
+
const session = useSessionStore();
|
|
61
61
|
const projectStore = useProjectStore();
|
|
62
62
|
|
|
63
63
|
// Используем композабл для управления фильтрами
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coopenomics/desktop",
|
|
3
|
-
"version": "2025.11.
|
|
3
|
+
"version": "2025.11.19-alpha-1",
|
|
4
4
|
"description": "A Desktop Project",
|
|
5
5
|
"productName": "Desktop App",
|
|
6
6
|
"author": "Alex Ant <dacom.dark.sun@gmail.com>",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"start": "node -r ./alias-resolver.js dist/ssr/index.js"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@coopenomics/controller": "2025.11.
|
|
29
|
-
"@coopenomics/notifications": "2025.11.
|
|
30
|
-
"@coopenomics/sdk": "2025.11.
|
|
28
|
+
"@coopenomics/controller": "2025.11.19-alpha-1",
|
|
29
|
+
"@coopenomics/notifications": "2025.11.19-alpha-1",
|
|
30
|
+
"@coopenomics/sdk": "2025.11.19-alpha-1",
|
|
31
31
|
"@dicebear/collection": "^9.0.1",
|
|
32
32
|
"@dicebear/core": "^9.0.1",
|
|
33
33
|
"@editorjs/code": "^2.9.3",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@wharfkit/wallet-plugin-privatekey": "^1.1.0",
|
|
60
60
|
"axios": "^1.2.1",
|
|
61
61
|
"compression": "^1.7.4",
|
|
62
|
-
"cooptypes": "2025.11.
|
|
62
|
+
"cooptypes": "2025.11.19-alpha-1",
|
|
63
63
|
"dompurify": "^3.1.7",
|
|
64
64
|
"dotenv": "^16.4.5",
|
|
65
65
|
"email-regex": "^5.0.0",
|
|
@@ -123,5 +123,5 @@
|
|
|
123
123
|
"npm": ">= 6.13.4",
|
|
124
124
|
"yarn": ">= 1.21.1"
|
|
125
125
|
},
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "25834236004eb6e3b3db82d61ac3d9a6d5f0741d"
|
|
127
127
|
}
|
|
@@ -4,7 +4,6 @@ import { useRoute } from 'vue-router';
|
|
|
4
4
|
import { useWindowSize } from 'vue-window-size';
|
|
5
5
|
import { useSystemStore } from 'src/entities/System/model';
|
|
6
6
|
import { useSessionStore } from 'src/entities/Session';
|
|
7
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
8
7
|
import { useDesktopStore } from 'src/entities/Desktop/model';
|
|
9
8
|
|
|
10
9
|
export function useDefaultLayoutLogic() {
|
|
@@ -12,7 +11,6 @@ export function useDefaultLayoutLogic() {
|
|
|
12
11
|
const { width } = useWindowSize();
|
|
13
12
|
const route = useRoute();
|
|
14
13
|
const session = useSessionStore();
|
|
15
|
-
const currentUser = useCurrentUser();
|
|
16
14
|
const system = useSystemStore();
|
|
17
15
|
const desktop = useDesktopStore();
|
|
18
16
|
|
|
@@ -32,7 +30,7 @@ export function useDefaultLayoutLogic() {
|
|
|
32
30
|
);
|
|
33
31
|
|
|
34
32
|
const isRegistrationComplete = computed(
|
|
35
|
-
() =>
|
|
33
|
+
() => session.isRegistrationComplete,
|
|
36
34
|
);
|
|
37
35
|
|
|
38
36
|
const loggedIn = computed(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineStore } from 'pinia';
|
|
2
2
|
import { computed, ref, nextTick } from 'vue';
|
|
3
3
|
import { useRouter } from 'vue-router';
|
|
4
|
-
import {
|
|
4
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
5
5
|
import { useDesktopStore } from 'src/entities/Desktop/model';
|
|
6
6
|
import { useSystemStore } from 'src/entities/System/model';
|
|
7
7
|
import type { PageItem, GroupedItem } from './types';
|
|
@@ -11,7 +11,7 @@ const namespace = 'cmdk-menu';
|
|
|
11
11
|
export const useCmdkMenuStore = defineStore(namespace, () => {
|
|
12
12
|
// Composables
|
|
13
13
|
const router = useRouter();
|
|
14
|
-
const
|
|
14
|
+
const session = useSessionStore();
|
|
15
15
|
const desktop = useDesktopStore();
|
|
16
16
|
const { info } = useSystemStore();
|
|
17
17
|
|
|
@@ -71,7 +71,7 @@ export const useCmdkMenuStore = defineStore(namespace, () => {
|
|
|
71
71
|
|
|
72
72
|
// Вычисляем роль пользователя
|
|
73
73
|
const userRole = computed(() =>
|
|
74
|
-
|
|
74
|
+
session.isChairman ? 'chairman' : session.isMember ? 'member' : 'user'
|
|
75
75
|
);
|
|
76
76
|
|
|
77
77
|
// Группировка воркспейсов с их страницами
|
|
@@ -100,10 +100,10 @@ const groupedItems = computed<GroupedItem[]>(() => {
|
|
|
100
100
|
page.meta.roles.length === 0;
|
|
101
101
|
const conditionMatch = page.meta?.conditions
|
|
102
102
|
? evaluateCondition(page.meta.conditions, {
|
|
103
|
-
isCoop:
|
|
104
|
-
|
|
103
|
+
isCoop: session.privateAccount?.type === 'organization' &&
|
|
104
|
+
session.privateAccount?.organization_data?.type?.toUpperCase() === 'COOP',
|
|
105
105
|
userRole: userRole.value,
|
|
106
|
-
userAccount:
|
|
106
|
+
userAccount: session.privateAccount,
|
|
107
107
|
coopname: info.coopname,
|
|
108
108
|
})
|
|
109
109
|
: true;
|
|
@@ -135,12 +135,19 @@ export const useConnectionAgreementStore = defineStore(namespace, () => {
|
|
|
135
135
|
try {
|
|
136
136
|
currentInstanceLoading.value = true
|
|
137
137
|
currentInstanceError.value = null
|
|
138
|
-
|
|
138
|
+
const freshInstance = await getCurrentInstance()
|
|
139
|
+
|
|
140
|
+
// Обновляем данные только если получили свежие данные
|
|
141
|
+
// При ошибке оставляем старые данные в currentInstance (они могут быть из localStorage)
|
|
142
|
+
if (freshInstance !== null) {
|
|
143
|
+
currentInstance.value = freshInstance
|
|
144
|
+
}
|
|
145
|
+
|
|
139
146
|
console.log('Текущий инстанс загружен:', currentInstance.value)
|
|
140
147
|
} catch (error: any) {
|
|
141
148
|
currentInstanceError.value = error.message || 'Ошибка загрузки инстанса'
|
|
142
|
-
//
|
|
143
|
-
currentInstance.value
|
|
149
|
+
// НЕ очищаем старые данные при ошибке - они остаются актуальными из localStorage
|
|
150
|
+
// currentInstance.value остается как есть
|
|
144
151
|
console.error('Ошибка при загрузке текущего инстанса:', error)
|
|
145
152
|
} finally {
|
|
146
153
|
currentInstanceLoading.value = false
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
} from './types';
|
|
8
8
|
import { api } from '../api';
|
|
9
9
|
import { useSystemStore } from 'src/entities/System/model';
|
|
10
|
-
import {
|
|
10
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
11
11
|
|
|
12
12
|
interface WorkspaceMenuItem {
|
|
13
13
|
workspaceName: string;
|
|
@@ -139,12 +139,12 @@ export const useDesktopStore = defineStore(namespace, () => {
|
|
|
139
139
|
|
|
140
140
|
// Получаем настройки системы
|
|
141
141
|
const systemStore = useSystemStore();
|
|
142
|
-
const
|
|
142
|
+
const session = useSessionStore();
|
|
143
143
|
|
|
144
144
|
let defaultWorkspace = 'participant'; // дефолтное значение
|
|
145
145
|
|
|
146
146
|
// Определяем, какие настройки использовать (авторизованный или неавторизованный пользователь)
|
|
147
|
-
if (
|
|
147
|
+
if (session.isAuth) {
|
|
148
148
|
// Для авторизованных пользователей используем authorized_default_workspace
|
|
149
149
|
defaultWorkspace = systemStore.info?.settings?.authorized_default_workspace || 'participant';
|
|
150
150
|
} else {
|
|
@@ -242,7 +242,7 @@ export const useDesktopStore = defineStore(namespace, () => {
|
|
|
242
242
|
params: Record<string, any>;
|
|
243
243
|
} | null {
|
|
244
244
|
const { info } = useSystemStore();
|
|
245
|
-
const
|
|
245
|
+
const session = useSessionStore();
|
|
246
246
|
|
|
247
247
|
if (!currentDesktop.value || !activeWorkspaceName.value) {
|
|
248
248
|
return null;
|
|
@@ -260,7 +260,7 @@ export const useDesktopStore = defineStore(namespace, () => {
|
|
|
260
260
|
// Проверяем, есть ли настроенный маршрут для текущего рабочего стола
|
|
261
261
|
let configuredRoute: string | undefined;
|
|
262
262
|
|
|
263
|
-
if (
|
|
263
|
+
if (session.isAuth) {
|
|
264
264
|
// Для авторизованных пользователей используем authorized_default_route
|
|
265
265
|
configuredRoute = info?.settings?.authorized_default_route;
|
|
266
266
|
} else {
|
|
@@ -19,10 +19,17 @@ interface ISessionStore {
|
|
|
19
19
|
// Добавляю данные текущего пользователя
|
|
20
20
|
currentUserAccount: Ref<IAccount | undefined>;
|
|
21
21
|
setCurrentUserAccount: (account: IAccount | undefined) => void;
|
|
22
|
+
clearAccount: () => void;
|
|
22
23
|
// Computed свойства для текущего пользователя
|
|
23
24
|
isRegistrationComplete: ComputedRef<boolean>;
|
|
24
25
|
isChairman: ComputedRef<boolean>;
|
|
25
26
|
isMember: ComputedRef<boolean>;
|
|
27
|
+
// Удобные геттеры для различных типов данных
|
|
28
|
+
userAccount: ComputedRef<IAccount['user_account'] | undefined>;
|
|
29
|
+
privateAccount: ComputedRef<IAccount['private_account'] | undefined>;
|
|
30
|
+
blockchainAccount: ComputedRef<IAccount['blockchain_account'] | undefined>;
|
|
31
|
+
participantAccount: ComputedRef<IAccount['participant_account'] | undefined>;
|
|
32
|
+
providerAccount: ComputedRef<IAccount['provider_account'] | undefined>;
|
|
26
33
|
}
|
|
27
34
|
|
|
28
35
|
export const useSessionStore = defineStore('session', (): ISessionStore => {
|
|
@@ -37,6 +44,10 @@ export const useSessionStore = defineStore('session', (): ISessionStore => {
|
|
|
37
44
|
currentUserAccount.value = account;
|
|
38
45
|
};
|
|
39
46
|
|
|
47
|
+
const clearAccount = () => {
|
|
48
|
+
setCurrentUserAccount(undefined);
|
|
49
|
+
};
|
|
50
|
+
|
|
40
51
|
const close = async (): Promise<void> => {
|
|
41
52
|
isAuth.value = false;
|
|
42
53
|
session.value = undefined;
|
|
@@ -87,6 +98,19 @@ export const useSessionStore = defineStore('session', (): ISessionStore => {
|
|
|
87
98
|
() => currentUserAccount.value?.provider_account?.role === 'member',
|
|
88
99
|
);
|
|
89
100
|
|
|
101
|
+
// Удобные геттеры для различных типов данных
|
|
102
|
+
const userAccount = computed(() => currentUserAccount.value?.user_account);
|
|
103
|
+
const privateAccount = computed(() => currentUserAccount.value?.private_account);
|
|
104
|
+
const blockchainAccount = computed(
|
|
105
|
+
() => currentUserAccount.value?.blockchain_account,
|
|
106
|
+
);
|
|
107
|
+
const participantAccount = computed(
|
|
108
|
+
() => currentUserAccount.value?.participant_account,
|
|
109
|
+
);
|
|
110
|
+
const providerAccount = computed(
|
|
111
|
+
() => currentUserAccount.value?.provider_account,
|
|
112
|
+
);
|
|
113
|
+
|
|
90
114
|
const username = computed(() => globalStore.username);
|
|
91
115
|
|
|
92
116
|
return {
|
|
@@ -98,8 +122,15 @@ export const useSessionStore = defineStore('session', (): ISessionStore => {
|
|
|
98
122
|
loadComplete,
|
|
99
123
|
currentUserAccount,
|
|
100
124
|
setCurrentUserAccount,
|
|
125
|
+
clearAccount,
|
|
101
126
|
isRegistrationComplete,
|
|
102
127
|
isChairman,
|
|
103
128
|
isMember,
|
|
129
|
+
// Удобные геттеры для различных типов данных
|
|
130
|
+
userAccount,
|
|
131
|
+
privateAccount,
|
|
132
|
+
blockchainAccount,
|
|
133
|
+
participantAccount,
|
|
134
|
+
providerAccount,
|
|
104
135
|
};
|
|
105
136
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { client } from 'src/shared/api/client';
|
|
2
|
-
import { Queries } from '@coopenomics/sdk';
|
|
2
|
+
import { Queries, Mutations } from '@coopenomics/sdk';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Получить подписки пользователя у провайдера
|
|
@@ -10,3 +10,37 @@ export async function loadProviderSubscriptions() {
|
|
|
10
10
|
|
|
11
11
|
return subscriptions;
|
|
12
12
|
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Генерирует документ для конвертации в AXON
|
|
16
|
+
*/
|
|
17
|
+
export async function generateConvertToAxonStatement(data: Mutations.Provider.GenerateConvertToAxonStatement.IInput['data'], options?: Mutations.Provider.GenerateConvertToAxonStatement.IInput['options']) {
|
|
18
|
+
const { [Mutations.Provider.GenerateConvertToAxonStatement.name]: generatedDocument } = await client.Mutation(
|
|
19
|
+
Mutations.Provider.GenerateConvertToAxonStatement.mutation,
|
|
20
|
+
{
|
|
21
|
+
variables: {
|
|
22
|
+
data,
|
|
23
|
+
options
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
return generatedDocument;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Обрабатывает подписанный документ конвертации в AXON
|
|
33
|
+
*/
|
|
34
|
+
export async function processConvertToAxonStatement(signedDocument: Mutations.Provider.ProcessConvertToAxonStatement.IInput['signedDocument'], convertAmount: string) {
|
|
35
|
+
const { [Mutations.Provider.ProcessConvertToAxonStatement.name]: result } = await client.Mutation(
|
|
36
|
+
Mutations.Provider.ProcessConvertToAxonStatement.mutation,
|
|
37
|
+
{
|
|
38
|
+
variables: {
|
|
39
|
+
signedDocument,
|
|
40
|
+
convertAmount
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ref, computed } from 'vue';
|
|
2
|
-
import { loadProviderSubscriptions } from '../api';
|
|
2
|
+
import { loadProviderSubscriptions, generateConvertToAxonStatement, processConvertToAxonStatement } from '../api';
|
|
3
3
|
import { useSystemStore } from 'src/entities/System/model';
|
|
4
|
-
import { Queries } from '@coopenomics/sdk';
|
|
4
|
+
import { Queries, Mutations } from '@coopenomics/sdk';
|
|
5
|
+
import { useSignDocument } from 'src/shared/lib/document/model/entity';
|
|
6
|
+
import { SuccessAlert, FailAlert } from 'src/shared/api';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Специфичные данные для подписки на хостинг
|
|
@@ -32,6 +34,12 @@ export function useProviderSubscriptions() {
|
|
|
32
34
|
const isLoading = ref(false);
|
|
33
35
|
const error = ref<string | null>(null);
|
|
34
36
|
|
|
37
|
+
// IP адрес сервера для делегирования домена
|
|
38
|
+
const SERVER_IP = '51.250.114.13';
|
|
39
|
+
|
|
40
|
+
// Курс конвертации AXON в валюту системы (RUB)
|
|
41
|
+
const axonGovernRate = 10; // 1 AXON = 10 RUB
|
|
42
|
+
|
|
35
43
|
// Получить подписку на хостинг (id=1)
|
|
36
44
|
const hostingSubscription = computed(() =>
|
|
37
45
|
subscriptions.value.find(sub => sub.subscription_type_id === 1)
|
|
@@ -104,5 +112,61 @@ export function useProviderSubscriptions() {
|
|
|
104
112
|
instanceStatus,
|
|
105
113
|
loadSubscriptions,
|
|
106
114
|
startAutoRefresh,
|
|
115
|
+
SERVER_IP,
|
|
116
|
+
axonGovernRate,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type IGenerateConvertToAxonStatementInput = Mutations.Provider.GenerateConvertToAxonStatement.IInput['data'];
|
|
121
|
+
export type IGenerateConvertToAxonStatementResult = Mutations.Provider.GenerateConvertToAxonStatement.IOutput[typeof Mutations.Provider.GenerateConvertToAxonStatement.name];
|
|
122
|
+
|
|
123
|
+
export type IProcessConvertToAxonStatementInput = Mutations.Provider.ProcessConvertToAxonStatement.IInput;
|
|
124
|
+
export type IProcessConvertToAxonStatementResult = Mutations.Provider.ProcessConvertToAxonStatement.IOutput[typeof Mutations.Provider.ProcessConvertToAxonStatement.name];
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Composable для конвертации валюты в AXON
|
|
128
|
+
*/
|
|
129
|
+
export function useProviderAxonConvert() {
|
|
130
|
+
const loading = ref(false);
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Конвертирует указанную сумму в AXON
|
|
134
|
+
*/
|
|
135
|
+
const convertToAxon = async (params: {
|
|
136
|
+
convertAmount: string;
|
|
137
|
+
username: string;
|
|
138
|
+
coopname: string;
|
|
139
|
+
}) => {
|
|
140
|
+
try {
|
|
141
|
+
loading.value = true;
|
|
142
|
+
|
|
143
|
+
// Генерируем документ конвертации
|
|
144
|
+
const generatedDocument = await generateConvertToAxonStatement({
|
|
145
|
+
convert_amount: params.convertAmount,
|
|
146
|
+
username: params.username,
|
|
147
|
+
coopname: params.coopname
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// Подписываем документ
|
|
151
|
+
const { signDocument } = useSignDocument();
|
|
152
|
+
const signedDocument = await signDocument(generatedDocument, params.username);
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
// Обрабатываем подписанный документ
|
|
156
|
+
await processConvertToAxonStatement(signedDocument, params.convertAmount);
|
|
157
|
+
|
|
158
|
+
SuccessAlert('Конвертация успешно выполнена');
|
|
159
|
+
return true;
|
|
160
|
+
} catch (error: any) {
|
|
161
|
+
FailAlert(error || 'Не удалось выполнить конвертацию');
|
|
162
|
+
return false;
|
|
163
|
+
} finally {
|
|
164
|
+
loading.value = false;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
return {
|
|
169
|
+
loading,
|
|
170
|
+
convertToAxon
|
|
107
171
|
};
|
|
108
172
|
}
|
|
@@ -9,7 +9,6 @@ import { useGlobalStore } from 'src/shared/store';
|
|
|
9
9
|
import { useSystemStore } from 'src/entities/System/model';
|
|
10
10
|
|
|
11
11
|
import type { IInitialPaymentOrder } from 'src/shared/lib/types/payments';
|
|
12
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
13
12
|
import { useRegistratorStore } from 'src/entities/Registrator';
|
|
14
13
|
import {
|
|
15
14
|
IEntrepreneurData,
|
|
@@ -233,14 +232,13 @@ export function useCreateUser() {
|
|
|
233
232
|
|
|
234
233
|
await sessionStore.init();
|
|
235
234
|
|
|
236
|
-
const currentUser = useCurrentUser();
|
|
237
235
|
const accountStore = useAccountStore();
|
|
238
236
|
// После создания пользователя обновляем данные в сессии
|
|
239
237
|
const updatedAccount = await accountStore.getAccount(account.username);
|
|
240
238
|
if (updatedAccount) {
|
|
241
239
|
console.log('updatedAccount: ', updatedAccount);
|
|
242
240
|
|
|
243
|
-
|
|
241
|
+
sessionStore.setCurrentUserAccount(updatedAccount);
|
|
244
242
|
}
|
|
245
243
|
}
|
|
246
244
|
|
|
@@ -2,7 +2,6 @@ import { useSessionStore } from 'src/entities/Session';
|
|
|
2
2
|
import { useGlobalStore } from 'src/shared/store';
|
|
3
3
|
import { api } from '../api';
|
|
4
4
|
import { client } from 'src/shared/api/client';
|
|
5
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
6
5
|
import { useRegistratorStore } from 'src/entities/Registrator';
|
|
7
6
|
import type { ITokens } from 'src/shared/lib/types/user';
|
|
8
7
|
import { useInitWalletProcess } from 'src/processes/init-wallet';
|
|
@@ -10,7 +9,7 @@ import type { Zeus } from '@coopenomics/sdk';
|
|
|
10
9
|
|
|
11
10
|
export function useLoginUser() {
|
|
12
11
|
const globalStore = useGlobalStore();
|
|
13
|
-
const
|
|
12
|
+
const session = useSessionStore();
|
|
14
13
|
|
|
15
14
|
async function login(email: string, wif: string): Promise<void> {
|
|
16
15
|
const auth = await api.loginUser(email, wif);
|
|
@@ -30,17 +29,15 @@ export function useLoginUser() {
|
|
|
30
29
|
await globalStore.setWif(account.username, wif);
|
|
31
30
|
await globalStore.setTokens(adaptedTokens);
|
|
32
31
|
|
|
33
|
-
const session = useSessionStore();
|
|
34
32
|
await session.init();
|
|
35
33
|
client.setToken(auth.tokens.access.token);
|
|
36
34
|
|
|
37
35
|
const { run } = useInitWalletProcess();
|
|
38
36
|
await run(); //запускаем фоновое обновление кошелька - заменить на подписку потом
|
|
39
|
-
if (!
|
|
37
|
+
if (!session.isRegistrationComplete) {
|
|
40
38
|
const { state, steps } = useRegistratorStore();
|
|
41
|
-
state.userData.type =
|
|
42
|
-
|
|
43
|
-
const privateData = currentUser.privateAccount.value;
|
|
39
|
+
state.userData.type = session?.privateAccount?.type as Zeus.AccountType;
|
|
40
|
+
const privateData = session?.privateAccount;
|
|
44
41
|
|
|
45
42
|
// Для каждого типа пользователя берём нужное поле и, если оно существует, переносим совпадающие ключи
|
|
46
43
|
const dataMap = {
|
|
@@ -59,15 +56,15 @@ export function useLoginUser() {
|
|
|
59
56
|
}
|
|
60
57
|
|
|
61
58
|
//continue registration process here
|
|
62
|
-
state.account.username =
|
|
59
|
+
state.account.username = session.username as string;
|
|
63
60
|
state.account.private_key = wif;
|
|
64
|
-
state.account.public_key =
|
|
61
|
+
state.account.public_key = session.providerAccount
|
|
65
62
|
?.public_key as string;
|
|
66
63
|
|
|
67
|
-
state.email =
|
|
64
|
+
state.email = session.providerAccount?.email as string;
|
|
68
65
|
|
|
69
66
|
// Статус берем из userAccount, не providerAccount
|
|
70
|
-
const userStatus =
|
|
67
|
+
const userStatus = session.userAccount?.status;
|
|
71
68
|
if (userStatus === 'created') state.step = steps.ReadStatement;
|
|
72
69
|
else if (userStatus === 'joined') state.step = steps.PayInitial;
|
|
73
70
|
else if (userStatus === 'payed') state.step = steps.WaitingRegistration;
|
|
@@ -34,7 +34,6 @@ form.full-width(@submit.prevent='submit')
|
|
|
34
34
|
)
|
|
35
35
|
</template>
|
|
36
36
|
<script lang="ts" setup>
|
|
37
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
38
37
|
import { useSessionStore } from 'src/entities/Session';
|
|
39
38
|
import { useLoginUser } from 'src/features/User/LoginUser';
|
|
40
39
|
import { useNotificationPermissionDialog } from 'src/features/NotificationPermissionDialog';
|
|
@@ -49,7 +48,7 @@ const router = useRouter();
|
|
|
49
48
|
const email = ref('');
|
|
50
49
|
const privateKey = ref('');
|
|
51
50
|
const loading = ref(false);
|
|
52
|
-
const
|
|
51
|
+
const session = useSessionStore();
|
|
53
52
|
|
|
54
53
|
// Диалог разрешения уведомлений
|
|
55
54
|
const { showDialog } = useNotificationPermissionDialog();
|
|
@@ -104,13 +103,11 @@ const submit = async () => {
|
|
|
104
103
|
const { login } = useLoginUser();
|
|
105
104
|
await login(email.value, privateKey.value);
|
|
106
105
|
|
|
107
|
-
if (!
|
|
106
|
+
if (!session.isRegistrationComplete) {
|
|
108
107
|
// Если регистрация не завершена, выключаем лоадер и идем на signup
|
|
109
108
|
desktops.setWorkspaceChanging(false);
|
|
110
109
|
router.push({ name: 'signup' });
|
|
111
110
|
} else {
|
|
112
|
-
const session = useSessionStore();
|
|
113
|
-
|
|
114
111
|
// Дожидаемся завершения загрузки данных пользователя (включая роль)
|
|
115
112
|
let attempts = 0;
|
|
116
113
|
const maxAttempts = 50; // 5 секунд максимум
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useSessionStore } from 'src/entities/Session';
|
|
2
2
|
import { useGlobalStore } from 'src/shared/store';
|
|
3
3
|
// import { api } from '../api'
|
|
4
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
5
4
|
import { useRegistratorStore } from 'src/entities/Registrator';
|
|
6
5
|
|
|
7
6
|
export function useLogoutUser() {
|
|
@@ -12,8 +11,9 @@ export function useLogoutUser() {
|
|
|
12
11
|
|
|
13
12
|
await global.logout();
|
|
14
13
|
|
|
15
|
-
useSessionStore()
|
|
16
|
-
|
|
14
|
+
const session = useSessionStore();
|
|
15
|
+
session.close();
|
|
16
|
+
session.clearAccount();
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
return {
|
|
@@ -11,15 +11,13 @@ import { computed } from 'vue';
|
|
|
11
11
|
import { useRouter } from 'vue-router';
|
|
12
12
|
import { useLogoutUser } from '../../model';
|
|
13
13
|
import { FailAlert } from 'src/shared/api';
|
|
14
|
-
import { useCurrentUser } from 'src/entities/Session';
|
|
15
14
|
import { useSessionStore } from 'src/entities/Session';
|
|
16
15
|
|
|
17
16
|
const router = useRouter();
|
|
18
17
|
const session = useSessionStore();
|
|
19
|
-
const currentUser = useCurrentUser();
|
|
20
18
|
|
|
21
19
|
const loggedIn = computed(
|
|
22
|
-
() =>
|
|
20
|
+
() => session.isRegistrationComplete && session.isAuth,
|
|
23
21
|
);
|
|
24
22
|
|
|
25
23
|
const logout = async () => {
|
|
@@ -3,7 +3,7 @@ q-card(flat)
|
|
|
3
3
|
QuestionsTable(
|
|
4
4
|
:decisions='decisions',
|
|
5
5
|
:loading='loading',
|
|
6
|
-
:isChairman='
|
|
6
|
+
:isChairman='session.isChairman',
|
|
7
7
|
:format-decision-title='formatDecisionTitle',
|
|
8
8
|
:is-voted-for='isVotedFor',
|
|
9
9
|
:is-voted-against='isVotedAgainst',
|
|
@@ -18,7 +18,7 @@ q-card(flat)
|
|
|
18
18
|
<script setup lang="ts">
|
|
19
19
|
import { onBeforeUnmount, computed, ref, onMounted } from 'vue';
|
|
20
20
|
import { useRoute } from 'vue-router';
|
|
21
|
-
import {
|
|
21
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
22
22
|
import { CreateProjectButton } from 'src/features/Decision/CreateProject';
|
|
23
23
|
import { useDecisionProcessor } from 'src/processes/process-decisions';
|
|
24
24
|
import { FailAlert, SuccessAlert } from 'src/shared/api';
|
|
@@ -26,7 +26,8 @@ import { QuestionsTable } from 'src/widgets/Questions';
|
|
|
26
26
|
import { useHeaderActions } from 'src/shared/hooks';
|
|
27
27
|
|
|
28
28
|
const route = useRoute();
|
|
29
|
-
const
|
|
29
|
+
const session = useSessionStore();
|
|
30
|
+
|
|
30
31
|
const processingDecisions = ref<Record<number, boolean>>({});
|
|
31
32
|
|
|
32
33
|
// Инжектим кнопку создания решения в заголовок
|
|
@@ -14,7 +14,7 @@ import { useRoute } from 'vue-router';
|
|
|
14
14
|
import { MeetCardsList } from 'src/widgets/Meets/MeetCardsList';
|
|
15
15
|
import { CreateMeetButton } from 'src/features/Meet/CreateMeet';
|
|
16
16
|
import { useMeetStore } from 'src/entities/Meet';
|
|
17
|
-
import {
|
|
17
|
+
import { useSessionStore } from 'src/entities/Session';
|
|
18
18
|
import { useHeaderActions } from 'src/shared/hooks';
|
|
19
19
|
import { FailAlert } from 'src/shared/api';
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ const route = useRoute();
|
|
|
22
22
|
const coopname = computed(() => route.params.coopname as string);
|
|
23
23
|
const meetStore = useMeetStore();
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const session = useSessionStore();
|
|
26
26
|
|
|
27
27
|
// Данные напрямую из стора
|
|
28
28
|
const meets = computed(() => meetStore.meets);
|
|
@@ -45,7 +45,7 @@ const loadMeets = async () => {
|
|
|
45
45
|
|
|
46
46
|
// Проверка разрешений
|
|
47
47
|
const canCreateMeet = computed(() => {
|
|
48
|
-
return
|
|
48
|
+
return session.isMember || session.isChairman;
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
// Функция для регистрации кнопки
|
|
@@ -55,7 +55,7 @@ const registerCreateMeetButton = () => {
|
|
|
55
55
|
id: CREATE_MEET_BUTTON_ID,
|
|
56
56
|
component: CreateMeetButton,
|
|
57
57
|
props: {
|
|
58
|
-
isChairman:
|
|
58
|
+
isChairman: session.isChairman,
|
|
59
59
|
},
|
|
60
60
|
order: 1,
|
|
61
61
|
});
|