diff --git a/packages/frontend/component/src/components/member-components/invite-team-modal/index.tsx b/packages/frontend/component/src/components/member-components/invite-team-modal/index.tsx index eaa479b9b3724..f017408be3e8c 100644 --- a/packages/frontend/component/src/components/member-components/invite-team-modal/index.tsx +++ b/packages/frontend/component/src/components/member-components/invite-team-modal/index.tsx @@ -81,6 +81,9 @@ export const InviteTeamMemberModal = ({ onOpenChange={setOpen} title={t['com.affine.payment.member.team.invite.title']()} cancelText={t['com.affine.inviteModal.button.cancel']()} + cancelButtonOptions={{ + variant: 'secondary', + }} contentOptions={{ ['data-testid' as string]: 'invite-modal', style: { diff --git a/packages/frontend/component/src/components/member-components/invite-team-modal/link-invite.tsx b/packages/frontend/component/src/components/member-components/invite-team-modal/link-invite.tsx index 0a6e8823f0062..de33f10e688d8 100644 --- a/packages/frontend/component/src/components/member-components/invite-team-modal/link-invite.tsx +++ b/packages/frontend/component/src/components/member-components/invite-team-modal/link-invite.tsx @@ -150,13 +150,13 @@ export const LinkInvite = ({ /> {invitationLink ? ( <> - } onClick={onReset} /> ) : ( - )} diff --git a/packages/frontend/core/src/components/hooks/affine/use-subscription-notify.tsx b/packages/frontend/core/src/components/hooks/affine/use-subscription-notify.tsx index 0bf082c7f5495..9c48d62df267a 100644 --- a/packages/frontend/core/src/components/hooks/affine/use-subscription-notify.tsx +++ b/packages/frontend/core/src/components/hooks/affine/use-subscription-notify.tsx @@ -46,7 +46,8 @@ export const getDowngradeQuestionnaireLink = (info: TypeFormInfo) => export const generateSubscriptionCallbackLink = ( account: AuthAccountInfo | null, plan: SubscriptionPlan, - recurring: SubscriptionRecurring + recurring: SubscriptionRecurring, + workspaceId?: string ) => { if (account === null) { throw new Error('Account is required'); @@ -69,7 +70,22 @@ export const generateSubscriptionCallbackLink = ( account.id, account.email, account.info?.name ?? '', + workspaceId ?? '', ].join(separator); return `${baseUrl}?info=${encodeURIComponent(query)}`; }; + +export const getSubscriptionInfo = (searchParams: URLSearchParams) => { + const decodedInfo = decodeURIComponent(searchParams.get('info') || ''); + const [plan, recurring, accountId, email, name, workspaceId] = + decodedInfo.split(separator); + return { + plan: plan as SubscriptionPlan, + recurring: recurring as SubscriptionRecurring, + accountId, + email, + name: name.replaceAll(recoverSeparator, separator), + workspaceId, + }; +}; diff --git a/packages/frontend/core/src/desktop/dialogs/setting/general-setting/plans/plan-card.tsx b/packages/frontend/core/src/desktop/dialogs/setting/general-setting/plans/plan-card.tsx index c0110cbdee712..ae65910b0faa8 100644 --- a/packages/frontend/core/src/desktop/dialogs/setting/general-setting/plans/plan-card.tsx +++ b/packages/frontend/core/src/desktop/dialogs/setting/general-setting/plans/plan-card.tsx @@ -272,6 +272,7 @@ export const Upgrade = ({ className, recurring, plan, + workspaceId, children, checkoutInput, onCheckoutSuccess, @@ -280,6 +281,7 @@ export const Upgrade = ({ }: ButtonProps & { recurring: SubscriptionRecurring; plan: SubscriptionPlan; + workspaceId?: string; checkoutInput?: Partial; onBeforeCheckout?: () => void; onCheckoutSuccess?: () => void; @@ -304,11 +306,18 @@ export const Upgrade = ({ successCallbackLink: generateSubscriptionCallbackLink( authService.session.account$.value, plan, - recurring + recurring, + workspaceId ), ...checkoutInput, }), - [authService.session.account$.value, checkoutInput, plan, recurring] + [ + authService.session.account$.value, + checkoutInput, + plan, + recurring, + workspaceId, + ] ); return ( diff --git a/packages/frontend/core/src/desktop/dialogs/setting/workspace-setting/new-workspace-setting-detail/members/cloud-members-panel.tsx b/packages/frontend/core/src/desktop/dialogs/setting/workspace-setting/new-workspace-setting-detail/members/cloud-members-panel.tsx index a18bf0604c463..1291b2993c13b 100644 --- a/packages/frontend/core/src/desktop/dialogs/setting/workspace-setting/new-workspace-setting-detail/members/cloud-members-panel.tsx +++ b/packages/frontend/core/src/desktop/dialogs/setting/workspace-setting/new-workspace-setting-detail/members/cloud-members-panel.tsx @@ -288,7 +288,11 @@ const ImportCSV = ({ onImport }: { onImport: (file: File) => void }) => { return ( - diff --git a/packages/frontend/core/src/desktop/pages/upgrade-success/team/index.tsx b/packages/frontend/core/src/desktop/pages/upgrade-success/team/index.tsx index e63b0cd2ea0b3..f06200865a197 100644 --- a/packages/frontend/core/src/desktop/pages/upgrade-success/team/index.tsx +++ b/packages/frontend/core/src/desktop/pages/upgrade-success/team/index.tsx @@ -1,5 +1,6 @@ import { Button } from '@affine/component'; import { AuthPageContainer } from '@affine/component/auth-components'; +import { getSubscriptionInfo } from '@affine/core/components/hooks/affine/use-subscription-notify'; import { useNavigateHelper } from '@affine/core/components/hooks/use-navigate-helper'; import { Trans, useI18n } from '@affine/i18n'; import { useCallback } from 'react'; @@ -15,15 +16,26 @@ import * as styles from './styles.css'; export const Component = () => { const t = useI18n(); const [params] = useSearchParams(); + const subscriptionInfo = getSubscriptionInfo(params); - const { jumpToIndex, jumpToOpenInApp } = useNavigateHelper(); - const openAffine = useCallback(() => { + const { jumpToPage, jumpToOpenInApp, jumpToIndex } = useNavigateHelper(); + const openWorkspace = useCallback(() => { if (params.get('schema')) { jumpToOpenInApp('bring-to-front'); } else { + if (subscriptionInfo.workspaceId) { + jumpToPage(subscriptionInfo.workspaceId, 'all'); + return; + } jumpToIndex(); } - }, [jumpToIndex, jumpToOpenInApp, params]); + }, [ + jumpToIndex, + jumpToOpenInApp, + jumpToPage, + params, + subscriptionInfo.workspaceId, + ]); const subtitle = (
@@ -49,8 +61,8 @@ export const Component = () => { title={t['com.affine.payment.upgrade-success-page.title']()} subtitle={subtitle} > - ); diff --git a/packages/frontend/core/src/desktop/pages/upgrade-to-team/index.tsx b/packages/frontend/core/src/desktop/pages/upgrade-to-team/index.tsx index bcb548964408c..cd404980ee0cb 100644 --- a/packages/frontend/core/src/desktop/pages/upgrade-to-team/index.tsx +++ b/packages/frontend/core/src/desktop/pages/upgrade-to-team/index.tsx @@ -196,6 +196,7 @@ const UpgradeDialog = ({ className={styles.upgradeButtonInDialog} recurring={currentRecurring} plan={SubscriptionPlan.Team} + workspaceId={workspaceId} onCheckoutSuccess={onClose} checkoutInput={{ args: {