mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-01 03:04:11 +00:00
## Summary Discussion here: https://comfy-organization.slack.com/archives/C0A0XANFJRE/p1764899027465379 Implement: Subscription tier query parameter for direct checkout flow Example button link: `/cloud/subscribe?tier=standard` `tier` could be `standard`, `creator` or `pro` `cycle` could be `monthly` or `yearly`. it is optional, and `monthly` by default. <!-- One sentence describing what changed and why. --> ## Changes - **What**: <!-- Core functionality added/modified --> - Add a landing page called `CloudSubscriptionRedirectView.vue` to handling the subscription tier button link parameter - Extract subscription handling logic from `PriceTable.vue` - **Breaking**: <!-- Any breaking changes (if none, remove this line) --> - Code change touched `PriceTable.vue` - **Dependencies**: <!-- New dependencies (if none, remove this line) --> ## Review Focus - link will redirect to login url, when cloud app not login - after login, the cloud app will redirect to CloudSubscriptionRedirect page - wait for several seconds, the cloud app will be redirected to checkout page <!-- Critical design decisions or edge cases that need attention --> <!-- If this PR fixes an issue, uncomment and update the line below --> <!-- Fixes #ISSUE_NUMBER --> ## Screenshots (if applicable)  <!-- Add screenshots or video recording to help explain your changes --> ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7553-feat-handling-subscription-tier-button-link-parameter-2cb6d73d365081ee9580e89090248300) by [Unito](https://www.unito.io) --------- Co-authored-by: GitHub Action <action@github.com>
140 lines
4.0 KiB
Vue
140 lines
4.0 KiB
Vue
<template>
|
|
<div class="flex h-full items-center justify-center p-8">
|
|
<div class="max-w-screen p-2 lg:w-96">
|
|
<!-- Header -->
|
|
<div class="mt-6 mb-8 flex flex-col gap-4">
|
|
<h1 class="my-0 text-xl leading-normal font-medium">
|
|
{{ t('auth.login.title') }}
|
|
</h1>
|
|
<p class="my-0 text-base">
|
|
<span class="text-muted">{{ t('auth.login.newUser') }}</span>
|
|
<span
|
|
class="ml-1 cursor-pointer text-blue-500"
|
|
@click="navigateToSignup"
|
|
>{{ t('auth.login.signUp') }}</span
|
|
>
|
|
</p>
|
|
</div>
|
|
|
|
<Message v-if="!isSecureContext" severity="warn" class="mb-4">
|
|
{{ t('auth.login.insecureContextWarning') }}
|
|
</Message>
|
|
|
|
<!-- Form -->
|
|
<CloudSignInForm :auth-error="authError" @submit="signInWithEmail" />
|
|
|
|
<!-- Divider -->
|
|
<Divider align="center" layout="horizontal" class="my-8">
|
|
<span class="text-muted">{{ t('auth.login.orContinueWith') }}</span>
|
|
</Divider>
|
|
|
|
<!-- Social Login Buttons -->
|
|
<div class="flex flex-col gap-6">
|
|
<Button
|
|
type="button"
|
|
class="h-10 bg-[#2d2e32]"
|
|
variant="secondary"
|
|
@click="signInWithGoogle"
|
|
>
|
|
<i class="pi pi-google mr-2"></i>
|
|
{{ t('auth.login.loginWithGoogle') }}
|
|
</Button>
|
|
|
|
<Button
|
|
type="button"
|
|
class="h-10 bg-[#2d2e32]"
|
|
variant="secondary"
|
|
@click="signInWithGithub"
|
|
>
|
|
<i class="pi pi-github mr-2"></i>
|
|
{{ t('auth.login.loginWithGithub') }}
|
|
</Button>
|
|
</div>
|
|
|
|
<!-- Terms & Contact -->
|
|
<p class="mt-5 text-sm text-gray-600">
|
|
{{ t('auth.login.termsText') }}
|
|
<a
|
|
href="https://www.comfy.org/terms-of-service"
|
|
target="_blank"
|
|
class="cursor-pointer text-blue-400 no-underline"
|
|
>
|
|
{{ t('auth.login.termsLink') }}
|
|
</a>
|
|
{{ t('auth.login.andText') }}
|
|
<a
|
|
href="https://www.comfy.org/privacy-policy"
|
|
target="_blank"
|
|
class="cursor-pointer text-blue-400 no-underline"
|
|
>
|
|
{{ t('auth.login.privacyLink') }} </a
|
|
>.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import Divider from 'primevue/divider'
|
|
import Message from 'primevue/message'
|
|
import { ref } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
|
import Button from '@/components/ui/button/Button.vue'
|
|
import { useFirebaseAuthActions } from '@/composables/auth/useFirebaseAuthActions'
|
|
import CloudSignInForm from '@/platform/cloud/onboarding/components/CloudSignInForm.vue'
|
|
import { getSafePreviousFullPath } from '@/platform/cloud/onboarding/utils/previousFullPath'
|
|
import { useToastStore } from '@/platform/updates/common/toastStore'
|
|
import type { SignInData } from '@/schemas/signInSchema'
|
|
|
|
const { t } = useI18n()
|
|
const router = useRouter()
|
|
const route = useRoute()
|
|
const authActions = useFirebaseAuthActions()
|
|
const isSecureContext = globalThis.isSecureContext
|
|
const authError = ref('')
|
|
const toastStore = useToastStore()
|
|
|
|
const navigateToSignup = async () => {
|
|
await router.push({ name: 'cloud-signup', query: route.query })
|
|
}
|
|
|
|
const onSuccess = async () => {
|
|
toastStore.add({
|
|
severity: 'success',
|
|
summary: 'Login Completed',
|
|
life: 2000
|
|
})
|
|
|
|
const previousFullPath = getSafePreviousFullPath(route.query)
|
|
if (previousFullPath) {
|
|
await router.replace(previousFullPath)
|
|
return
|
|
}
|
|
|
|
await router.push({ name: 'cloud-user-check' })
|
|
}
|
|
|
|
const signInWithGoogle = async () => {
|
|
authError.value = ''
|
|
if (await authActions.signInWithGoogle()) {
|
|
await onSuccess()
|
|
}
|
|
}
|
|
|
|
const signInWithGithub = async () => {
|
|
authError.value = ''
|
|
if (await authActions.signInWithGithub()) {
|
|
await onSuccess()
|
|
}
|
|
}
|
|
|
|
const signInWithEmail = async (values: SignInData) => {
|
|
authError.value = ''
|
|
if (await authActions.signInWithEmail(values.email, values.password)) {
|
|
await onSuccess()
|
|
}
|
|
}
|
|
</script>
|