From 61bde2a600da8d6ac1752b0bd640cc22893268d1 Mon Sep 17 00:00:00 2001
From: Ruben Fiszel
Date: Tue, 24 Jan 2023 06:52:16 +0100
Subject: [PATCH] add stripe integration
---
backend/windmill-api/src/workspaces.rs | 14 ++++++--
.../src/lib/components/flows/flowStore.ts | 1 -
frontend/src/lib/utils.ts | 2 +-
.../flows/edit/[...path]/+page.svelte | 13 -------
.../(logged)/workspace_settings/+page.svelte | 36 ++++++++++---------
.../workspace_settings/checkout/+page.svelte | 5 ++-
6 files changed, 36 insertions(+), 35 deletions(-)
diff --git a/backend/windmill-api/src/workspaces.rs b/backend/windmill-api/src/workspaces.rs
index 1ed96d88a9..1cbf15a48a 100644
--- a/backend/windmill-api/src/workspaces.rs
+++ b/backend/windmill-api/src/workspaces.rs
@@ -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 {
diff --git a/frontend/src/lib/components/flows/flowStore.ts b/frontend/src/lib/components/flows/flowStore.ts
index 521e172c3a..5bd7e26f90 100644
--- a/frontend/src/lib/components/flows/flowStore.ts
+++ b/frontend/src/lib/components/flows/flowStore.ts
@@ -53,7 +53,6 @@ export async function initFlow(flow: Flow) {
}
await initFlowState(flow)
-
flowStore.set(flow)
function migrateFlowModule(mod: FlowModule) {
diff --git a/frontend/src/lib/utils.ts b/frontend/src/lib/utils.ts
index 42bdf47a9a..828609146f 100644
--- a/frontend/src/lib/utils.ts
+++ b/frontend/src/lib/utils.ts
@@ -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) {
diff --git a/frontend/src/routes/(root)/(logged)/flows/edit/[...path]/+page.svelte b/frontend/src/routes/(root)/(logged)/flows/edit/[...path]/+page.svelte
index d466d76fe4..5f7f242032 100644
--- a/frontend/src/routes/(root)/(logged)/flows/edit/[...path]/+page.svelte
+++ b/frontend/src/routes/(root)/(logged)/flows/edit/[...path]/+page.svelte
@@ -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 {
loading = true
let flow: Flow
diff --git a/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte b/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte
index 7cebf31042..53758176bd 100644
--- a/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte
+++ b/frontend/src/routes/(root)/(logged)/workspace_settings/+page.svelte
@@ -178,22 +178,24 @@
{#if $userStore?.is_admin || $superadmin}
-
-
- Users & Invites
-
-
- Slack Command
-
- {#if isCloudHosted()}
-
- Premium Plans
+
{#if tab == 'users'}
@@ -506,8 +508,8 @@
{#if planTitle == 'Team'}
{#if plan != 'team'}
- Upgrade to the Team plan
{:else}
diff --git a/frontend/src/routes/(root)/(logged)/workspace_settings/checkout/+page.svelte b/frontend/src/routes/(root)/(logged)/workspace_settings/checkout/+page.svelte
index f7be030773..f8bef99813 100644
--- a/frontend/src/routes/(root)/(logged)/workspace_settings/checkout/+page.svelte
+++ b/frontend/src/routes/(root)/(logged)/workspace_settings/checkout/+page.svelte
@@ -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...
{:else}
- Waiting for your upgrade to be processed...
+
+ Waiting for your upgrade to be processed...
+
{/if}