Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): wrong pricing state in billing ai card (#6583)

CatsJuicec222cf7b96e0
diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/billing/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/billing/index.tsx
index dd0e5d4c98..d75130eea1 100644
--- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/billing/index.tsx
+++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/billing/index.tsx
@@ -97,6 +97,7 @@ const SubscriptionSettings = () => {
const [subscription, mutateSubscription] = useUserSubscription();
const [openCancelModal, setOpenCancelModal] = useState(false);
const {
+ isFree: isFreeAI,
actionType: aiActionType,
Action: AIAction,
billingTip,
@@ -187,7 +188,11 @@ const SubscriptionSettings = () => {
<SettingRow
spreadCol={false}
name={t['com.affine.payment.billing-setting.ai-plan']()}
- desc={billingTip}
+ desc={
+ isFreeAI
+ ? t['com.affine.payment.billing-setting.ai.free-desc']()
+ : billingTip
+ }
/>
{aiPrice?.yearlyAmount ? (
<AIAction
@@ -196,12 +201,14 @@ const SubscriptionSettings = () => {
recurring={SubscriptionRecurring.Yearly}
onSubscriptionUpdate={mutateSubscription}
>
- {aiActionType === 'subscribe' ? 'Purchase' : null}
+ {aiActionType === 'subscribe'
+ ? t['com.affine.payment.billing-setting.ai.purchase']()
+ : null}
</AIAction>
) : null}
</div>
<p className={styles.planPrice}>
- {aiPriceReadable}
+ {isFreeAI ? '$0' : aiPriceReadable}
<span className={styles.billingFrequency}>/{aiPriceFrequency}</span>
</p>
</div>
diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/ai/use-affine-ai-subscription.ts b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/ai/use-affine-ai-subscription.ts
index 6895db8437..d2764f8895 100644
--- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/ai/use-affine-ai-subscription.ts
+++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/plans/ai/use-affine-ai-subscription.ts
@@ -32,6 +32,8 @@ export const useAffineAISubscription = () => {
cancel: AICancel,
}[actionType];
+ const isFree = !subscription;
+
const billingTip = subscription?.nextBillAt
? t['com.affine.payment.ai.billing-tip.next-bill-at']({
due: timestampToLocalDate(subscription.nextBillAt),
@@ -42,5 +44,5 @@ export const useAffineAISubscription = () => {
})
: null;
- return { actionType, Action, billingTip };
+ return { actionType, Action, billingTip, isFree };
};
diff --git a/packages/frontend/i18n/src/resources/en.json b/packages/frontend/i18n/src/resources/en.json
index 4bd4a2f96b..0e6e658db7 100644
--- a/packages/frontend/i18n/src/resources/en.json
+++ b/packages/frontend/i18n/src/resources/en.json
@@ -909,6 +909,8 @@
"com.affine.payment.billing-setting.upgrade": "Upgrade",
"com.affine.payment.billing-setting.view-invoice": "View Invoice",
"com.affine.payment.billing-setting.year": "year",
+ "com.affine.payment.billing-setting.ai.free-desc": "Yue are current on the Free plan.",
+ "com.affine.payment.billing-setting.ai.purchase": "Purchase",
"com.affine.payment.blob-limit.description.local": "The maximum file upload size for local workspaces is {{quota}}.",
"com.affine.payment.blob-limit.description.member": "The maximum file upload size for this joined workspace is {{quota}}. You can contact the owner of this workspace.",
"com.affine.payment.blob-limit.description.owner.free": "{{planName}} users can upload files with a maximum size of {{currentQuota}}. You can upgrade your account to unlock a maximum file size of {{upgradeQuota}}.",