fix(core): manage payment details entry adjustment (#13481)
#### PR Dependency Tree * **PR #13481** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - Bug Fixes - The “Update payment method” prompt now appears only when your subscription is past due. - Payment Method section now shows whenever a paid plan record exists (loading placeholders unchanged). - Action button styling adjusts for past-due subscriptions (uses the alternate/secondary style). <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -97,11 +97,13 @@ export const AIPlanCard = ({ onClick }: { onClick: () => void }) => {
|
|||||||
</AISubscribe>
|
</AISubscribe>
|
||||||
)
|
)
|
||||||
) : null}
|
) : null}
|
||||||
<PaymentMethodUpdater
|
{subscription?.status === SubscriptionStatus.PastDue ? (
|
||||||
inCardView
|
<PaymentMethodUpdater
|
||||||
className={styles.managementInCard}
|
inCardView
|
||||||
variant="primary"
|
className={styles.managementInCard}
|
||||||
/>
|
variant="primary"
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import {
|
|||||||
SettingWrapper,
|
SettingWrapper,
|
||||||
} from '@affine/component/setting-components';
|
} from '@affine/component/setting-components';
|
||||||
import { SubscriptionService } from '@affine/core/modules/cloud';
|
import { SubscriptionService } from '@affine/core/modules/cloud';
|
||||||
import { SubscriptionStatus } from '@affine/graphql';
|
|
||||||
import { useI18n } from '@affine/i18n';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { track } from '@affine/track';
|
import { track } from '@affine/track';
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
@@ -80,7 +79,7 @@ const SubscriptionSettings = ({
|
|||||||
return (
|
return (
|
||||||
<div className={styles.subscription}>
|
<div className={styles.subscription}>
|
||||||
<AIPlanCard onClick={gotoAiPlanSetting} />
|
<AIPlanCard onClick={gotoAiPlanSetting} />
|
||||||
{/* loaded */}
|
|
||||||
{proSubscription !== null ? (
|
{proSubscription !== null ? (
|
||||||
isBeliever ? (
|
isBeliever ? (
|
||||||
<BelieverIdentifier onOpenPlans={gotoCloudPlansSetting} />
|
<BelieverIdentifier onOpenPlans={gotoCloudPlansSetting} />
|
||||||
@@ -94,9 +93,7 @@ const SubscriptionSettings = ({
|
|||||||
<TypeformLink />
|
<TypeformLink />
|
||||||
|
|
||||||
{proSubscription !== null ? (
|
{proSubscription !== null ? (
|
||||||
proSubscription?.status === SubscriptionStatus.Active && (
|
proSubscription && <PaymentMethod />
|
||||||
<PaymentMethod />
|
|
||||||
)
|
|
||||||
) : (
|
) : (
|
||||||
<SubscriptionSettingSkeleton />
|
<SubscriptionSettingSkeleton />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ const CloudExpirationInfo = () => {
|
|||||||
|
|
||||||
const PlanAction = ({
|
const PlanAction = ({
|
||||||
plan,
|
plan,
|
||||||
|
subscriptionStatus,
|
||||||
gotoPlansSetting,
|
gotoPlansSetting,
|
||||||
}: {
|
}: {
|
||||||
plan: string;
|
plan: string;
|
||||||
@@ -167,18 +168,24 @@ const PlanAction = ({
|
|||||||
<div className={styles.planActionContainer}>
|
<div className={styles.planActionContainer}>
|
||||||
<Button
|
<Button
|
||||||
className={styles.planAction}
|
className={styles.planAction}
|
||||||
variant="primary"
|
variant={
|
||||||
|
subscriptionStatus === SubscriptionStatus.PastDue
|
||||||
|
? 'secondary'
|
||||||
|
: 'primary'
|
||||||
|
}
|
||||||
onClick={gotoPlansSetting}
|
onClick={gotoPlansSetting}
|
||||||
>
|
>
|
||||||
{plan === SubscriptionPlan.Pro
|
{plan === SubscriptionPlan.Pro
|
||||||
? t['com.affine.payment.billing-setting.change-plan']()
|
? t['com.affine.payment.billing-setting.change-plan']()
|
||||||
: t['com.affine.payment.billing-setting.upgrade']()}
|
: t['com.affine.payment.billing-setting.upgrade']()}
|
||||||
</Button>
|
</Button>
|
||||||
<PaymentMethodUpdater
|
{subscriptionStatus === SubscriptionStatus.PastDue ? (
|
||||||
inCardView
|
<PaymentMethodUpdater
|
||||||
className={styles.managementInCard}
|
inCardView
|
||||||
variant="primary"
|
className={styles.managementInCard}
|
||||||
/>
|
variant="primary"
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user