Skip to content

Commit 12dc0ba

Browse files
Dv 3380 (#12)
* dv-3380 * dv-3380
1 parent 512ac2d commit 12dc0ba

File tree

24 files changed

+434
-380
lines changed

24 files changed

+434
-380
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## [Unreleased]
44

5+
- Payment form design changes DV-3380
6+
- Added notification settings in the store DV-3383
57
- Changed the receipt screen in the payment form DV-3364
68
- Added icons of new coins DV-3348
79

apps/dv-admin/src/services/api/projects.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type {
33
IStoreApiKeyResponse,
44
IStoreRequest,
55
IStoreResponse,
6+
IStoreSettingsResponse,
67
IStoreWebhooksResponse,
78
IStoreWebhookTestRequest,
89
IStoreWebhookTestResponse
@@ -94,3 +95,13 @@ export const getApiCurrenciesProject = async (uuid: string): Promise<BlockchainT
9495
export const putApiCurrenciesProject = async (uuid: string, body: ICurrencyRequest) => {
9596
await api.put(`/dv-admin/store/${uuid}/currencies`, body);
9697
};
98+
99+
export const getApiStoreSettingList = async (uuid: string): Promise<IStoreSettingsResponse[]> => {
100+
const resp = await api.get(`/dv-admin/store-setting/list/${uuid}`);
101+
return resp.data.data;
102+
};
103+
104+
export const postApiStoreSetting = async (uuid: string, body: { name: string, value: string }) => {
105+
await api.post(`/dv-admin/store-setting/${uuid}`, body);
106+
};
107+

apps/dv-admin/src/stores/projects/index.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@ import {
44
getApiProjects,
55
getApiStoreArchivedList,
66
getApiStoreSecret,
7+
getApiStoreSettingList,
78
postApiStoreArchive,
89
postApiStoreSecret,
910
postApiStoreUnarchive,
1011
putApiOneProject
1112
} from "@dv-admin/services/api/projects";
12-
import type { ICurrencyStore, IStoreResponse } from "@dv-admin/utils/types/api/apiGo";
13+
import type {
14+
ICurrencyStore,
15+
IStoreResponse,
16+
IStoreSettingsList,
17+
} from "@dv-admin/utils/types/api/apiGo";
1318
import { useNotifications } from "@shared/utils/composables/useNotifications";
1419
import { defineStore, storeToRefs } from "pinia";
1520
import { ref } from "vue";
@@ -42,6 +47,7 @@ export const useProjectsStore = defineStore("projects", () => {
4247
const selectAllCurrenciesProject = ref<boolean>(false);
4348
const selectedProject = ref<string | null>(null);
4449
const archivedProjects = ref<IStoreResponse[]>([]);
50+
const storeSettingList = ref<IStoreSettingsList[]>([]);
4551

4652
// CRUD for project information
4753
const getProjects = async () => {
@@ -97,7 +103,9 @@ export const useProjectsStore = defineStore("projects", () => {
97103
getOneProjects(uuid),
98104
getKeyProject(uuid),
99105
getWebhooksProject(uuid),
100-
getStoreSecret(uuid)
106+
getStoreSecret(uuid),
107+
getStoreSettingList(uuid),
108+
// postApiStoreSetting(uuid, { name: "external_wallet_email_notification", value: "disabled" }),
101109
]);
102110
} catch (error: any) {
103111
throw error;
@@ -113,6 +121,16 @@ export const useProjectsStore = defineStore("projects", () => {
113121
throw error;
114122
}
115123
};
124+
const getStoreSettingList = async (uuid: string) => {
125+
try {
126+
const data = await getApiStoreSettingList(uuid);
127+
if (data) {
128+
storeSettingList.value = data.map(item => ({ ...item, value: item.value === "enabled" }));
129+
}
130+
} catch (error: any) {
131+
throw error;
132+
}
133+
};
116134
const postStoreSecret = async (uuid: string, message: string) => {
117135
try {
118136
isLoadingGenerateSecretKey.value = true;
@@ -192,6 +210,7 @@ export const useProjectsStore = defineStore("projects", () => {
192210
archivedProjects,
193211
checkedCurrenciesProject,
194212
selectAllCurrenciesProject,
213+
storeSettingList,
195214

196215
postStoreSecret,
197216
postStoreArchive,
@@ -200,6 +219,7 @@ export const useProjectsStore = defineStore("projects", () => {
200219
getProjects,
201220
getAllInfoProjects,
202221
getOneProjects,
222+
getStoreSettingList,
203223
putOneProject,
204224
getCurrenciesProject,
205225
resetCurrentProject
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const STORE_SETTING_LABELS: Record<string, string> = {
2+
user_crypto_receipt_email_notification: "Sending a check",
3+
external_wallet_email_notification: "Sending a letter with wallets",
4+
};
5+
6+
export const STORE_SETTING_TOOLTIPS: Record<string, string> = {
7+
user_crypto_receipt_email_notification: "After payment, the user will be sent a receipt by email",
8+
external_wallet_email_notification: "After the user has selected the currency and chain on the payment form, an email with a list of wallets will be sent to them",
9+
};

apps/dv-admin/src/utils/plugins/i18n/locales/en.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
"h": "h",
55
"s": "s"
66
},
7-
"You do not have any wallets specified in the withdrawal rules": "You do not have any wallets specified in the withdrawal rules",
7+
"Configuration": "Configuration",
8+
"Sending a check": "Sending a check",
9+
"Sending a letter with wallets": "Sending a letter with wallets",
10+
"After payment, the user will be sent a receipt by email": "After payment, the user will be sent a receipt by email",
11+
"After the user has selected the currency and chain on the payment form, an email with a list of wallets will be sent to them": "After the user has selected the currency and chain on the payment form, an email with a list of wallets will be sent to them",
12+
"You do not have any wallets specified in the withdrawal rules": "You do not have any wallets specified in the withdrawal rules",
813
"Add addresses to withdrawal rules": "Add addresses to withdrawal rules",
914
"Remove address from address book and withdrawal rules": "Remove address from address book and withdrawal rules",
1015
"Delete address from address book only": "Delete address from address book only",

apps/dv-admin/src/utils/plugins/i18n/locales/ru.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
"h": "ч",
55
"s": "сек"
66
},
7+
"Configuration": "Конфигурация",
8+
"Sending a check": "Отправка чека",
9+
"Sending a letter with wallets": "Отправка письма с кошельками",
10+
"After payment, the user will be sent a receipt by email": "После оплаты, пользователю будет отправлен чек на почту",
11+
"After the user has selected the currency and chain on the payment form, an email with a list of wallets will be sent to them": "После того, как пользователь на платежной форме выбрал валюту и блокчейн, ему на почту будет отправлено письмо со списком кошельков",
712
"You do not have any wallets specified in the withdrawal rules": "У вас не задан ни один кошелек в правилах вывода",
813
"Add addresses to withdrawal rules": "Добавить адреса в правила вывода",
914
"Remove address from address book and withdrawal rules": "Удалить адрес из адресной книги и правил вывода",

apps/dv-admin/src/utils/types/api/apiGo.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,19 @@ export interface IStoreApiKeyResponse {
109109
created_at: string | null;
110110
}
111111

112+
export interface IStoreGeneralSettingsList {
113+
name: string
114+
is_editable: boolean
115+
two_factor_verification_required: boolean
116+
available_values: string[]
117+
}
118+
export interface IStoreSettingsResponse extends IStoreGeneralSettingsList {
119+
value: string
120+
}
121+
export interface IStoreSettingsList extends IStoreGeneralSettingsList {
122+
value: boolean
123+
}
124+
112125
export interface IStoreWebhooksResponse {
113126
id?: string;
114127
label: string;

apps/dv-admin/src/views/projects/edit/advancedSettings/AdvancedSettingsView.vue

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,20 @@
1616
import TooltipHelper from "@dv-admin/components/ui/tooltipHelper/TooltipHelper.vue";
1717
import { computed, ref } from "vue";
1818
import { useI18n } from "vue-i18n";
19-
import { putApiCurrenciesProject } from "@dv-admin/services/api/projects.ts";
19+
import { postApiStoreSetting, putApiCurrenciesProject } from "@dv-admin/services/api/projects.ts";
2020
import { useGeneralStore } from "@dv-admin/stores/general";
2121
import { UiForm } from "@dv.net/ui-kit";
2222
import type { UiFormRules } from "@dv.net/ui-kit/dist/components/UiForm/types";
2323
import { isValidUrl } from "@shared/utils/helpers/general.ts";
24+
import { STORE_SETTING_LABELS, STORE_SETTING_TOOLTIPS } from "@dv-admin/utils/constants/projects";
2425
2526
const {
2627
currentProject,
2728
currenciesProject,
2829
isLoadingEditProject,
2930
checkedCurrenciesProject,
30-
selectAllCurrenciesProject
31+
selectAllCurrenciesProject,
32+
storeSettingList
3133
} = storeToRefs(useProjectsStore());
3234
const { dictionary } = storeToRefs(useGeneralStore());
3335
const { putOneProject, getCurrenciesProject } = useProjectsStore();
@@ -82,6 +84,10 @@
8284
if (!currentProject.value) return;
8385
if (!formRef.value || !(await formRef.value.validate())) return;
8486
await putApiCurrenciesProject(uuid, { currency_ids: checkedCurrenciesProject.value });
87+
await Promise.all(
88+
storeSettingList.value
89+
.map(({ name, value }) => postApiStoreSetting(uuid, { name, value: value ? "enabled" : "disabled" }))
90+
)
8591
await putOneProject(t("The project has been saved"));
8692
await getCurrenciesProject(uuid);
8793
};
@@ -129,13 +135,26 @@
129135
</div>
130136
</block-section>
131137
<block-section class="store" mode="grey">
132-
<div class="row">
133-
<h4 class="row__title">{{ $t("Store status") }}</h4>
134-
<div class="row__actions">
135-
<p class="row__actions-text">
136-
{{ $t("When you turn off a store, you also stop accepting payments for all invoices for that store") }}
137-
</p>
138-
<ui-switch v-model="currentProject.status" :text="$t('Store enabled')" />
138+
<div class="configuration">
139+
<h2 class="global-title-h3">{{ $t("Configuration") }}</h2>
140+
<div class="configuration__list">
141+
<div class="configuration__item">
142+
<ui-switch v-model="currentProject.status" :text="$t('Store status')" />
143+
<tooltip-helper
144+
:title="$t('Store status')"
145+
:text="$t('When you turn off a store, you also stop accepting payments for all invoices for that store')"
146+
/>
147+
</div>
148+
<div v-for="item in storeSettingList" :key="item.name" class="configuration__item">
149+
<ui-switch
150+
v-model="item.value"
151+
:text="item.name in STORE_SETTING_LABELS ? $t(STORE_SETTING_LABELS[item.name]) : item.name"
152+
/>
153+
<tooltip-helper
154+
:title="item.name in STORE_SETTING_LABELS ? $t(STORE_SETTING_LABELS[item.name]) : item.name"
155+
:text="item.name in STORE_SETTING_TOOLTIPS ? $t(STORE_SETTING_TOOLTIPS[item.name]) : item.name"
156+
/>
157+
</div>
139158
</div>
140159
</div>
141160
<div class="row" v-if="currenciesProject?.length">
@@ -303,5 +322,30 @@
303322
}
304323
}
305324
}
325+
.configuration {
326+
display: flex;
327+
flex-direction: column;
328+
gap: 16px;
329+
border-bottom: 1px solid #e1e8f1;
330+
padding-bottom: 24px;
331+
&__list {
332+
display: flex;
333+
align-items: center;
334+
gap: 24px;
335+
}
336+
&__item {
337+
display: flex;
338+
align-items: center;
339+
gap: 8px;
340+
padding-right: 24px;
341+
border-right: 1px solid $grey;
342+
&:deep(.ui-switch__label) > p {
343+
font-size: 14px;
344+
}
345+
&:last-child {
346+
border-right: unset;
347+
}
348+
}
349+
}
306350
}
307351
</style>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<template>
2+
<div class="loader"></div>
3+
</template>
4+
5+
<style scoped lang="scss">
6+
.loader {
7+
width: 44px;
8+
aspect-ratio: 1;
9+
display: grid;
10+
border-radius: 50%;
11+
background:
12+
linear-gradient(0deg ,rgb(0 0 0/50%) 30%,#0000 0 70%,rgb(0 0 0/100%) 0) 50%/8% 100%,
13+
linear-gradient(90deg,rgb(0 0 0/25%) 30%,#0000 0 70%,rgb(0 0 0/75% ) 0) 50%/100% 8%;
14+
background-repeat: no-repeat;
15+
animation: l23 1s infinite steps(12);
16+
@include mediamax(480) {
17+
width: 32px;
18+
}
19+
}
20+
.loader::before,
21+
.loader::after {
22+
content: "";
23+
grid-area: 1/1;
24+
border-radius: 50%;
25+
background: inherit;
26+
opacity: 0.915;
27+
transform: rotate(30deg);
28+
}
29+
.loader::after {
30+
opacity: 0.83;
31+
transform: rotate(60deg);
32+
}
33+
@keyframes l23 {
34+
100% {transform: rotate(1turn)}
35+
}
36+
</style>
37+
<script setup lang="ts">
38+
</script>

apps/pay/src/components/ui/loaderDollar/LoaderDollar.vue

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)