mirror of
https://github.com/pockethost/pockethost.git
synced 2025-11-24 06:25:48 +00:00
founder sub type refactor
This commit is contained in:
parent
a3629fa616
commit
6a585d5e99
@ -95,7 +95,7 @@
|
||||
{PLAN_NAMES[SubscriptionType.Premium]}
|
||||
</th>
|
||||
<th scope="col" class="text-center">
|
||||
{PLAN_NAMES[SubscriptionType.Lifetime]}
|
||||
{PLAN_NAMES[SubscriptionType.Founder]}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -143,7 +143,7 @@
|
||||
<div class="rounded-lg ring-1 ring-transparent"></div>
|
||||
{/if}
|
||||
|
||||
{#if $userSubscriptionType === SubscriptionType.Lifetime || (SubscriptionType.Premium && $isUserFounder)}
|
||||
{#if $userSubscriptionType === SubscriptionType.Founder || (SubscriptionType.Premium && $isUserFounder)}
|
||||
<div class="rounded-lg ring-2 ring-primary"></div>
|
||||
{:else}
|
||||
<div class="rounded-lg ring-1 ring-transparent"></div>
|
||||
@ -269,7 +269,7 @@
|
||||
<div class="border-t border-gray-900/10">
|
||||
<div class="-mt-px pt-10">
|
||||
<h3 class="text-sm font-semibold leading-6 text-primary">
|
||||
{PLAN_NAMES[SubscriptionType.Lifetime]}
|
||||
{PLAN_NAMES[SubscriptionType.Founder]}
|
||||
</h3>
|
||||
<p class="mt-1 text-sm leading-6">
|
||||
Super elite! The Founder's Edition is our way of saying thanks
|
||||
@ -304,7 +304,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Fake card border -->
|
||||
{#if $userSubscriptionType === SubscriptionType.Lifetime}
|
||||
{#if $userSubscriptionType === SubscriptionType.Founder}
|
||||
<div
|
||||
aria-hidden="true"
|
||||
class="pointer-events-none absolute inset-y-0 right-0 hidden w-1/2 rounded-lg sm:block ring-2 ring-primary"
|
||||
|
||||
@ -83,7 +83,7 @@
|
||||
/>
|
||||
|
||||
<PricingCard
|
||||
name={`${PLAN_NAMES[SubscriptionType.Lifetime]}`}
|
||||
name={`${PLAN_NAMES[SubscriptionType.Founder]}`}
|
||||
qtyRemaining={founderMembershipsRemaining}
|
||||
qtyMax={100}
|
||||
description="Super elite! The Founder's Edition is our way of saying thanks for supporting PocketHost in these early days. Choose between lifetime and annual options."
|
||||
@ -91,7 +91,7 @@
|
||||
priceAnnually={[99, 'year (save 55%)']}
|
||||
checkoutMonthURL="https://store.pockethost.io/checkout/buy/e71cbfb5-cec3-4745-97a7-d877f6776503?checkout[custom][user_id]={$userStore?.id}"
|
||||
checkoutYearURL="https://store.pockethost.io/checkout/buy/e5660329-5b99-4ed6-8f36-0d387803e1d6?checkout[custom][user_id]={$userStore?.id}"
|
||||
active={$userSubscriptionType === SubscriptionType.Lifetime ||
|
||||
active={$userSubscriptionType === SubscriptionType.Founder ||
|
||||
(SubscriptionType.Premium && $isUserFounder)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
import CardHeader from '$components/cards/CardHeader.svelte'
|
||||
import { DOCS_URL, INSTANCE_BARE_HOST } from '$src/env'
|
||||
import { client } from '$src/pocketbase-client'
|
||||
import { userSubscriptionType } from '$util/stores'
|
||||
import { isUserPaid, userSubscriptionType } from '$util/stores'
|
||||
import { SubscriptionType } from 'pockethost/common'
|
||||
import { dns } from 'svelte-highlight/languages'
|
||||
import { instance } from '../store'
|
||||
@ -40,12 +40,7 @@
|
||||
|
||||
const trimmed = formCname.trim()
|
||||
|
||||
if (
|
||||
trimmed &&
|
||||
![SubscriptionType.Premium, SubscriptionType.Lifetime].includes(
|
||||
$userSubscriptionType,
|
||||
)
|
||||
) {
|
||||
if (trimmed && !$isUserPaid) {
|
||||
errorMessage = `Oof, you hit a paywall. This is a Pro feature only. Please <a class='link' href="/account">upgrade your account.</a>`
|
||||
return
|
||||
}
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { globalInstancesStore, userSubscriptionType } from '$util/stores'
|
||||
import {
|
||||
globalInstancesStore,
|
||||
isUserPaid,
|
||||
userSubscriptionType,
|
||||
} from '$util/stores'
|
||||
import { values } from '@s-libs/micro-dash'
|
||||
import { SubscriptionType } from 'pockethost/common'
|
||||
import Creator from './Creator.svelte'
|
||||
@ -9,10 +13,7 @@
|
||||
let canCreate = false
|
||||
$: {
|
||||
instanceCount = values($globalInstancesStore).length
|
||||
canCreate =
|
||||
[SubscriptionType.Lifetime, SubscriptionType.Premium].includes(
|
||||
$userSubscriptionType,
|
||||
) || instanceCount === 0
|
||||
canCreate = $isUserPaid || instanceCount === 0
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ const { onAuthChange } = client()
|
||||
|
||||
export const isUserLegacy = writable(false)
|
||||
export const userSubscriptionType = writable(SubscriptionType.Legacy)
|
||||
export const isUserPaid = writable(false)
|
||||
export const isUserLoggedIn = writable(false)
|
||||
export const isUserFounder = writable(false)
|
||||
export const isUserVerified = writable(false)
|
||||
@ -42,6 +43,11 @@ onAuthChange((authStoreProps) => {
|
||||
userStore.subscribe((user) => {
|
||||
isUserLegacy.set(!!user?.isLegacy)
|
||||
isUserFounder.set(!!user?.isFounder)
|
||||
isUserPaid.set(
|
||||
[SubscriptionType.Founder, SubscriptionType.Premium].includes(
|
||||
user?.subscription || SubscriptionType.Free,
|
||||
),
|
||||
)
|
||||
userSubscriptionType.set(user?.subscription || SubscriptionType.Free)
|
||||
isUserVerified.set(!!user?.verified)
|
||||
})
|
||||
|
||||
@ -4,14 +4,14 @@ export enum SubscriptionType {
|
||||
Legacy = 'legacy',
|
||||
Free = 'free',
|
||||
Premium = 'premium',
|
||||
Lifetime = 'lifetime',
|
||||
Founder = 'founder',
|
||||
}
|
||||
|
||||
export const PLAN_NAMES = {
|
||||
[SubscriptionType.Legacy]: 'Legacy',
|
||||
[SubscriptionType.Free]: 'Hacker',
|
||||
[SubscriptionType.Premium]: `Pro`,
|
||||
[SubscriptionType.Lifetime]: `Founder's Edition`,
|
||||
[SubscriptionType.Founder]: `Founder's Edition`,
|
||||
}
|
||||
|
||||
export type UserFields<TExtra = {}> = BaseFields & {
|
||||
|
||||
@ -71,21 +71,25 @@ routerAdd('POST', '/api/ls', (c) => {
|
||||
const editions = {
|
||||
// Founder's annual
|
||||
159792: () => {
|
||||
userRec.set(`subscription`, `premium`)
|
||||
userRec.set(`subscription`, `founder`)
|
||||
userRec.set(`subscription_interval`, `year`)
|
||||
userRec.set(`isFounder`, true)
|
||||
},
|
||||
// Founder's lifetime
|
||||
159794: () => {
|
||||
userRec.set(`subscription`, `lifetime`)
|
||||
userRec.set(`subscription`, `founder`)
|
||||
userRec.set(`subscription_interval`, `life`)
|
||||
userRec.set(`isFounder`, true)
|
||||
},
|
||||
// Pro annual
|
||||
159791: () => {
|
||||
userRec.set(`subscription`, `premium`)
|
||||
userRec.set(`subscription_interval`, `year`)
|
||||
},
|
||||
// Pro monthly
|
||||
159790: () => {
|
||||
userRec.set(`subscription`, `premium`)
|
||||
userRec.set(`subscription_interval`, `month`)
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user