2021-11-16 21:11:59 +01:00
|
|
|
<script>
|
2023-09-14 01:35:27 +02:00
|
|
|
import { onMount } from "svelte";
|
2021-11-16 21:11:59 +01:00
|
|
|
import Euro from "../util/Euro.svelte"
|
2022-04-26 15:23:57 +02:00
|
|
|
import LoadingIndicator from "../util/LoadingIndicator.svelte";
|
2022-10-18 14:30:50 +02:00
|
|
|
import SuccessMessage from "../util/SuccessMessage.svelte";
|
2021-11-16 21:11:59 +01:00
|
|
|
|
|
|
|
let loading = false
|
2021-11-22 21:34:14 +01:00
|
|
|
let subscription = window.user.subscription.id
|
2022-10-18 14:30:50 +02:00
|
|
|
let success_message
|
2021-11-16 21:11:59 +01:00
|
|
|
|
2022-10-18 14:30:50 +02:00
|
|
|
const update = async () => {
|
2021-11-16 21:11:59 +01:00
|
|
|
loading = true
|
|
|
|
|
|
|
|
const form = new FormData()
|
2022-10-18 14:30:50 +02:00
|
|
|
form.append("subscription", subscription)
|
2021-11-23 14:22:42 +01:00
|
|
|
|
2021-11-16 21:11:59 +01:00
|
|
|
try {
|
|
|
|
const resp = await fetch(
|
2022-11-01 16:56:46 +01:00
|
|
|
window.api_endpoint+"/user",
|
2021-11-16 21:11:59 +01:00
|
|
|
{ method: "PUT", body: form },
|
|
|
|
)
|
|
|
|
if(resp.status >= 400) {
|
|
|
|
let json = await resp.json()
|
|
|
|
throw json.message
|
|
|
|
}
|
|
|
|
|
2022-10-18 14:30:50 +02:00
|
|
|
success_message.set(true, "Subscription updated")
|
2021-11-16 21:11:59 +01:00
|
|
|
} catch (err) {
|
2022-10-18 14:30:50 +02:00
|
|
|
success_message.set(false, "Failed to update subscription: "+err)
|
2022-03-30 00:32:27 +02:00
|
|
|
} finally {
|
2021-11-16 21:11:59 +01:00
|
|
|
loading = false
|
|
|
|
}
|
|
|
|
}
|
2023-09-14 01:35:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
let checkout_success = false
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
if (window.location.hash === "#checkout_complete") {
|
|
|
|
checkout_success = true
|
|
|
|
window.location.hash = ""
|
|
|
|
}
|
|
|
|
})
|
2021-11-16 21:11:59 +01:00
|
|
|
</script>
|
|
|
|
|
2022-04-26 15:23:57 +02:00
|
|
|
<LoadingIndicator loading={loading}/>
|
|
|
|
|
2022-01-11 13:28:22 +01:00
|
|
|
<section>
|
2023-09-14 01:35:27 +02:00
|
|
|
{#if checkout_success}
|
|
|
|
<div class="highlight_green">
|
|
|
|
<h2>Payment successful!</h2>
|
|
|
|
<p>
|
2023-09-14 14:29:05 +02:00
|
|
|
Thank you for supporting pixeldrain! The credit has been added
|
|
|
|
to your account balance. Activate a subscription plan below to
|
|
|
|
finish upgrading your account.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
If your account credit has not been updated, please check the
|
|
|
|
status of your invoice on <a
|
|
|
|
href="/user/prepaid/deposit#invoices">the invoices page</a>.
|
|
|
|
Depending on the payment processor you used to can take a while
|
|
|
|
before your credit is deposited. If it takes too long contact
|
|
|
|
support@pixeldrain.com.
|
2023-09-14 01:35:27 +02:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
{/if}
|
2023-09-19 17:35:21 +02:00
|
|
|
|
|
|
|
{#if window.user.subscription.type === "patreon"}
|
|
|
|
<div class="highlight_yellow">
|
|
|
|
<p>
|
|
|
|
Activating a prepaid subscription will not cancel your active
|
|
|
|
Patreon subscription. Go to Patreon's
|
|
|
|
<a
|
|
|
|
href="https://www.patreon.com/settings/memberships">memberships
|
|
|
|
page</a> to end your subscription there.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
If you enable a prepaid plan here your Patreon subscription will
|
|
|
|
be overridden. If you wish to go back to your Patreon plan use
|
|
|
|
the <a href="/user/home">Link Patreon subscription</a> button on
|
|
|
|
the home page to link your Patreon account back to pixeldrain.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
|
2022-01-11 13:28:22 +01:00
|
|
|
<h2>Manage subscription</h2>
|
2022-10-18 14:30:50 +02:00
|
|
|
<p>
|
|
|
|
Current account balance: <Euro amount={window.user.balance_micro_eur}></Euro>
|
|
|
|
</p>
|
|
|
|
<p>
|
2023-09-14 01:35:27 +02:00
|
|
|
Prepaid subscriptions are charged daily based on usage. When you reach
|
|
|
|
negative balance the subscription will automatically end. You will need
|
|
|
|
a positive balance to activate the subscription again.
|
2022-10-18 14:30:50 +02:00
|
|
|
</p>
|
2022-01-11 13:28:22 +01:00
|
|
|
|
2022-10-18 14:30:50 +02:00
|
|
|
<h3>Prepaid plans</h3>
|
|
|
|
<SuccessMessage bind:this={success_message}/>
|
|
|
|
|
|
|
|
<div class="feat_table">
|
|
|
|
<div>
|
|
|
|
<div class="feat_label" class:feat_highlight={subscription === "prepaid"}>
|
|
|
|
Prepaid<br/>
|
|
|
|
{#if subscription === "prepaid"}
|
|
|
|
Currently active
|
|
|
|
{:else}
|
|
|
|
<button on:click={() => {subscription = "prepaid"; update("subscription")}}>
|
|
|
|
<i class="icon">attach_money</i>
|
|
|
|
Activate
|
|
|
|
</button>
|
|
|
|
{/if}
|
2022-01-11 13:28:22 +01:00
|
|
|
</div>
|
2022-10-18 14:30:50 +02:00
|
|
|
<div class="feat_normal round_tr" class:feat_highlight={subscription === "prepaid"}>
|
|
|
|
<ul>
|
2023-09-14 01:35:27 +02:00
|
|
|
<li>Base price of €2 per month</li>
|
2022-11-01 10:54:31 +01:00
|
|
|
<li>€4 per TB per month for storage</li>
|
2023-09-14 01:35:27 +02:00
|
|
|
<li>
|
|
|
|
€2 per TB for data transfer (with <a
|
|
|
|
href="user/sharing/bandwidth">bandwidth sharing</a>
|
|
|
|
enabled)
|
|
|
|
</li>
|
2022-10-18 14:30:50 +02:00
|
|
|
<li>Files never expire as long as subscription is active</li>
|
2023-09-14 01:35:27 +02:00
|
|
|
<li>
|
|
|
|
Download page <a href="/user/sharing/branding">branding
|
|
|
|
options</a>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
File <a href="/user/sharing/embedding">embedding
|
|
|
|
control</a> options
|
|
|
|
</li>
|
2022-10-18 14:30:50 +02:00
|
|
|
</ul>
|
2022-01-11 13:28:22 +01:00
|
|
|
</div>
|
2022-10-18 14:30:50 +02:00
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<div class="feat_label" class:feat_highlight={subscription === "prepaid_temp_storage_120d"}>
|
2023-09-14 01:35:27 +02:00
|
|
|
240 days storage<br/>
|
2022-10-18 14:30:50 +02:00
|
|
|
{#if subscription === "prepaid_temp_storage_120d"}
|
|
|
|
Currently active
|
|
|
|
{:else}
|
|
|
|
<button on:click={() => {subscription = "prepaid_temp_storage_120d"; update("subscription")}}>
|
|
|
|
<i class="icon">attach_money</i>
|
|
|
|
Activate
|
|
|
|
</button>
|
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
<div class="feat_normal" class:feat_highlight={subscription === "prepaid_temp_storage_120d"}>
|
|
|
|
<ul>
|
|
|
|
<li>Base price of €1 per month</li>
|
|
|
|
<li>€0.50 per TB per month for storage</li>
|
2023-09-14 01:35:27 +02:00
|
|
|
<li>
|
|
|
|
€2 per TB for data transfer (with <a
|
|
|
|
href="user/sharing/bandwidth">bandwidth sharing</a>
|
|
|
|
enabled)
|
|
|
|
</li>
|
2023-09-29 18:56:28 +02:00
|
|
|
<li>
|
|
|
|
Files expire 240 days after they are last viewed or
|
|
|
|
downloaded
|
|
|
|
</li>
|
2023-09-14 01:35:27 +02:00
|
|
|
<li>
|
|
|
|
Download page <a href="/user/sharing/branding">branding
|
|
|
|
options</a>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
File <a href="/user/sharing/embedding">embedding
|
|
|
|
control</a> options
|
|
|
|
</li>
|
2022-10-18 14:30:50 +02:00
|
|
|
</ul>
|
2022-01-11 13:28:22 +01:00
|
|
|
</div>
|
2022-10-18 14:30:50 +02:00
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<div class="feat_label" class:feat_highlight={subscription === ""}>
|
|
|
|
Free<br/>
|
|
|
|
{#if subscription === ""}
|
|
|
|
Currently active
|
|
|
|
{:else}
|
|
|
|
<button on:click={() => {subscription = ""; update("subscription")}}>
|
|
|
|
<i class="icon">money_off</i>
|
|
|
|
Activate
|
|
|
|
</button>
|
|
|
|
{/if}
|
2022-01-11 13:28:22 +01:00
|
|
|
</div>
|
2022-10-18 14:30:50 +02:00
|
|
|
<div class="feat_normal round_br" class:feat_highlight={subscription === ""}>
|
|
|
|
<ul>
|
2023-10-24 11:27:29 +02:00
|
|
|
<li>Standard free plan, files expire after 90 days.</li>
|
|
|
|
<li>Download limit of 5 GB per day</li>
|
2022-10-18 14:30:50 +02:00
|
|
|
</ul>
|
2022-01-11 13:28:22 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-10-18 14:30:50 +02:00
|
|
|
</div>
|
2022-01-11 13:28:22 +01:00
|
|
|
</section>
|
2021-11-16 21:11:59 +01:00
|
|
|
|
|
|
|
<style>
|
|
|
|
.feat_table {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
.feat_table > div {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
}
|
|
|
|
.feat_table > div > div:first-child {
|
|
|
|
flex: 0 0 25%;
|
|
|
|
max-width: 25%;
|
|
|
|
}
|
|
|
|
.feat_table > div > div {
|
|
|
|
flex: 1 1 0;
|
|
|
|
margin: 0.25em;
|
|
|
|
padding: 0.5em;
|
|
|
|
word-wrap: break-word;
|
|
|
|
hyphens: auto;
|
|
|
|
}
|
|
|
|
.feat_table > div > .feat_label {
|
|
|
|
border-top-left-radius: 0.5em;
|
|
|
|
border-bottom-left-radius: 0.5em;
|
2022-04-04 12:37:58 +02:00
|
|
|
border: 2px solid var(--separator);
|
2021-11-16 21:11:59 +01:00
|
|
|
font-size: 1.1em;
|
|
|
|
}
|
|
|
|
.feat_table > div > .feat_normal {
|
2022-04-01 20:27:38 +02:00
|
|
|
background: var(--card_color);
|
2021-11-16 21:11:59 +01:00
|
|
|
}
|
|
|
|
.feat_table > div > .feat_highlight {
|
2022-04-04 12:37:58 +02:00
|
|
|
border: 2px solid var(--highlight_color)
|
2021-11-16 21:11:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
.feat_table > div > div.round_tr { border-top-right-radius: 0.5em; }
|
|
|
|
.feat_table > div > div.round_br { border-bottom-right-radius: 0.5em; }
|
|
|
|
</style>
|