From bc9671d992d8d69270148ff3fa50560a76e1502a Mon Sep 17 00:00:00 2001 From: Steven Tey Date: Wed, 15 Jan 2025 07:41:56 -0800 Subject: [PATCH 1/2] Update Stripe installation URL --- apps/web/.env.example | 3 +- .../actions/get-integration-install-url.ts | 5 +-- apps/web/lib/integrations/stripe/install.ts | 33 ------------------- 3 files changed, 2 insertions(+), 39 deletions(-) delete mode 100644 apps/web/lib/integrations/stripe/install.ts diff --git a/apps/web/.env.example b/apps/web/.env.example index c5f532c823..5ddbc4f8c5 100644 --- a/apps/web/.env.example +++ b/apps/web/.env.example @@ -59,8 +59,7 @@ NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY= STRIPE_SECRET_KEY= STRIPE_WEBHOOK_SECRET= -# Stripe App -STRIPE_APP_INSTALL_URL= +# Stripe App webhook events STRIPE_APP_WEBHOOK_SECRET= # Shopify App webhook events diff --git a/apps/web/lib/actions/get-integration-install-url.ts b/apps/web/lib/actions/get-integration-install-url.ts index 6158bf92e1..199ef634ca 100644 --- a/apps/web/lib/actions/get-integration-install-url.ts +++ b/apps/web/lib/actions/get-integration-install-url.ts @@ -1,7 +1,6 @@ "use server"; import { getSlackInstallationUrl } from "../integrations/slack/install"; -import { getStripeInstallationUrl } from "../integrations/stripe/install"; import z from "../zod"; import { authActionClient } from "./safe-action"; @@ -19,9 +18,7 @@ export const getIntegrationInstallUrl = authActionClient let url: string | null = null; - if (integrationSlug === "stripe") { - url = await getStripeInstallationUrl(workspace.id); - } else if (integrationSlug === "slack") { + if (integrationSlug === "slack") { url = await getSlackInstallationUrl(workspace.id); } else { throw new Error("Invalid integration slug"); diff --git a/apps/web/lib/integrations/stripe/install.ts b/apps/web/lib/integrations/stripe/install.ts deleted file mode 100644 index d475be4fc2..0000000000 --- a/apps/web/lib/integrations/stripe/install.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { APP_DOMAIN_WITH_NGROK, nanoid } from "@dub/utils"; -import { redis } from "../../upstash"; -import z from "../../zod"; - -const envSchema = z.object({ - STRIPE_APP_INSTALL_URL: z.string(), -}); - -export const getStripeInstallationUrl = async (workspaceId: string) => { - const state = nanoid(16); - await redis.set(`stripe:install:state:${state}`, workspaceId, { - ex: 30 * 60, - }); - - const env = envSchema.safeParse(process.env); - - if (!env.success) { - throw new Error( - "Stripe App environment variables are not configured properly.", - ); - } - - const { STRIPE_APP_INSTALL_URL } = env.data; - - const url = new URL(STRIPE_APP_INSTALL_URL); - url.searchParams.set( - "redirect_uri", - `${APP_DOMAIN_WITH_NGROK}/api/stripe/integration/callback`, - ); - url.searchParams.set("state", state); - - return url.toString(); -}; From 63632bd1bd75327962a4c052e2bb35bc8670ac44 Mon Sep 17 00:00:00 2001 From: Steven Tey Date: Wed, 15 Jan 2025 10:32:46 -0800 Subject: [PATCH 2/2] bump version --- packages/utils/package.json | 2 +- packages/utils/src/constants/pricing.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/utils/package.json b/packages/utils/package.json index bed22c260e..f3079f0892 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,7 +1,7 @@ { "name": "@dub/utils", "description": "Utility functions and constants for Dub.co", - "version": "0.1.17", + "version": "0.1.18", "sideEffects": false, "main": "./dist/index.mjs", "module": "./dist/index.mjs", diff --git a/packages/utils/src/constants/pricing.tsx b/packages/utils/src/constants/pricing.tsx index 44e6511a0d..1089aec304 100644 --- a/packages/utils/src/constants/pricing.tsx +++ b/packages/utils/src/constants/pricing.tsx @@ -104,10 +104,10 @@ const BUSINESS_PLAN_MODIFIER = ({ }, { id: "webhooks", - text: "Event webhooks (beta)", + text: "Real-time webhooks", footnote: { title: - "Get notified when a link is clicked or a QR code is scanned using webhooks.", + "Use webhooks to connect Dub with your data stack and workflows – with native integrations for Segment, Zapier, Slack, and more.", cta: "Learn more.", href: "https://d.to/webhooks", },