Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: update subscription and trialing banner (#1524)

ecmadaoa3a3361f233e
diff --git a/frontend/src/components/PricingTable.vue b/frontend/src/components/PricingTable.vue
index 220abb2c70..7a4a89d47f 100644
--- a/frontend/src/components/PricingTable.vue
+++ b/frontend/src/components/PricingTable.vue
@@ -54,12 +54,18 @@
plan.highlight
? 'border-indigo-500 text-white bg-indigo-500 hover:bg-indigo-600 hover:border-indigo-600'
: 'border-accent text-accent hover:bg-accent',
- 'mt-8 block w-full border rounded-md py-2 lg:py-4 text-sm md:text-base font-semibold text-center hover:text-white whitespace-nowrap overflow-hidden',
+ 'mt-8 block w-full border rounded-md py-2 lg:py-4 text-sm md:text-xl font-semibold text-center hover:text-white whitespace-nowrap overflow-hidden',
]"
@click="onButtonClick(plan)"
>
{{ plan.buttonText }}
</button>
+ <div
+ v-if="canTrial && plan.trialDays"
+ class="font-bold text-sm my-2 text-center"
+ >
+ {{ $t("subscription.free-trial") }}
+ </div>
</div>
</td>
</tr>
@@ -145,7 +151,7 @@
<td v-for="plan in plans" :key="plan.type" class="pt-5 px-6">
<button
v-if="!plan.isFreePlan"
- class="block w-full py-4 bg-gray-800 border border-gray-800 rounded-md py-2 text-sm font-semibold text-white text-center hover:bg-gray-900"
+ class="block w-full bg-gray-800 border border-gray-800 rounded-md py-2 text-lg font-semibold text-white text-center hover:bg-gray-900"
@click="onButtonClick(plan)"
>
{{ plan.buttonText }}
@@ -193,12 +199,18 @@
plan.highlight
? 'border-indigo-500 text-white bg-indigo-500 hover:bg-indigo-600 hover:border-indigo-600'
: 'border-accent text-accent hover:bg-accent',
- 'mt-8 block w-full border rounded-md py-4 text-base font-semibold text-center hover:text-white whitespace-nowrap overflow-hidden',
+ 'mt-8 block w-full border rounded-md py-4 font-semibold text-center text-xl hover:text-white whitespace-nowrap overflow-hidden',
]"
@click="onButtonClick(plan)"
>
{{ plan.buttonText }}
</button>
+ <div
+ v-if="canTrial && plan.trialDays"
+ class="font-bold text-sm my-2 text-center"
+ >
+ {{ $t("subscription.free-trial") }}
+ </div>
<div v-if="plan.isAvailable" class="px-4 py-8 text-right text-gray-500">
<i18n-t keypath="subscription.announcement">
@@ -282,7 +294,7 @@
plan.highlight
? 'border-indigo-500 text-white bg-indigo-500 hover:bg-indigo-600 hover:border-indigo-600'
: 'border-accent text-accent hover:bg-accent',
- 'mt-8 block w-full border rounded-md py-4 text-base font-semibold text-center hover:text-white whitespace-nowrap overflow-hidden',
+ 'mt-8 block w-full border rounded-md py-4 text-lg font-semibold text-center hover:text-white whitespace-nowrap overflow-hidden',
]"
@click="onButtonClick(plan)"
>
@@ -293,10 +305,9 @@
</template>
<script lang="ts">
-import { reactive, computed, watch, PropType, defineComponent } from "vue";
+import { reactive, computed, watch, defineComponent } from "vue";
import {
Plan,
- Subscription,
PlanType,
FEATURE_SECTIONS,
FREE_PLAN,
@@ -304,6 +315,7 @@ import {
ENTERPRISE_PLAN,
} from "../types";
import { useI18n } from "vue-i18n";
+import { useSubscriptionStore } from "@/store";
interface LocalState {
isMonthly: boolean;
@@ -313,7 +325,6 @@ interface LocalState {
interface LocalPlan extends Plan {
label: string;
image: string;
- price: string;
buttonText: string;
highlight: boolean;
isFreePlan: boolean;
@@ -324,22 +335,17 @@ const minimumInstanceCount = 5;
export default defineComponent({
name: "PricingTable",
- props: {
- subscription: {
- required: false,
- default: undefined,
- type: Object as PropType<Subscription>,
- },
- },
- setup(props) {
+ setup() {
const { t } = useI18n();
+ const subscriptionStore = useSubscriptionStore();
const state = reactive<LocalState>({
isMonthly: false,
- instanceCount: props.subscription?.instanceCount ?? minimumInstanceCount,
+ instanceCount:
+ subscriptionStore.subscription?.instanceCount ?? minimumInstanceCount,
});
watch(
- () => props.subscription,
+ () => subscriptionStore.subscription,
(val) =>
(state.instanceCount = val?.instanceCount ?? minimumInstanceCount)
);
@@ -364,10 +370,6 @@ export default defineComponent({
`../assets/plan-${plan.title.toLowerCase()}.png`,
import.meta.url
).href,
- price:
- plan.type === PlanType.ENTERPRISE
- ? t("subscription.contact-us")
- : t("subscription.price", { price: getPlanPrice(plan) }),
buttonText: getButtonText(plan),
highlight: plan.type === PlanType.TEAM,
isAvailable: plan.type === PlanType.TEAM,
@@ -384,14 +386,12 @@ export default defineComponent({
if (plan.type === PlanType.FREE) return t("subscription.deploy");
if (plan.type === PlanType.ENTERPRISE)
return t("subscription.contact-us");
- if (plan.type === props.subscription?.plan)
+
+ if (subscriptionStore.isTrialing) return t("subscription.subscribe");
+ if (plan.type === subscriptionStore.subscription?.plan)
return t("subscription.upgrade");
- if (plan.trialDays && plan.trialPrice) {
- return t("subscription.start-trial", {
- price: plan.trialPrice,
- days: plan.trialDays,
- });
- }
+ if (plan.trialDays) return t("subscription.start-trial");
+
return t("subscription.subscribe");
};
@@ -410,9 +410,14 @@ export default defineComponent({
}
};
+ const canTrial = computed((): boolean => {
+ return subscriptionStore.currentPlan === PlanType.FREE;
+ });
+
return {
state,
plans,
+ canTrial,
sections: FEATURE_SECTIONS,
getFeature,
onButtonClick,
diff --git a/frontend/src/layouts/DashboardLayout.vue b/frontend/src/layouts/DashboardLayout.vue
index 390f95377d..17ddc12c57 100644
--- a/frontend/src/layouts/DashboardLayout.vue
+++ b/frontend/src/layouts/DashboardLayout.vue
@@ -6,8 +6,8 @@
<template v-if="showDebugBanner">
<BannerDebug />
</template>
- <template v-else-if="isNearTrialExpireTime">
- <BannerTrial />
+ <template v-else-if="isExpired || isTrialing">
+ <BannerSubscription />
</template>
<template v-else-if="isReadonly">
<div
@@ -48,7 +48,7 @@
import ProvideDashboardContext from "../components/ProvideDashboardContext.vue";
import DashboardHeader from "../views/DashboardHeader.vue";
import BannerDemo from "../views/BannerDemo.vue";
-import BannerTrial from "../views/BannerTrial.vue";
+import BannerSubscription from "../views/BannerSubscription.vue";
import BannerDebug from "../views/BannerDebug.vue";
import { ServerInfo } from "../types";
import { isDBAOrOwner } from "../utils";
@@ -68,7 +68,7 @@ export default defineComponent({
ProvideDashboardContext,
DashboardHeader,
BannerDemo,
- BannerTrial,
+ BannerSubscription,
BannerDebug,
},
setup() {
@@ -87,7 +87,7 @@ export default defineComponent({
};
const { isDemo, isReadonly } = storeToRefs(actuatorStore);
- const { isNearTrialExpireTime } = storeToRefs(subscriptionStore);
+ const { isExpired, isTrialing } = storeToRefs(subscriptionStore);
const { isDebug } = storeToRefs(debugStore);
@@ -104,7 +104,8 @@ export default defineComponent({
ping,
isDemo,
isReadonly,
- isNearTrialExpireTime,
+ isTrialing,
+ isExpired,
showDebugBanner,
};
},
diff --git a/frontend/src/layouts/SQLEditorLayout.vue b/frontend/src/layouts/SQLEditorLayout.vue
index 43d46858c2..dbac908a78 100644
--- a/frontend/src/layouts/SQLEditorLayout.vue
+++ b/frontend/src/layouts/SQLEditorLayout.vue
@@ -3,8 +3,8 @@
<template v-if="isDemo">
<BannerDemo />
</template>
- <template v-else-if="isNearTrialExpireTime">
- <BannerTrial />
+ <template v-else-if="isExpired || isTrialing">
+ <BannerSubscription />
</template>
<nav class="bg-white border-b border-block-border">
@@ -38,7 +38,7 @@
import ProvideSQLEditorContext from "@/components/ProvideSQLEditorContext.vue";
import EditorHeader from "@/views/sql-editor/EditorHeader.vue";
import BannerDemo from "@/views/BannerDemo.vue";
-import BannerTrial from "@/views/BannerTrial.vue";
+import BannerSubscription from "@/views/BannerSubscription.vue";
import { ServerInfo } from "../types";
import {
pushNotification,
@@ -61,5 +61,5 @@ const ping = () => {
};
const { isDemo, isReadonly } = storeToRefs(actuatorStore);
-const { isNearTrialExpireTime } = storeToRefs(subscriptionStore);
+const { isExpired, isTrialing } = storeToRefs(subscriptionStore);
</script>
diff --git a/frontend/src/layouts/SheetDashboardLayout.vue b/frontend/src/layouts/SheetDashboardLayout.vue
index 5e4988062e..1dab767191 100644
--- a/frontend/src/layouts/SheetDashboardLayout.vue
+++ b/frontend/src/layouts/SheetDashboardLayout.vue
@@ -3,8 +3,8 @@
<template v-if="isDemo">
<BannerDemo />
</template>
- <template v-else-if="isNearTrialExpireTime">
- <BannerTrial />
+ <template v-else-if="isExpired || isTrialing">
+ <BannerSubscription />
</template>
<nav class="bg-white border-b border-block-border">
@@ -42,7 +42,7 @@ import {
} from "@/store";
import { ServerInfo } from "@/types";
import BannerDemo from "@/views/BannerDemo.vue";
-import BannerTrial from "@/views/BannerTrial.vue";
+import BannerSubscription from "@/views/BannerSubscription.vue";
import EditorHeader from "@/views/sql-editor/EditorHeader.vue";
const actuatorStore = useActuatorStore();
@@ -59,5 +59,5 @@ const ping = () => {
};
const { isDemo } = storeToRefs(actuatorStore);
-const { isNearTrialExpireTime } = storeToRefs(subscriptionStore);
+const { isExpired, isTrialing } = storeToRefs(subscriptionStore);
</script>
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index d799158da1..dfd3dd22a0 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -262,7 +262,9 @@
"banner": {
"demo-intro": "This is a demo version of Bytebase.",
"demo-intro-readonly": "This is a demo version of Bytebase in read-only mode.",
- "trial-expires": "Your trial for {plan} plan will expires in {days} days.",
+ "update-license": "Update license",
+ "license-expires": "Your license for {plan} has expired on {expireAt}.",
+ "trial-expires": "Your free trial for {plan} will expire in {days} days on {expireAt}.",
"extend-trial": "Extend trialing time",
"action": "Deploy yours in 5 seconds",
"debug": "Debug mode is active, you can disable Debug mode via the top-right profile dropdown."
@@ -1209,12 +1211,13 @@
"current": "Current plan",
"instance-count": "Instance count",
"expires-at": "Expires at",
+ "free-trial": "Your first 14 days are free - no credit card required",
"description-highlight": "Purchase a license",
"sensitive-placeholder": "Paste your license here - write only",
"upload-license": "Upload license",
"plan-compare": "Compare features between different plans",
"disabled-feature": "This is a premium feature in subscription plan",
- "trial": "You can start a trial with $14 for 14 days.",
+ "trial": "You can start a free trial - no credit card required",
"upgrade": "Upgrade subscription",
"per-month": "/ month",
"per-instance": "Per instance",
@@ -1223,7 +1226,7 @@
"enterprise-price-intro": "Customized, billed annually",
"deploy": "Deploy",
"contact-us": "Contact us",
- "start-trial": "Start trial with ${price} for {days} days",
+ "start-trial": "Try free now",
"subscribe": "Subscribe now",
"current-plan": "Current plan",
"buy": "Buy {plan} plan",
@@ -1266,11 +1269,11 @@
},
"bb-feature-schema-review-policy": {
"title": "Schema review policy",
- "desc": "Customize the schema review policy for different environments. @:{'subscription.upgrade'} to unlock this feature."
+ "desc": "Customize the schema review policy for different environments. @:{'subscription.trial'}."
},
"bb-feature-rbac": {
"title": "Role management",
- "desc": "Role management can assign a particular role (e.g. DBA) to a member. @:{'subscription.upgrade'} to unlock this feature."
+ "desc": "Role management can assign a particular role (e.g. DBA) to a member. @:{'subscription.trial'}."
},
"bb-feature-schema-drift": {
"title": "Schema drift",
@@ -1278,7 +1281,7 @@
},
"bb-feature-3rd-party-auth": {
"title": "3rd party authentication & authorization",
- "desc": "Bytebase supports 3rd-party authentication & authorization based on your VCS configuration. @:{'subscription.upgrade'} to unlock this feature.",
+ "desc": "Bytebase supports 3rd-party authentication & authorization based on your VCS configuration. @:{'subscription.trial'}.",
"login": "@:{'subscription.upgrade'} to unlock this feature"
},
"bb-feature-branding": {
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 9f41630875..fd7a8f3e2f 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -262,7 +262,9 @@
"banner": {
"demo-intro": "这是 Bytebase 的演示版本。",
"demo-intro-readonly": "这是 Bytebase 的只读演示版本",
- "trial-expires": "您的{plan}试用仅剩 {days} 天",
+ "update-license": "更新证书",
+ "license-expires": "您的{plan}证书已在 {expireAt} 过期",
+ "trial-expires": "您的{plan}试用将在 {days} 天后过期",
"extend-trial": "申请延长试用",
"action": "5 秒部署您自己的服务",
"debug": "Debug 模式已开启,您可以通过右上角头像下拉框关闭 Debug。"
@@ -1209,12 +1211,13 @@
"current": "当前版本",
"instance-count": "实例数",
"expires-at": "过期时间",
+ "free-trial": "无需信用卡即可免费试用",
"description-highlight": "购买证书",
"sensitive-placeholder": "粘贴您的证书 - 仅写入",
"upload-license": "上传证书",
"plan-compare": "比较不同版本的功能,寻找适合您的方案",
"disabled-feature": "这是一个订阅版高级功能",
- "trial": "您可以以 $14 的价格试用 14 天",
+ "trial": "您可以免费试用 14 天",
"upgrade": "升级订阅",
"per-month": "/ 月",
"per-instance": "每个实例",
@@ -1223,7 +1226,7 @@
"enterprise-price-intro": "自定义实例数,按年付费",
"deploy": "部署",
"contact-us": "联系我们",
- "start-trial": "以 {days} 天 {price} 美元的价格试用",
+ "start-trial": "免费试用",
"subscribe": "开始订阅",
"current-plan": "当前订阅",
"buy": "购买{plan}",
diff --git a/frontend/src/store/modules/subscription.ts b/frontend/src/store/modules/subscription.ts
index 7c8120cc68..8b55d6453c 100644
--- a/frontend/src/store/modules/subscription.ts
+++ b/frontend/src/store/modules/subscription.ts
@@ -18,26 +18,42 @@ export const useSubscriptionStore = defineStore("subscription", {
currentPlan(state): PlanType {
return state.subscription?.plan ?? PlanType.FREE;
},
- nextPaymentDays(state): number {
+ expireAt(state): string {
+ if (!state.subscription || state.subscription.expiresTs <= 0) {
+ return "";
+ }
+
+ return dayjs(state.subscription.expiresTs * 1000).format("YYYY-MM-DD");
+ },
+ isTrialing(state): boolean {
+ return !!state.subscription?.trialing;
+ },
+ isExpired(state): boolean {
+ if (!state.subscription || state.subscription.expiresTs <= 0) {
+ return false;
+ }
+ return dayjs(state.subscription.expiresTs * 1000).isBefore(new Date());
+ },
+ daysBeforeExpire(state): number {
if (!state.subscription || state.subscription.expiresTs <= 0) {
return -1;
}
const expiresTime = dayjs(state.subscription.expiresTs * 1000);
- return expiresTime.diff(new Date(), "day");
+ return Math.max(expiresTime.diff(new Date(), "day"), 0);
},
- isNearTrialExpireTime(): boolean {
- if (!this.subscription || !this.subscription?.trialing) return false;
+ isNearExpireTime(state): boolean {
+ if (!state.subscription || !state.subscription?.trialing) return false;
- const nextPaymentDays = this.nextPaymentDays;
- if (nextPaymentDays <= 0) return false;
+ const daysBeforeExpire = this.daysBeforeExpire;
+ if (daysBeforeExpire <= 0) return false;
- const trialEndTime = dayjs(this.subscription.expiresTs * 1000);
+ const trialEndTime = dayjs(state.subscription.expiresTs * 1000);
const total = trialEndTime.diff(
- this.subscription.startedTs * 1000,
+ state.subscription.startedTs * 1000,
"day"
);
- return nextPaymentDays / total < 0.5;
+ return daysBeforeExpire / total < 0.5;
},
},
actions: {
diff --git a/frontend/src/types/plan.ts b/frontend/src/types/plan.ts
index 953bce04a7..2d343d4edd 100644
--- a/frontend/src/types/plan.ts
+++ b/frontend/src/types/plan.ts
@@ -159,7 +159,7 @@ export const TEAM_PLAN: Plan = {
type: PlanType.TEAM,
trialDays: 14,
unitPrice: 1740,
- trialPrice: 14,
+ trialPrice: 0,
freeInstanceCount: 5,
pricePerInstancePerMonth: 29,
// Plan desc and feature
@@ -213,7 +213,7 @@ export const TEAM_PLAN: Plan = {
export const ENTERPRISE_PLAN: Plan = {
// Plan meta data
type: PlanType.ENTERPRISE,
- trialDays: 7,
+ trialDays: 0,
unitPrice: 0,
trialPrice: 0,
freeInstanceCount: 5,
diff --git a/frontend/src/views/BannerTrial.vue b/frontend/src/views/BannerSubscription.vue
similarity index 64%
rename from frontend/src/views/BannerTrial.vue
rename to frontend/src/views/BannerSubscription.vue
index ec5a9ed1bb..90c8bf54a0 100644
--- a/frontend/src/views/BannerTrial.vue
+++ b/frontend/src/views/BannerSubscription.vue
@@ -1,59 +1,62 @@
<template>
- <div v-if="show" class="bg-accent">
+ <div class="bg-warning">
<div class="mx-auto py-3 px-3">
<div class="flex items-center justify-between flex-wrap">
<div class="w-0 flex-1 flex items-center">
<p class="ml-3 font-medium text-white truncate">
- <span>
+ <span v-if="isExpired">
+ {{
+ $t("banner.license-expires", {
+ plan: currentPlan,
+ expireAt: expireAt,
+ })
+ }}
+ </span>
+ <span v-else-if="isTrialing">
{{
$t("banner.trial-expires", {
plan: currentPlan,
- days: nextPaymentDays,
+ days: daysBeforeExpire,
+ expireAt: expireAt,
})
}}
</span>
</p>
</div>
<div
- class="order-3 mt-2 flex-shrink-0 w-full sm:order-2 sm:mt-0 sm:w-auto"
+ class="order-3 mt-2 mr-3 flex-shrink-0 w-full sm:order-2 sm:mt-0 sm:w-auto"
>
<a
- :href="extendTrialingEmail"
target="_self"
+ href="https://hub.bytebase.com/subscription?source=console.banner"
class="flex items-center justify-center p-2 border border-transparent rounded-md shadow-sm text-base font-medium text-accent bg-white hover:bg-indigo-50"
>
- {{ $t("banner.extend-trial") }}
+ {{
+ $t(
+ isTrialing
+ ? "subscription.description-highlight"
+ : "banner.update-license"
+ )
+ }}
</a>
</div>
- <div class="order-2 flex-shrink-0 sm:order-3 sm:ml-3">
- <button
- type="button"
- class="-mr-1 flex p-2 rounded-md hover:bg-accent-hover focus:outline-none focus:ring-2 focus:ring-white sm:-mr-2"
- @click.prevent="show = false"
- >
- <span class="sr-only">{{ $t("common.dismiss") }}</span>
- <!-- Heroicon name: outline/x -->
- <heroicons-outline:x class="h-6 w-6 text-white" />
- </button>
- </div>
</div>
</div>
</div>
</template>
<script lang="ts">
-import { computed, ref } from "vue";
+import { computed } from "vue";
import { useI18n } from "vue-i18n";
import { PlanType } from "../types";
import { useSubscriptionStore } from "@/store";
import { storeToRefs } from "pinia";
export default {
- name: "BannerTrial",
+ name: "BannerSubscription",
setup() {
const subscriptionStore = useSubscriptionStore();
const { t } = useI18n();
- const show = ref(true);
const emailBody = [
"Hi bytebase support,\n",
@@ -75,12 +78,21 @@ export default {
}
});
- const { nextPaymentDays } = storeToRefs(subscriptionStore);
+ const {
+ expireAt,
+ isExpired,
+ isTrialing,
+ isNearExpireTime,
+ daysBeforeExpire,
+ } = storeToRefs(subscriptionStore);
return {
- show,
currentPlan,
- nextPaymentDays,
+ expireAt,
+ isTrialing,
+ isExpired,
+ isNearExpireTime,
+ daysBeforeExpire,
extendTrialingEmail: `mailto:[email protected]?subject=Request to extend trial&body=${encodeURIComponent(
emailBody
)}`,
diff --git a/frontend/src/views/SettingWorkspaceSubscription.vue b/frontend/src/views/SettingWorkspaceSubscription.vue
index 8be729104a..3e6bddf1d6 100644
--- a/frontend/src/views/SettingWorkspaceSubscription.vue
+++ b/frontend/src/views/SettingWorkspaceSubscription.vue
@@ -19,7 +19,7 @@
<div class="flex items-center">
{{ currentPlan }}
<span
- v-if="subscription.trialing"
+ v-if="isTrialing"
class="ml-2 inline-flex items-center px-3 py-0.5 rounded-full text-base font-sm bg-indigo-100 text-indigo-800 h-6"
>
{{ $t("subscription.trialing") }}
@@ -37,7 +37,7 @@
<dt class="text-gray-400">
{{ $t("subscription.expires-at") }}
</dt>
- <dd class="mt-1 text-4xl">{{ expiresAt }}</dd>
+ <dd class="mt-1 text-4xl">{{ expireAt || "n/a" }}</dd>
</div>
</dl>
<div class="w-full mt-5 flex flex-col">
@@ -65,7 +65,7 @@
<div class="textinfolabel">
{{ $t("subscription.plan-compare") }}
</div>
- <PricingTable :subscription="subscription" />
+ <PricingTable />
</div>
</div>
</template>
@@ -127,20 +127,13 @@ export default defineComponent({
}
};
- const { subscription } = storeToRefs(subscriptionStore);
+ const { subscription, expireAt, isTrialing } =
+ storeToRefs(subscriptionStore);
const instanceCount = computed((): number => {
return subscription.value?.instanceCount ?? 5;
});
- const expiresAt = computed((): string => {
- const expiresTs = subscription.value?.expiresTs ?? 0;
- if (expiresTs <= 0) {
- return "n/a";
- }
- return dayjs(expiresTs * 1000).format("YYYY-MM-DD");
- });
-
const currentPlan = computed((): string => {
const plan = subscriptionStore.currentPlan;
switch (plan) {
@@ -156,10 +149,10 @@ export default defineComponent({
return {
state,
disabled,
- expiresAt,
+ expireAt,
+ isTrialing,
currentPlan,
instanceCount,
- subscription,
uploadLicense,
};
},