Merge branch 'dev' into 'staging'

Dev

See merge request frontend/squiz!261
This commit is contained in:
Nastya 2024-04-13 22:34:42 +00:00
commit 4ff60c5402
5 changed files with 50 additions and 10 deletions

@ -6,7 +6,7 @@
"@craco/craco": "^7.0.0",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@frontend/kitui": "^1.0.74",
"@frontend/kitui": "^1.0.78",
"@frontend/squzanswerer": "^1.0.22",
"@mui/icons-material": "^5.10.14",
"@mui/material": "^5.10.14",

@ -15,6 +15,7 @@ export async function activatePromocode(promocode: string) {
contentType: true,
body: { codeword: promocode },
});
console.log(response)
return response.greetings;
} catch (nativeError) {

@ -174,11 +174,19 @@ function TariffPage() {
return tariff.privileges[0].privilegeId !== "squizHideBadge";
});
function handleApplyPromocode() {
function handleApplyPromocode () {
if (!promocodeField) return;
activatePromocode(promocodeField)
.then(enqueueSnackbar)
.then(async (greetings) => {
enqueueSnackbar(greetings)
const discounts = await makeRequest({
method: "GET",
url: `${process.env.REACT_APP_DOMAIN}/price/discount/user/${userId}`,
});
setDiscounts(discounts.Discounts);
})
.catch(enqueueSnackbar);
}

@ -12,16 +12,47 @@ export const createTariffElements = (
discounts: any,
onclick: any,
) => {
console.log("я карточка и я получила скидки ", discounts)
calcTariffPrice(
{
"_id": "6606f2241747c1eea800bb67",
"name": "1 месяц",
"description": "Скрытие логотипа \"Pena\" во всех quiz на 1 месяц",
"price": 0,
"order": 0,
"isCustom": false,
"privileges": [
{
"name": "Скрытие шильдика в опроснике",
"privilegeId": "squizHideBadge",
"serviceKey": "squiz",
"description": "Количество дней скрытия шильдика в опроснике",
"type": "day",
"value": "день",
"price": 16700,
"amount": 30
}
],
"isDeleted": false,
"createdAt": "2024-03-29T16:53:56.191Z",
"updatedAt": "2024-03-29T16:53:56.191Z"
},
discounts,
user.wallet.spent,
[],
false,
user.id,
)
const tariffElements = filteredTariffs
.filter((tariff) => tariff.privileges.length > 0)
.map((tariff, index) => {
const { priceBeforeDiscounts, priceAfterDiscounts } = calcTariffPrice(
tariff,
discounts,
user.wallet.spent,
2752015,
[],
user.isUserNko,
user.id,
false,
"661970ac059f40a30ab24c92",
);
return (

@ -1509,10 +1509,10 @@
resolved "https://registry.yarnpkg.com/@floating-ui/utils/-/utils-0.2.1.tgz#16308cea045f0fc777b6ff20a9f25474dd8293d2"
integrity sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q==
"@frontend/kitui@^1.0.74":
version "1.0.74"
resolved "https://penahub.gitlab.yandexcloud.net/api/v4/projects/21/packages/npm/@frontend/kitui/-/@frontend/kitui-1.0.74.tgz#de486f2a2f053f1f94e874917d6ff4904c4e4f15"
integrity sha1-3khvKi8FPx+U6HSRfW/0kExOTxU=
"@frontend/kitui@^1.0.78":
version "1.0.78"
resolved "https://penahub.gitlab.yandexcloud.net/api/v4/projects/21/packages/npm/@frontend/kitui/-/@frontend/kitui-1.0.78.tgz#ccc75cbd93dd8ae4f31e362d40c5569ef0c36c68"
integrity sha1-zMdcvZPdiuTzHjYtQMVWnvDDbGg=
dependencies:
immer "^10.0.2"
reconnecting-eventsource "^1.6.2"