Skip to content

Commit c929e2e

Browse files
devin-ai-integration[bot]JH Tevis
andauthored
Restore Cal.com booking capability with 5+ employee threshold (#1510)
- Add missing imports: urllib.parse and CAL_REQUEST_DEMO_URL - Restore is_small_company() method with updated 5+ employee threshold - Restore conditional logic in submit method: - Small companies (1, 2-5 employees): show thank you modal - Larger companies (6+ employees): redirect to Cal.com with form data - Tested both paths successfully in browser Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: JH Tevis <[email protected]>
1 parent bdcb9f0 commit c929e2e

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

pcweb/pages/pricing/header.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import re
2+
import urllib.parse
23
from typing import Any, Literal
34

45
import reflex as rx
@@ -8,6 +9,7 @@
89

910
from pcweb.components.hosting_banner import HostingBannerState
1011
from pcweb.components.new_button import button
12+
from pcweb.constants import CAL_REQUEST_DEMO_URL
1113
from pcweb.pages.framework.views.companies import pricing_page_companies
1214
from pcweb.telemetry.postog_metrics import DemoEvent, send_data_to_posthog, send_data_to_slack
1315

@@ -122,6 +124,10 @@ def set_select_value(self, field: str, value: str):
122124
"""Update the selected value for a given field."""
123125
setattr(self, field, value)
124126

127+
def is_small_company(self) -> bool:
128+
"""Check if company has 5 or fewer employees."""
129+
return self.num_employees in ["1", "2-5"]
130+
125131
@rx.event
126132
def submit(self, form_data: dict[str, Any]):
127133
# LinkedIn URL validation
@@ -187,9 +193,21 @@ def submit(self, form_data: dict[str, Any]):
187193

188194
yield rx.call_script(f"try {{ ko.identify('{email}'); }} catch(e) {{ console.warn('Koala identify failed:', e); }}")
189195

190-
yield ThankYouDialogState.push(True)
191-
yield rx.redirect("/pricing?lead=1")
192-
return
196+
if self.is_small_company():
197+
yield ThankYouDialogState.push(True)
198+
yield rx.redirect("/pricing?lead=1")
199+
return
200+
201+
params = {
202+
"email": form_data.get("email", ""),
203+
"name": f"{form_data.get('first_name', '')} {form_data.get('last_name', '')}",
204+
"notes": notes_content,
205+
}
206+
207+
query_string = urllib.parse.urlencode(params)
208+
cal_url = f"{CAL_REQUEST_DEMO_URL}?{query_string}"
209+
210+
return rx.redirect(cal_url)
193211

194212

195213
@rx.event(background=True)

0 commit comments

Comments
 (0)