Skip to content

Commit

Permalink
Fix webhook and sale link (#1212)
Browse files Browse the repository at this point in the history
Co-authored-by: Alek Petuskey <[email protected]>
  • Loading branch information
Alek99 and Alek Petuskey authored Feb 11, 2025
1 parent d1827c8 commit 23c0f5a
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 53 deletions.
5 changes: 3 additions & 2 deletions pcweb/constants.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import os

# pcweb constants.
API_BASE_URL_LOOPS: str = "https://app.loops.so/api/v1"
REFLEX_DEV_WEB_LANDING_FORM_URL_GET_DEMO: str = "https://cal.com/forms/f87bd9b2-b339-4915-b4d4-0098e2db4394"
REFLEX_DEV_WEB_LANDING_FORM_SALES_CALL_WEBHOOK_URL: str = "https://hooks.zapier.com/hooks/catch/20661176/2s1nxp9/"

REFLEX_DEV_WEB_NEWSLETTER_FORM_WEBHOOK_URL: str = "https://hkdk.events/t0qopjbznnp2fr"
REFLEX_DEV_WEB_PRICING_FORM_PRO_PLAN_WAITLIST_WEBHOOK_URL: str = "https://hkdk.events/amh01aq0hojled"
REFLEX_DEV_WEB_GENERAL_FORM_FEEDBACK_WEBHOOK_URL: str = "https://hkdk.events/8woee5brmxqwdr"
REFLEX_DEV_WEB_GENERAL_FORM_FEEDBACK_WEBHOOK_URL: str = os.environ.get("REFLEX_DEV_WEB_GENERAL_FORM_FEEDBACK_WEBHOOK_URL")

# pcweb urls.
REFLEX_URL = "https://reflex.dev/"
Expand Down
27 changes: 1 addition & 26 deletions pcweb/pages/hosting_countdown/waitlist.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
import httpx
import reflex as rx
from httpx import Response

from pcweb.constants import REFLEX_DEV_WEB_PRICING_FORM_PRO_PLAN_WAITLIST_WEBHOOK_URL



class WaitlistState(rx.State):

loading = False
success = False

@rx.event
async def submit_pro_waitlist(self, form_data: dict):
self.loading = True
yield

try:
with httpx.Client() as client:
response: Response = client.post(
REFLEX_DEV_WEB_PRICING_FORM_PRO_PLAN_WAITLIST_WEBHOOK_URL,
json=form_data,
)
response.raise_for_status()

self.success = True
yield rx.toast.success("Thank you for joining the waitlist!")

except httpx.HTTPError:
yield rx.toast.error("Failed to submit request. Please try again later.")

self.loading = False

def waitlist():
return rx.box(
Expand Down Expand Up @@ -72,7 +48,6 @@ def waitlist():
),
align_items="center",
)),
on_submit=WaitlistState.submit_pro_waitlist,
class_name="flex lg:flex-row flex-col gap-2 justify-center items-center",
),
class_name="flex flex-col items-center max-w-[40rem]bg-slate-1 self-center w-full",
Expand Down
4 changes: 2 additions & 2 deletions pcweb/pages/pricing/faq.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import reflex as rx
from pcweb.components.button import button

from pcweb.constants import REFLEX_DEV_WEB_LANDING_FORM_URL_GET_DEMO

def glow() -> rx.Component:
return rx.box(
Expand Down Expand Up @@ -34,7 +34,7 @@ def sales_button() -> rx.Component:
variant="secondary",
class_name="!text-slate-11 !font-semibold !text-sm",
),
href="/sales",
href=REFLEX_DEV_WEB_LANDING_FORM_URL_GET_DEMO,
is_external=True,
class_name="self-center relative",
)
Expand Down
6 changes: 3 additions & 3 deletions pcweb/pages/pricing/plan_cards.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import reflex as rx
from pcweb.components.new_button import button
from pcweb.constants import REFLEX_CLOUD_URL
from pcweb.constants import REFLEX_DEV_WEB_LANDING_FORM_URL_GET_DEMO


def radial_circle(violet: bool = False) -> rx.Component:
Expand Down Expand Up @@ -168,7 +168,7 @@ def card(
size="lg",
class_name="w-full",
),
href=(REFLEX_CLOUD_URL if button_text != "Contact sales" else "/sales"),
href=REFLEX_DEV_WEB_LANDING_FORM_URL_GET_DEMO,
is_external=True,
underline="none",
),
Expand Down Expand Up @@ -216,7 +216,7 @@ def popular_card(
size="lg",
class_name="w-full !text-sm !font-semibold",
),
href=f"{REFLEX_CLOUD_URL}/?redirect_url={REFLEX_CLOUD_URL}/billing/",
href=REFLEX_DEV_WEB_LANDING_FORM_URL_GET_DEMO,
is_external=True,
underline="none",
),
Expand Down
4 changes: 2 additions & 2 deletions pcweb/pages/pricing/table.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import reflex as rx
from pcweb.components.button import button
from pcweb.constants import REFLEX_CLOUD_URL
from pcweb.constants import REFLEX_DEV_WEB_LANDING_FORM_URL_GET_DEMO

# Constants for styling
STYLES = {
Expand Down Expand Up @@ -121,7 +121,7 @@ def create_action_button(
variant=variant,
class_name=f"{STYLES['button_base']} {extra_styles}",
),
href=REFLEX_CLOUD_URL if text != "Contact sales" else "/sales",
href=REFLEX_DEV_WEB_LANDING_FORM_URL_GET_DEMO,
is_external=True,
underline="none",
class_name="w-full flex justify-center items-center",
Expand Down
17 changes: 0 additions & 17 deletions pcweb/pages/sales.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from pcweb.components.webpage.comps import h1_title
from pcweb.constants import (
REFLEX_DEV_WEB_LANDING_FORM_SALES_CALL_WEBHOOK_URL,
REFLEX_DEV_WEB_PRICING_FORM_PRO_PLAN_WAITLIST_WEBHOOK_URL,
)
from pcweb.pages.docs import getting_started, hosting
from pcweb.templates.webpage import webpage
Expand Down Expand Up @@ -38,22 +37,6 @@ async def submit(self, form_data: dict):
self.email_sent = False
yield rx.toast.error("Failed to submit request. Please try again later.")

@rx.event
async def submit_pro_waitlist(self, form_data: dict):
try:
with httpx.Client() as client:
response: Response = client.post(
REFLEX_DEV_WEB_PRICING_FORM_PRO_PLAN_WAITLIST_WEBHOOK_URL,
json=form_data,
)
response.raise_for_status()

yield rx.toast.success("Thank you for joining the waitlist!")

except httpx.HTTPError:
yield rx.toast.error("Failed to submit request. Please try again later.")


def dialog(trigger: rx.Component, content: rx.Component) -> rx.Component:
return rx.dialog.root(
rx.dialog.trigger(
Expand Down
2 changes: 1 addition & 1 deletion pcweb/templates/docpage/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def handle_submit(self, form_data: dict):
json=form_data,
)

discord_webhook_url: str | None = os.environ.get("DISCORD_WEBHOOK_URL")
discord_webhook_url: str | None = REFLEX_DEV_WEB_GENERAL_FORM_FEEDBACK_WEBHOOK_URL
email: str = form_data.get("email", "")
discord_message = f"""
Contact: {email}
Expand Down

0 comments on commit 23c0f5a

Please sign in to comment.