mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
fix: payment page design
This commit is contained in:
1 parent
3d62a34ff1
commit
822074098a
23 files changed
+270
-220
No files matched your search
@@ -0,0 +1,14 @@
|
||||
<script lang="ts">
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
|
||||
export let brand: string;
|
||||
export let width = 23;
|
||||
export let height = 16;
|
||||
|
||||
function getCreditCardImage(brand: string, width = 46, height = 32) {
|
||||
if (!brand) return '';
|
||||
return sdk.forConsole.avatars.getCreditCard(brand, width, height).toString();
|
||||
}
|
||||
</script>
|
||||
|
||||
<img style="border-radius: 2.5px" {width} {height} src={getCreditCardImage(brand)} alt={brand} />
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import type { PaymentMethodData } from '$lib/sdk/billing';
|
||||
import { getCreditCardImage } from '$lib/stores/billing';
|
||||
import { Alert } from '.';
|
||||
import CreditCardBrandImage from './creditCardBrandImage.svelte';
|
||||
|
||||
export let isBox = false;
|
||||
export let paymentMethod: PaymentMethodData;
|
||||
@@ -9,16 +9,12 @@
|
||||
|
||||
<div class:box={isBox}>
|
||||
<div class="u-flex u-main-space-between u-cross-start">
|
||||
<div class="u-line-height-1-5">
|
||||
<div class="u-line-height-1-5 u-flex u-flex-vertical u-gap-2">
|
||||
<span class="u-flex u-cross-center u-gap-8">
|
||||
<p class="text u-bold">
|
||||
<span class="u-capitalize">{paymentMethod?.brand}</span> ending in {paymentMethod?.last4}
|
||||
</p>
|
||||
<img
|
||||
width="23"
|
||||
height="16"
|
||||
src={getCreditCardImage(paymentMethod?.brand)}
|
||||
alt={paymentMethod?.brand} />
|
||||
<CreditCardBrandImage brand={paymentMethod?.brand} />
|
||||
</span>
|
||||
<p class="text">
|
||||
Expires {paymentMethod?.expiryMonth}/{paymentMethod?.expiryYear}
|
||||
|
||||
@@ -59,6 +59,7 @@ export { default as ProgressBar } from './progressBar.svelte';
|
||||
export { default as ProgressBarBig } from './progressBarBig.svelte';
|
||||
export { default as ProjectUsage } from './projectUsage.svelte';
|
||||
export { default as CreditCardInfo } from './creditCardInfo.svelte';
|
||||
export { default as CreditCardBrandImage } from './creditCardBrandImage.svelte';
|
||||
export { default as CardPlanLimit } from './cardPlanLimit.svelte';
|
||||
export { default as NumericList } from './numericList.svelte';
|
||||
export { default as NumericListItem } from './numericListItem.svelte';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
import { FormItem, FormItemPart, Helper, Label } from '.';
|
||||
import NullCheckbox from './nullCheckbox.svelte';
|
||||
|
||||
export let label: string | undefined = undefined;
|
||||
@@ -17,6 +17,8 @@
|
||||
export let min: number = null;
|
||||
export let max: number = null;
|
||||
export let step: number | 'any' = 1;
|
||||
export let isMultiple = false;
|
||||
export let fullWidth = false;
|
||||
|
||||
let element: HTMLInputElement;
|
||||
let error: string;
|
||||
@@ -62,9 +64,11 @@
|
||||
value = prevValue;
|
||||
}
|
||||
}
|
||||
|
||||
$: wrapper = isMultiple ? FormItemPart : FormItem;
|
||||
</script>
|
||||
|
||||
<FormItem>
|
||||
<svelte:component this={wrapper} {fullWidth}>
|
||||
{#if label}
|
||||
<Label {required} {optionalText} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
@@ -99,4 +103,4 @@
|
||||
{#if error}
|
||||
<Helper type="warning">{error}</Helper>
|
||||
{/if}
|
||||
</FormItem>
|
||||
</svelte:component>
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
import { FormItem, FormItemPart, Helper, Label } from '.';
|
||||
import type { FormItemTag } from './formItem.svelte';
|
||||
|
||||
export let id: string;
|
||||
@@ -16,6 +16,8 @@
|
||||
value: string | boolean | number;
|
||||
label: string;
|
||||
}[];
|
||||
export let isMultiple = false;
|
||||
export let fullWidth = false;
|
||||
|
||||
let element: HTMLSelectElement;
|
||||
let error: string;
|
||||
@@ -45,9 +47,10 @@
|
||||
}
|
||||
|
||||
$: hasNullOption = options.some((option) => option.value === null);
|
||||
$: wrapper = isMultiple ? FormItemPart : FormItem;
|
||||
</script>
|
||||
|
||||
<FormItem tag={wrapperTag}>
|
||||
<svelte:component this={wrapper} {fullWidth} tag={wrapperTag}>
|
||||
{#if label}
|
||||
<Label {required} {hideRequired} {optionalText} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
@@ -79,4 +82,4 @@
|
||||
{:else}
|
||||
<slot name="helper" />
|
||||
{/if}
|
||||
</FormItem>
|
||||
</svelte:component>
|
||||
@@ -5,10 +5,11 @@
|
||||
export let showOverflow = false;
|
||||
let className = '';
|
||||
export { className as class };
|
||||
export let style = '';
|
||||
</script>
|
||||
|
||||
<div
|
||||
style={width ? `--p-col-width:${width?.toString()}` : ''}
|
||||
style={`${style} ${width ? `--p-col-width:${width?.toString()}` : ''}`}
|
||||
class="table-col {className}"
|
||||
class:u-overflow-visible={showOverflow}
|
||||
class:is-only-desktop={onlyDesktop}
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
export let width: number = null;
|
||||
export let onlyDesktop = false;
|
||||
export let eyebrow = true;
|
||||
export let style = '';
|
||||
</script>
|
||||
|
||||
<div
|
||||
style:--p-col-width={width?.toString()}
|
||||
class:is-only-desktop={onlyDesktop}
|
||||
{style}
|
||||
class="table-thead-col"
|
||||
role="columnheader">
|
||||
<span class={eyebrow ? 'eyebrow-heading-3' : 'body-text-2 u-bold'}>
|
||||
|
||||
@@ -710,19 +710,19 @@ export class Billing {
|
||||
async createAddress(
|
||||
country: string,
|
||||
streetAddress: string,
|
||||
addressLine2: string,
|
||||
city: string,
|
||||
state: string,
|
||||
postalCode: string
|
||||
postalCode: string,
|
||||
addressLine2?: string
|
||||
): Promise<Address> {
|
||||
const path = `/account/billing-addresses`;
|
||||
const params = {
|
||||
country,
|
||||
streetAddress,
|
||||
addressLine2,
|
||||
city,
|
||||
state,
|
||||
postalCode
|
||||
postalCode,
|
||||
addressLine2
|
||||
};
|
||||
const uri = new URL(this.client.config.endpoint + path);
|
||||
return await this.client.call(
|
||||
@@ -738,20 +738,20 @@ export class Billing {
|
||||
billingAddressId: string,
|
||||
country: string,
|
||||
streetAddress: string,
|
||||
addressLine2: string,
|
||||
city: string,
|
||||
state: string,
|
||||
postalCode: string
|
||||
postalCode: string,
|
||||
addressLine2?: string
|
||||
): Promise<Address> {
|
||||
const path = `/account/billing-addresses/${billingAddressId}`;
|
||||
const params = {
|
||||
billingAddressId,
|
||||
country,
|
||||
streetAddress,
|
||||
addressLine2,
|
||||
city,
|
||||
state,
|
||||
postalCode
|
||||
postalCode,
|
||||
addressLine2
|
||||
};
|
||||
const uri = new URL(this.client.config.endpoint + path);
|
||||
return await this.client.call(
|
||||
|
||||
@@ -42,11 +42,6 @@ export function tierToPlan(tier: Tier) {
|
||||
}
|
||||
}
|
||||
|
||||
export function getCreditCardImage(brand: string, width = 46, height = 32) {
|
||||
if (!brand) return '';
|
||||
return sdk.forConsole.avatars.getCreditCard(brand, width, height).toString();
|
||||
}
|
||||
|
||||
export function getServiceLimit(serviceId: string): number {
|
||||
if (!isCloud) return 0;
|
||||
if (!serviceId) return 0;
|
||||
@@ -102,62 +97,3 @@ export const tierScale: TierData = {
|
||||
description: 'For scaling teams that need dedicated support.',
|
||||
collaboratorPrice: 0
|
||||
};
|
||||
|
||||
export const apperanceLight = {
|
||||
variables: {
|
||||
colorPrimary: '#606a7b',
|
||||
colorText: 'rgb(107, 107, 112)',
|
||||
colorBackground: '#FFFFFF',
|
||||
color: '#606a7b',
|
||||
colorDanger: '#df1b41',
|
||||
fontFamily: 'Inter, arial, sans-serif',
|
||||
borderRadius: '4px',
|
||||
fontSizeBase: '14px'
|
||||
},
|
||||
rules: {
|
||||
'.Input:hover': {
|
||||
border: 'solid 1px rgb(195, 195, 198)',
|
||||
boxShadow: 'none'
|
||||
},
|
||||
'.Input:focus': {
|
||||
border: 'solid 1px rgb(195, 195, 198)',
|
||||
boxShadow: 'none'
|
||||
},
|
||||
'.Input::placeholder': {
|
||||
color: '#C4C6D7'
|
||||
},
|
||||
'.Input--invalid': {
|
||||
border: 'solid 1px var(--colorDanger)',
|
||||
boxShadow: 'none'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const apperanceDark = {
|
||||
variables: {
|
||||
colorPrimary: '#606a7b',
|
||||
colorText: 'rgb(195, 195, 198)',
|
||||
colorBackground: 'rgb(24, 24, 27)',
|
||||
colorDanger: '#FF453A',
|
||||
fontFamily: 'Inter, arial, sans-serif',
|
||||
borderRadius: '4px',
|
||||
fontSizeBase: '14px'
|
||||
},
|
||||
rules: {
|
||||
'.Input:hover': {
|
||||
border: 'solid 1px rgb(87, 87, 92)',
|
||||
boxShadow: 'none'
|
||||
},
|
||||
'.Input:focus': {
|
||||
border: 'solid 1px rgb(87, 87, 92)',
|
||||
boxShadow: 'none'
|
||||
},
|
||||
'.Input::placeholder': {
|
||||
color: 'rgb(87, 87, 92)'
|
||||
},
|
||||
'.Input--invalid': {
|
||||
border: 'solid 1px var(--colorDanger)',
|
||||
boxShadow: 'none'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
import { sdk } from './sdk';
|
||||
import { app } from './app';
|
||||
import { get, writable } from 'svelte/store';
|
||||
import { apperanceDark, apperanceLight } from './billing';
|
||||
import type { PaymentMethodData } from '$lib/sdk/billing';
|
||||
|
||||
let stripe: Stripe;
|
||||
@@ -99,3 +98,61 @@ export async function submitStripeCard(name?: string, urlRoute?: string) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
const apperanceLight = {
|
||||
variables: {
|
||||
colorPrimary: '#606a7b',
|
||||
colorText: 'rgb(107, 107, 112)',
|
||||
colorBackground: '#FFFFFF',
|
||||
color: '#606a7b',
|
||||
colorDanger: '#df1b41',
|
||||
fontFamily: 'Inter, arial, sans-serif',
|
||||
borderRadius: '4px'
|
||||
},
|
||||
rules: {
|
||||
'.Input:hover': {
|
||||
border: 'solid 1px rgb(195, 195, 198)',
|
||||
boxShadow: 'none'
|
||||
},
|
||||
'.Input:focus': {
|
||||
border: 'solid 1px rgb(195, 195, 198)',
|
||||
boxShadow: 'none'
|
||||
},
|
||||
'.Input::placeholder': {
|
||||
color: '#C4C6D7'
|
||||
},
|
||||
'.Input--invalid': {
|
||||
border: 'solid 1px var(--colorDanger)',
|
||||
boxShadow: 'none'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const apperanceDark = {
|
||||
variables: {
|
||||
colorPrimary: '#606a7b',
|
||||
colorText: 'rgb(195, 195, 198)',
|
||||
colorBackground: 'rgb(24, 24, 27)',
|
||||
colorDanger: '#FF453A',
|
||||
fontFamily: 'Inter, arial, sans-serif',
|
||||
borderRadius: '4px',
|
||||
spacingGridRow: '16px'
|
||||
},
|
||||
rules: {
|
||||
'.Input:hover': {
|
||||
border: 'solid 1px rgb(87, 87, 92)',
|
||||
boxShadow: 'none'
|
||||
},
|
||||
'.Input:focus': {
|
||||
border: 'solid 1px rgb(87, 87, 92)',
|
||||
boxShadow: 'none'
|
||||
},
|
||||
'.Input::placeholder': {
|
||||
color: 'rgb(87, 87, 92)'
|
||||
},
|
||||
'.Input--invalid': {
|
||||
border: 'solid 1px var(--colorDanger)',
|
||||
boxShadow: 'none'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -43,7 +43,7 @@
|
||||
...permanentTabs,
|
||||
{
|
||||
href: `${path}/payments`,
|
||||
title: 'Payments details',
|
||||
title: 'Payment details',
|
||||
event: 'payments',
|
||||
hasChildren: true
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { Heading } from '$lib/components';
|
||||
import { Container } from '$lib/layout';
|
||||
import BillingAddress from './billingAddress.svelte';
|
||||
import PaymentMethods from './paymentMethods.svelte';
|
||||
import BillingAddress from './billingAddress.svelte';
|
||||
|
||||
// export let data;
|
||||
let showPayment = false;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, InputSelect, InputText } from '$lib/elements/forms';
|
||||
import { Button, FormItem, FormList, InputSelect, InputText } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { onMount } from 'svelte';
|
||||
@@ -39,10 +39,10 @@
|
||||
await sdk.forConsole.billing.createAddress(
|
||||
country,
|
||||
address,
|
||||
address2,
|
||||
city,
|
||||
state,
|
||||
zip
|
||||
zip,
|
||||
address2 ? address2 : undefined
|
||||
);
|
||||
await invalidate(Dependencies.ADDRESS);
|
||||
show = false;
|
||||
@@ -61,42 +61,51 @@
|
||||
</script>
|
||||
|
||||
<Modal bind:show bind:error onSubmit={handleSubmit} size="big" title="Add billing address">
|
||||
<InputSelect
|
||||
bind:value={country}
|
||||
{options}
|
||||
label="Country or region"
|
||||
placeholder="Select country or region"
|
||||
id="country"
|
||||
required />
|
||||
<InputText
|
||||
bind:value={address}
|
||||
id="address"
|
||||
label="Street address"
|
||||
placeholder="Enter street address"
|
||||
required />
|
||||
<InputText
|
||||
bind:value={address2}
|
||||
id="address2"
|
||||
label="Address line 2"
|
||||
placeholder="Unit number, floor, etc." />
|
||||
<InputText
|
||||
bind:value={city}
|
||||
id="city"
|
||||
label="City or suburb"
|
||||
placeholder="Enter your city"
|
||||
required />
|
||||
<InputText
|
||||
bind:value={state}
|
||||
id="state"
|
||||
label="State"
|
||||
placeholder="Enter your state"
|
||||
required />
|
||||
<InputText
|
||||
bind:value={zip}
|
||||
id="zip"
|
||||
label="Postal code"
|
||||
placeholder="Enter postal code"
|
||||
required />
|
||||
<FormList gap={16}>
|
||||
<InputSelect
|
||||
bind:value={country}
|
||||
{options}
|
||||
label="Country or region"
|
||||
placeholder="Select country or region"
|
||||
id="country"
|
||||
required />
|
||||
<InputText
|
||||
bind:value={address}
|
||||
id="address"
|
||||
label="Street address"
|
||||
placeholder="Enter street address"
|
||||
required />
|
||||
<InputText
|
||||
bind:value={address2}
|
||||
id="address2"
|
||||
label="Address line 2"
|
||||
placeholder="Unit number, floor, etc." />
|
||||
<InputText
|
||||
bind:value={city}
|
||||
id="city"
|
||||
label="City or suburb"
|
||||
placeholder="Enter your city"
|
||||
required />
|
||||
<FormItem isMultiple>
|
||||
<InputText
|
||||
isMultiple
|
||||
fullWidth
|
||||
bind:value={state}
|
||||
id="state"
|
||||
label="State"
|
||||
placeholder="Enter your state"
|
||||
required />
|
||||
<InputText
|
||||
isMultiple
|
||||
fullWidth
|
||||
bind:value={zip}
|
||||
id="zip"
|
||||
label="Postal code"
|
||||
placeholder="Enter postal code"
|
||||
required />
|
||||
</FormItem>
|
||||
</FormList>
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
<Button text on:click={() => (show = false)}>Cancel</Button>
|
||||
<Button submit disabled={isButtonDisabled}>Save</Button>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</p>
|
||||
<svelte:fragment slot="aside">
|
||||
{#if $addressList.total && countryList?.total}
|
||||
<Table noMargin noStyles>
|
||||
<Table noMargin noStyles transparent>
|
||||
<TableHeader>
|
||||
<TableCellHead>Billing address</TableCellHead>
|
||||
<TableCellHead width={40} />
|
||||
@@ -58,7 +58,7 @@
|
||||
<p class="text">{country ? country.name : address.country}</p>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<TableCell style="vertical-align: top;">
|
||||
<DropList
|
||||
bind:show={showDropdown[i]}
|
||||
placement="bottom-start"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
@@ -53,13 +54,22 @@
|
||||
This payment method is set as the default for the following organisations. As they have
|
||||
upcoming invoices it cannot be deleted from your account.
|
||||
</p>
|
||||
<ul class="list" />
|
||||
<ul>
|
||||
{#each linkedOrgs as org}
|
||||
<li class="text">
|
||||
<a class="link" href={`${base}/console/organization-${org.$id}/billing`}
|
||||
>{org.name}</a>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{:else}
|
||||
<p class="text">Are you sure you want to delete this payment method from your account?</p>
|
||||
{/if}
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
<Button text on:click={() => (showDelete = false)}>Cancel</Button>
|
||||
<Button secondary submit disabled={!!linkedOrgs.length}>Delete</Button>
|
||||
{#if !linkedOrgs.length}
|
||||
<Button secondary submit>Delete</Button>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
</Modal>
|
||||
@@ -3,7 +3,14 @@
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button, InputNumber, InputSelect, InputText } from '$lib/elements/forms';
|
||||
import {
|
||||
Button,
|
||||
FormItem,
|
||||
FormList,
|
||||
InputNumber,
|
||||
InputSelect,
|
||||
InputText
|
||||
} from '$lib/elements/forms';
|
||||
import type { Address } from '$lib/sdk/billing';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
@@ -36,7 +43,7 @@
|
||||
selectedAddress.$id,
|
||||
selectedAddress.country,
|
||||
selectedAddress.streetAddress,
|
||||
selectedAddress.addressLine2,
|
||||
selectedAddress.addressLine2 ? selectedAddress.addressLine2 : undefined,
|
||||
selectedAddress.city,
|
||||
selectedAddress.state,
|
||||
selectedAddress.postalCode
|
||||
@@ -58,43 +65,51 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal bind:show onSubmit={handleSubmit} size="big" title="Edit billing address">
|
||||
<InputSelect
|
||||
bind:value={selectedAddress.country}
|
||||
{options}
|
||||
label="Country or region"
|
||||
placeholder="Select country or region"
|
||||
id="country"
|
||||
required />
|
||||
<InputText
|
||||
bind:value={selectedAddress.streetAddress}
|
||||
id="address"
|
||||
label="Street address"
|
||||
placeholder="Enter street address"
|
||||
required />
|
||||
<InputText
|
||||
bind:value={selectedAddress.addressLine2}
|
||||
id="address2"
|
||||
label="Address line 2"
|
||||
placeholder="Unit number, floor, etc." />
|
||||
<InputText
|
||||
bind:value={selectedAddress.city}
|
||||
id="city"
|
||||
label="City or suburb"
|
||||
placeholder="Enter your city"
|
||||
required />
|
||||
<InputText
|
||||
bind:value={selectedAddress.state}
|
||||
id="state"
|
||||
label="State"
|
||||
placeholder="Enter your state"
|
||||
required />
|
||||
<InputNumber
|
||||
bind:value={zip}
|
||||
id="zip"
|
||||
label="Postal code"
|
||||
placeholder="Enter postal code"
|
||||
required />
|
||||
<Modal bind:show onSubmit={handleSubmit} size="big" title="Update billing address">
|
||||
<FormList gap={16}>
|
||||
<InputSelect
|
||||
bind:value={selectedAddress.country}
|
||||
{options}
|
||||
label="Country or region"
|
||||
placeholder="Select country or region"
|
||||
id="country"
|
||||
required />
|
||||
<InputText
|
||||
bind:value={selectedAddress.streetAddress}
|
||||
id="address"
|
||||
label="Street address"
|
||||
placeholder="Enter street address"
|
||||
required />
|
||||
<InputText
|
||||
bind:value={selectedAddress.addressLine2}
|
||||
id="address2"
|
||||
label="Address line 2"
|
||||
placeholder="Unit number, floor, etc." />
|
||||
<InputText
|
||||
bind:value={selectedAddress.city}
|
||||
id="city"
|
||||
label="City or suburb"
|
||||
placeholder="Enter your city"
|
||||
required />
|
||||
<FormItem isMultiple>
|
||||
<InputText
|
||||
isMultiple
|
||||
fullWidth
|
||||
bind:value={selectedAddress.state}
|
||||
id="state"
|
||||
label="State"
|
||||
placeholder="Enter your state"
|
||||
required />
|
||||
<InputNumber
|
||||
isMultiple
|
||||
fullWidth
|
||||
bind:value={zip}
|
||||
id="zip"
|
||||
label="Postal code"
|
||||
placeholder="Enter postal code"
|
||||
required />
|
||||
</FormItem>
|
||||
</FormList>
|
||||
<svelte:fragment slot="footer">
|
||||
<Button text on:click={() => (show = false)}>Cancel</Button>
|
||||
<Button submit>Save</Button>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
// import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { Alert, Modal } from '$lib/components';
|
||||
import { Button, FormList, InputNumber, InputSelect } from '$lib/elements/forms';
|
||||
import { Button, FormItem, FormList, InputNumber, InputSelect } from '$lib/elements/forms';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
export let show = false;
|
||||
export let selectedPaymentMethod: PaymentMethodData;
|
||||
export let isLinked = false;
|
||||
|
||||
const options = [
|
||||
{ value: '01', label: '01' },
|
||||
@@ -61,23 +62,32 @@
|
||||
<svelte:fragment slot="title">This payment method has expired</svelte:fragment>
|
||||
</Alert>
|
||||
{/if}
|
||||
{#if isLinked}
|
||||
Updates to this payment method will be applied to any linked organizations.
|
||||
{/if}
|
||||
<FormList>
|
||||
<InputSelect
|
||||
id="month"
|
||||
label="Month"
|
||||
bind:value={month}
|
||||
{options}
|
||||
required
|
||||
placeholder="Select expiry month" />
|
||||
<InputNumber
|
||||
id="year"
|
||||
label="Year"
|
||||
bind:value={year}
|
||||
required
|
||||
placeholder="Select expiry year" />
|
||||
<FormItem isMultiple>
|
||||
<InputSelect
|
||||
isMultiple
|
||||
fullWidth
|
||||
id="month"
|
||||
label="Month"
|
||||
bind:value={month}
|
||||
{options}
|
||||
required
|
||||
placeholder="Select expiry month" />
|
||||
<InputNumber
|
||||
isMultiple
|
||||
fullWidth
|
||||
id="year"
|
||||
label="Year"
|
||||
bind:value={year}
|
||||
required
|
||||
placeholder="Select expiry year" />
|
||||
</FormItem>
|
||||
</FormList>
|
||||
<svelte:fragment slot="footer">
|
||||
<Button secondary on:click={() => (show = false)}>Cancel</Button>
|
||||
<Button submit>Update</Button>
|
||||
<Button submit disabled={!month || !year}>Update</Button>
|
||||
</svelte:fragment>
|
||||
</Modal>
|
||||
@@ -33,6 +33,7 @@
|
||||
let selectedLinkedOrgs: Organization[] = [];
|
||||
let showDelete = false;
|
||||
let showEdit = false;
|
||||
let isLinked = false;
|
||||
|
||||
$: orgList = $organizationList.teams as unknown as Organization[];
|
||||
|
||||
@@ -107,6 +108,7 @@
|
||||
showEdit = true;
|
||||
showDropdown[i] = false;
|
||||
selectedMethod = paymentMethod;
|
||||
isLinked = !!linkedOrgs?.length;
|
||||
}}>
|
||||
Edit
|
||||
</DropListItem>
|
||||
@@ -145,7 +147,7 @@
|
||||
<PaymentModal bind:show={showPayment} />
|
||||
{/if}
|
||||
{#if showEdit && isCloud && hasStripePublicKey}
|
||||
<EditPaymentModal selectedPaymentMethod={selectedMethod} bind:show={showEdit} />
|
||||
<EditPaymentModal selectedPaymentMethod={selectedMethod} bind:show={showEdit} {isLinked} />
|
||||
{/if}
|
||||
|
||||
{#if selectedMethod}
|
||||
|
||||
@@ -112,14 +112,15 @@
|
||||
{error}
|
||||
</Alert>
|
||||
{/if}
|
||||
<FormList>
|
||||
<FormList gap={16}>
|
||||
<InputText
|
||||
id="name"
|
||||
label="Cardholder name"
|
||||
placeholder="Cardholder name"
|
||||
bind:value={name}
|
||||
required
|
||||
autofocus={true} />
|
||||
autofocus={true}
|
||||
hideRequired />
|
||||
|
||||
<div id="payment-element">
|
||||
<!-- Elements will create form elements here -->
|
||||
|
||||
@@ -2,14 +2,21 @@
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { CardGrid, CreditCardInfo, DropList, DropListItem, Heading } from '$lib/components';
|
||||
import {
|
||||
CardGrid,
|
||||
CreditCardBrandImage,
|
||||
CreditCardInfo,
|
||||
DropList,
|
||||
DropListItem,
|
||||
Heading
|
||||
} from '$lib/components';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import PaymentModal from '$routes/console/account/payments/paymentModal.svelte';
|
||||
import { hasStripePublicKey, isCloud } from '$lib/system';
|
||||
import { getCreditCardImage, paymentMethods } from '$lib/stores/billing';
|
||||
import { paymentMethods } from '$lib/stores/billing';
|
||||
import type { PaymentMethodData } from '$lib/sdk/billing';
|
||||
import DeleteOrgPayment from './deleteOrgPayment.svelte';
|
||||
import ReplaceCard from './replaceCard.svelte';
|
||||
@@ -154,11 +161,8 @@
|
||||
<p class="text">
|
||||
Card ending in {paymentMethod.last4}
|
||||
</p>
|
||||
<img
|
||||
width="23"
|
||||
height="16"
|
||||
src={getCreditCardImage(paymentMethod?.brand)}
|
||||
alt={paymentMethod?.brand} />
|
||||
<CreditCardBrandImage
|
||||
brand={paymentMethod?.brand} />
|
||||
</span>
|
||||
</DropListItem>
|
||||
{/each}
|
||||
@@ -243,11 +247,8 @@
|
||||
<p class="text">
|
||||
Card ending in {paymentMethod.last4}
|
||||
</p>
|
||||
<img
|
||||
width="23"
|
||||
height="16"
|
||||
src={getCreditCardImage(paymentMethod?.brand)}
|
||||
alt={paymentMethod?.brand} />
|
||||
<CreditCardBrandImage
|
||||
brand={paymentMethod?.brand} />
|
||||
</span>
|
||||
</DropListItem>
|
||||
{/each}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Modal } from '$lib/components';
|
||||
import { CreditCardBrandImage, Modal } from '$lib/components';
|
||||
import { Button, FormList, InputRadio, InputText } from '$lib/elements/forms';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
@@ -8,7 +8,6 @@
|
||||
import { initializeStripe, isStripeInitialized, submitStripeCard } from '$lib/stores/stripe';
|
||||
import { onMount } from 'svelte';
|
||||
import type { PaymentList } from '$lib/sdk/billing';
|
||||
import { getCreditCardImage } from '$lib/stores/billing';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { Pill } from '$lib/elements';
|
||||
@@ -124,11 +123,7 @@
|
||||
<span class="u-flex u-cross-center u-gap-8">
|
||||
<span>
|
||||
<span class="u-capitalize">{method.brand}</span> ending in {method.last4}</span>
|
||||
<img
|
||||
width="23"
|
||||
height="16"
|
||||
src={getCreditCardImage(method.brand)}
|
||||
alt={method.brand} />
|
||||
<CreditCardBrandImage brand={method.brand} />
|
||||
</span>
|
||||
{#if method.$id === $organization.backupPaymentMethodId}
|
||||
<Pill>Backup</Pill>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { initializeStripe, isStripeInitialized, submitStripeCard } from '$lib/stores/stripe';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { getCreditCardImage } from '$lib/stores/billing';
|
||||
import { CreditCardBrandImage } from '$lib/components';
|
||||
|
||||
let methods: PaymentList;
|
||||
let name: string;
|
||||
@@ -64,11 +64,7 @@
|
||||
<span class="u-flex u-cross-center u-gap-8">
|
||||
<span>
|
||||
<span class="u-capitalize">{method.brand}</span> ending in {method.last4}</span>
|
||||
<img
|
||||
width="23"
|
||||
height="16"
|
||||
src={getCreditCardImage(method.brand)}
|
||||
alt={method.brand} />
|
||||
<CreditCardBrandImage brand={method.brand} />
|
||||
</span>
|
||||
</InputRadio>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { CreditCardBrandImage } from '$lib/components';
|
||||
import { Pill } from '$lib/elements';
|
||||
import { toLocaleDate } from '$lib/helpers/date';
|
||||
import { WizardStep } from '$lib/layout';
|
||||
import { getCreditCardImage, tierToPlan } from '$lib/stores/billing';
|
||||
import { tierToPlan } from '$lib/stores/billing';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { createOrganization } from './store';
|
||||
|
||||
@@ -56,11 +57,7 @@
|
||||
<p class="text u-bold">
|
||||
<span class="u-capitalize">{card?.brand}</span> ending in {card?.last4}
|
||||
</p>
|
||||
<img
|
||||
width="23"
|
||||
height="16"
|
||||
src={getCreditCardImage(card?.brand)}
|
||||
alt={card?.brand} />
|
||||
<CreditCardBrandImage brand={card?.brand} />
|
||||
</span>
|
||||
{/await}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user