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