add stripe integration

This commit is contained in:
Ruben Fiszel
2023-01-27 07:29:51 +01:00
parent 83babf5772
commit 61bde2a600
6 changed files with 36 additions and 35 deletions
+12 -2
View File
@@ -233,8 +233,8 @@ async fn stripe_checkout(
params.line_items = match plan.plan.as_str() {
"team" => Some(vec![
stripe::CreateCheckoutSessionLineItems {
quantity: None,
price: Some("price_1MSdSyGU3NdFi9eLMdV6cS6F".to_string()),
quantity: Some(1),
price: Some("price_1MT2nyGU3NdFi9eLxBweLWAz".to_string()),
..Default::default()
},
stripe::CreateCheckoutSessionLineItems {
@@ -242,6 +242,16 @@ async fn stripe_checkout(
price: Some("price_1MShsNGU3NdFi9eLJMEZUW8b".to_string()),
..Default::default()
},
stripe::CreateCheckoutSessionLineItems {
quantity: None,
price: Some("price_1MT2ouGU3NdFi9eLfn1VPKiX".to_string()),
..Default::default()
},
stripe::CreateCheckoutSessionLineItems {
quantity: None,
price: Some("price_1MT2pMGU3NdFi9eLUFhcTKjH".to_string()),
..Default::default()
},
]),
"enterprise" => Some(vec![
stripe::CreateCheckoutSessionLineItems {
@@ -53,7 +53,6 @@ export async function initFlow(flow: Flow) {
}
await initFlowState(flow)
flowStore.set(flow)
function migrateFlowModule(mod: FlowModule) {
+1 -1
View File
@@ -655,7 +655,7 @@ export function addWhitespaceBeforeCapitals(word?: string): string {
}
export function isCloudHosted(): boolean {
return (get(page)?.url?.hostname == 'app.windmill.dev')
return (get(page)?.url?.hostname == 'app.windmill.dev') || true
}
export function isObject(obj: any) {
@@ -22,21 +22,8 @@
let selectedId: string = 'settings-graph'
let flow: Flow = {
path: $page.params.path,
summary: '',
edited_by: '',
edited_at: '',
value: { modules: [] },
archived: false,
extra_perms: {},
schema: emptySchema()
}
let initialPath: string = ''
initFlow(flow)
async function loadFlow(): Promise<void> {
loading = true
let flow: Flow
@@ -178,22 +178,24 @@
{#if $userStore?.is_admin || $superadmin}
<PageHeader title="Workspace Settings of {$workspaceStore}" />
<Tabs bind:selected={tab}>
<Tab size="md" value="users">
<div class="flex gap-2 items-center my-1"> Users & Invites </div>
</Tab>
<Tab size="md" value="slack">
<div class="flex gap-2 items-center my-1"> Slack Command </div>
</Tab>
{#if isCloudHosted()}
<Tab size="md" value="premium">
<div class="flex gap-2 items-center my-1"> Premium Plans </div>
<div class="overflow-x-auto scrollbar-hidden">
<Tabs bind:selected={tab}>
<Tab size="md" value="users">
<div class="flex gap-2 items-center my-1"> Users & Invites </div>
</Tab>
{/if}
<Tab size="md" value="export_delete">
<div class="flex gap-2 items-center my-1"> Export & Delete Workspace </div>
</Tab>
</Tabs>
<Tab size="md" value="slack">
<div class="flex gap-2 items-center my-1"> Slack Command </div>
</Tab>
{#if isCloudHosted()}
<Tab size="md" value="premium">
<div class="flex gap-2 items-center my-1"> Premium Plans </div>
</Tab>
{/if}
<Tab size="md" value="export_delete">
<div class="flex gap-2 items-center my-1"> Export & Delete Workspace </div>
</Tab>
</Tabs>
</div>
{#if tab == 'users'}
<PageHeader title="Members ({users?.length ?? ''})" primary={false} />
@@ -506,8 +508,8 @@
{#if planTitle == 'Team'}
{#if plan != 'team'}
<div class="mt-4 mx-auto">
<Button disabled href="/api/w/{$workspaceStore}/workspaces/checkout?plan=team"
>Upgrade to the Team plan (Coming soon)</Button
<Button href="/api/w/{$workspaceStore}/workspaces/checkout?plan=team"
>Upgrade to the Team plan</Button
>
</div>
{:else}
@@ -19,6 +19,7 @@
let interval = setInterval(async () => {
attempt += 1
if ((await WorkspaceService.getSettings({ workspace: $workspaceStore! })).customer_id) {
clearInterval(interval)
goto('/workspace_settings?tab=premium')
} else if (attempt > 10) {
sendUserToast('Subscription upgrade failed. Contact contact@windmill.dev', true)
@@ -41,7 +42,9 @@
You will be redirected to the workspace settings page in 5 seconds...
</p>
{:else}
<p class="text-sm my-6 text-gray-600"> Waiting for your upgrade to be processed... </p>
<p class="text-sm my-6 text-gray-600 w-full text-center">
Waiting for your upgrade to be processed...
</p>
{/if}
<div class="block m-auto w-20">