Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update prod #634

Merged
merged 10 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1208,6 +1208,9 @@ type Workspace {
"""True if workspace is used for debugging"""
isDebug: Boolean

"""True if workspace is blocked"""
isBlocked: Boolean

"""Workspace projects array"""
projects(
"""Project(s) id(s)"""
Expand Down
3 changes: 3 additions & 0 deletions src/api/workspaces/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const QUERY_ALL_WORKSPACES_WITH_PROJECTS = `
subscriptionId
lastChargeDate
isDebug
isBlocked
inviteHash
...WorkspaceWithTeam
...WorkspacePlan
Expand Down Expand Up @@ -157,6 +158,8 @@ export const QUERY_WORKSPACES = `
image
subscriptionId
lastChargeDate
isDebug
isBlocked
inviteHash
billingPeriodEventsCount
...WorkspacePlan
Expand Down
4 changes: 2 additions & 2 deletions src/components/modals/ChooseTariffPlanPopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export default Vue.extend({
data: {
workspaceId: this.workspaceId,
tariffPlanId: this.selectedPlan.id,
isRecurrent: !!this.workspace.subscriptionId,
isRecurrent: true,
},
});

Expand All @@ -201,7 +201,7 @@ export default Vue.extend({
data: {
workspaceId: this.workspaceId,
tariffPlanId: this.selectedPlan.id,
isRecurrent: !!this.workspace.subscriptionId,
isRecurrent: true,
},
});
},
Expand Down
19 changes: 9 additions & 10 deletions src/components/modals/PaymentDetailsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@
tag="div"
:path="isRecurrent ? 'billing.autoProlongation.description' : 'billing.paymentDetails.description'"
class="payment-details__description"
>
<a
class="link link--underlined"
href="https://docs.hawk.so/payments"
rel="noreferrer noopener"
target="_blank"
>{{ $t('billing.pricingAndPayments') }}</a>
</i18n>
/>

<!--Details-->
<div class="payment-details__details">
Expand Down Expand Up @@ -325,7 +318,7 @@ export default Vue.extend({
const newCardOption: CustomSelectOption = {
id: NEW_CARD_ID,
value: NEW_CARD_ID,
name: 'New card',
name: this.$t('billing.paymentDetails.newCard') as string
};

if (!cards) {
Expand Down Expand Up @@ -370,7 +363,13 @@ export default Vue.extend({
planDueDate(): Date {
const lastChargeDate = new Date(this.workspace.lastChargeDate);

return new Date(lastChargeDate.setMonth(lastChargeDate.getMonth() + 1));
if (this.workspace.isDebug) {
lastChargeDate.setDate(lastChargeDate.getDate() + 1);
} else {
lastChargeDate.setMonth(lastChargeDate.getMonth() + 1);
}

return new Date(lastChargeDate);
},

/**
Expand Down
1 change: 0 additions & 1 deletion src/components/modals/WorkspaceCreationDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ export default {
<style>
.workspace-creation-dialog {
max-width: 500px;
max-height: 300px;
padding: 30px;

&__header {
Expand Down
105 changes: 62 additions & 43 deletions src/components/workspace/settings/BillingOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ import UiButton from './../../utils/UiButton.vue';
import Icon from '../../utils/Icon.vue';
import { Plan } from '../../../types/plan';
import { Button } from '../../../types/button';
import PositiveButton from '../../utils/PostivieButton.vue';
// import PositiveButton from '../../utils/PostivieButton.vue';
import notifier from 'codex-notifier';
import { CANCEL_SUBSCRIPTION } from '../../../store/modules/workspaces/actionTypes';
import { FETCH_PLANS } from '../../../store/modules/plans/actionTypes';
Expand Down Expand Up @@ -175,6 +175,21 @@ export default Vue.extend({
});
},
},
/**
* `Increment Event Limit` secondary button
*/
incrementEventsLimitSecondary: {
label: this.$i18n.t('billing.buttons.incrementEventsLimit') as string,
style: 'secondary',
onClick: () => {
this.$store.dispatch(SET_MODAL_DIALOG, {
component: 'ChooseTariffPlanPopup',
data: {
workspaceId: this.workspace.id,
},
});
},
},
/**
* `Enable Auto Payment` button
*/
Expand Down Expand Up @@ -222,7 +237,34 @@ export default Vue.extend({
plan(): Plan {
return this.workspace.plan;
},
/**
* Minimal plan price
*/
minPlanPrice(): number {
const plans = this.$store.state.plans.list;
const plansPrices = plans.map(plan => plan.monthlyCharge).filter(price => price !== 0);

return Math.min(...plansPrices);
},
/**
* `Increment Event Limit from` button
*/
incrementEventsLimitWithPrice(): Button {
return {
label: this.$i18n.t('billing.buttons.incrementEventsLimitWithPrice', {
price: this.minPlanPrice + ' ' + this.planCurrencySign
}) as string,
style: 'primary',
onClick: () => {
this.$store.dispatch(SET_MODAL_DIALOG, {
component: 'ChooseTariffPlanPopup',
data: {
workspaceId: this.workspace.id,
},
});
},
}
},
/**
* Return currency sign depending on plan currency
*/
Expand All @@ -236,47 +278,32 @@ export default Vue.extend({
return this.workspace.billingPeriodEventsCount || 0;
},
/**
* Return buttons list depended on workspace state
* Returns buttons list depended on workspace state
*/
buttons(): Button[] {
const buttonsList: Button[] = [];

/**
* if plan is `Startup` then return `Increment Events Limit` button
*/
if (this.isFreePlan) {
return [ this.incrementEventsLimit ];
return [ this.incrementEventsLimitWithPrice ];
}

if (this.isBLocked) {
return [
this.incrementEventsLimit,
this.prolongateCurrentPlan
];
}

/**
* If autopay is off we necessary return `Enable Auto Payment` button
*/
if (!this.isAutoPayOn) {
buttonsList.push(this.enableAutoPayment);

/**
* If subscription is expired then return `Prolongate Current Plan` button
*/
if (this.isSubExpired) {
buttonsList.push(this.prolongateCurrentPlan);

return buttonsList;
}
return [
this.enableAutoPayment,
this.incrementEventsLimitSecondary
];
}

/**
* if autopay is off and events limit is exceeded then return `Increment Events Limit`
*/
if (this.isEventsLimitExceeded) {
return [ this.incrementEventsLimit ];
}
} else if (this.isEventsLimitExceeded) {
/**
* If autopay is on and events limit is exceeded then return `Increment Events Limit`
*/
return [ this.incrementEventsLimit ];
if (this.isAutoPayOn) {
return [ this.incrementEventsLimit ]
}

return buttonsList;
return []
},
/**
* Checking the volume spent
Expand All @@ -296,7 +323,7 @@ export default Vue.extend({
subExpiredDate(): Date {
const expiredDate: Date = new Date(this.workspace.lastChargeDate);

expiredDate.setDate(expiredDate.getDate() + NUMBER_OF_DAYS_OF_TARIFF_PLAN);
expiredDate.setDate(expiredDate.getDate() + (this.workspace.isDebug ? 1 : NUMBER_OF_DAYS_OF_TARIFF_PLAN));

return expiredDate;
},
Expand Down Expand Up @@ -330,15 +357,7 @@ export default Vue.extend({
* Return true if workspaces is blocked
*/
isBLocked(): boolean {
if (this.isAutoPayOn) {
return this.isEventsLimitExceeded;
}

if (this.isFreePlan) {
return this.isEventsLimitExceeded;
} else {
return this.isEventsLimitExceeded || this.isSubExpired;
}
return this.workspace.isBlocked;
},
},
/**
Expand Down
8 changes: 5 additions & 3 deletions src/i18n/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@
}
},
"buttons": {
"incrementEventsLimitWithPrice": "Increment limit from {price}",
"incrementEventsLimit": "Increment events limit",
"enableAutoPayment": "Enable auto payment",
"prolongateCurrentPlan": "Prolongate current plan"
Expand Down Expand Up @@ -359,11 +360,12 @@
"didNotAcceptChargingEveryMonth": "You need allow charges from your bank card every month to proceed with payment",
"allowCardSaving": "Save card for future payments",
"goToPaymentService": "Go to payment service",
"payWithSelectedCard": "Pay with selected card"
"payWithSelectedCard": "Pay with selected card",
"newCard": "New card"
},
"autoProlongation": {
"title": "Auto prolongation",
"description": "You are about to subscribe for auto prolongation of the current plan of the workspace. That means that when the next payment date has come, the plan price will be automatically charged from your card. Read more about {0}.",
"title": "Subscription",
"description": "You are about to subscribe for paid tariff plan. That means that when the next payment date comes, the plan price will be automatically charged from your card.",
"theNextPaymentDateTitle": "The next payment date",
"acceptRecurrentPaymentAgreement": "I understand and accept the recurrent payments agreement",
"allowingChargesEveryMonth": "I allow charges from my bank card every month",
Expand Down
10 changes: 6 additions & 4 deletions src/i18n/messages/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
"workspaces": {
"chooseTariffPlanDialog": {
"title": "Выберите план",
"description": "Все тарифные планы включают в себя все <a href=\"{featuresUrl}\">возможности</a> сервиса. Если у вас возникли вопросы по тарифной сетке, напишите нам&nbsp;на&nbsp;<a href=\"mailto:[email protected]\">[email protected]</a>",
"description": "Все тарифные планы включают в себя все возможности сервиса. Если у вас возникли вопросы по тарифной сетке, напишите нам&nbsp;на&nbsp;<a href=\"mailto:[email protected]\">[email protected]</a>",
"onSuccess": "Тарифный план был успешно изменён",
"onError": "Произошла ошибка, пожалуйста попробуйте ещё раз немного позже",
"confirmSetToFreePlanDescription": "Старый план будет отменён. Деньги за неиспользованные ошибки и время не будут возвращены.",
Expand Down Expand Up @@ -326,6 +326,7 @@
}
},
"buttons": {
"incrementEventsLimitWithPrice": "Увеличить лимит от {price}",
"incrementEventsLimit": "Увеличить лимит событий",
"enableAutoPayment": "Включить автоплатеж",
"prolongateCurrentPlan": "Продлить текущий план"
Expand Down Expand Up @@ -359,11 +360,12 @@
"didNotAcceptChargingEveryMonth": "Подтвердите согласие на ежемесячные списания",
"allowCardSaving": "Сохранить карту для будущих платежей",
"goToPaymentService": "Перейти к оплате",
"payWithSelectedCard": "Оплатить с выбранной карты"
"payWithSelectedCard": "Оплатить с выбранной карты",
"newCard": "Новая карта"
},
"autoProlongation": {
"title": "Автоматическое продление",
"description": "Вы собираетесь подписаться на автоматическое продление текущего плана воркспейса. Это означает, что при наступлении следующей даты платежа стоимость плана будет автоматически списана с вашей карты. Подробнее читайте в {0}.",
"title": "Оформление подписки",
"description": "Вы собираетесь оформить подписку на платный тарифный план. Это означает, что при наступлении следующей даты платежа стоимость плана будет автоматически списана с вашей карты.",
"theNextPaymentDateTitle": "Дата следующего списания",
"acceptRecurrentPaymentAgreement": "Я понимаю и принимаю соглашение об автоматических платежах",
"allowingChargesEveryMonth": "Я разрешаю ежемесячные списания с моей банковской карты",
Expand Down
3 changes: 3 additions & 0 deletions src/types/workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ export interface Workspace {

/** True if workspace is used for debugging */
isDebug?: boolean;

/** True if workspace is blocked */
isBlocked?: boolean;
}

/**
Expand Down
Loading