instruction
stringlengths 0
1k
| input
stringlengths 1
1k
| output
stringlengths 10
6.51k
|
|---|---|---|
"""Welcome to Reflex! This file outlines the steps to create a basic app."""
|
import reflex_ui as ui
class State(rx.State):
seed: int = 0
@rx.event
def set_seed(self, seed: int):
self.seed = seed
def index() -> rx.Component:
return rx.el.div(
rx.el.div(
ui.tooltip(
ui.button(
ui.icon("SmileIcon"),
"Click me",
on_click=rx.toast.success(
"You are cool :)",
position="top-center",
),
),
content="Seriously, click me",
),
ui.checkbox(
label="Click me",
on_checked_change=lambda value: rx.toast.success(f"Value: {value}"),
),
ui.slider(
value=State.seed,
on_value_change=State.set_seed,
on_value_committed=lambda value: rx.toast.success(f"Value: {value}"),
class_name="max-w-xs",
),
ui.
|
import reflex as rx
|
"""Welcome to Reflex! This file outlines the steps to create a basic app."""
import reflex as rx
|
class State(rx.State):
seed: int = 0
@rx.event
def set_seed(self, seed: int):
self.seed = seed
def index() -> rx.Component:
return rx.el.div(
rx.el.div(
ui.tooltip(
ui.button(
ui.icon("SmileIcon"),
"Click me",
on_click=rx.toast.success(
"You are cool :)",
position="top-center",
),
),
content="Seriously, click me",
),
ui.checkbox(
label="Click me",
on_checked_change=lambda value: rx.toast.success(f"Value: {value}"),
),
ui.slider(
value=State.seed,
on_value_change=State.set_seed,
on_value_committed=lambda value: rx.toast.success(f"Value: {value}"),
class_name="max-w-xs",
),
ui.gradient_profile(
|
import reflex_ui as ui
|
"""Welcome to Reflex! This file outlines the steps to create a basic app."""
import reflex as rx
import reflex_ui as ui
|
def index() -> rx.Component:
return rx.el.div(
rx.el.div(
ui.tooltip(
ui.button(
ui.icon("SmileIcon"),
"Click me",
on_click=rx.toast.success(
"You are cool :)",
position="top-center",
),
),
content="Seriously, click me",
),
ui.checkbox(
label="Click me",
on_checked_change=lambda value: rx.toast.success(f"Value: {value}"),
),
ui.slider(
value=State.seed,
on_value_change=State.set_seed,
on_value_committed=lambda value: rx.toast.success(f"Value: {value}"),
class_name="max-w-xs",
),
ui.gradient_profile(
seed=State.seed,
class_name="size-10",
),
ui.switch(
|
class State(rx.State):
seed: int = 0
@rx.event
def set_seed(self, seed: int):
self.seed = seed
|
"""Welcome to Reflex! This file outlines the steps to create a basic app."""
import reflex as rx
import reflex_ui as ui
class State(rx.State):
seed: int = 0
@rx.event
|
def index() -> rx.Component:
return rx.el.div(
rx.el.div(
ui.tooltip(
ui.button(
ui.icon("SmileIcon"),
"Click me",
on_click=rx.toast.success(
"You are cool :)",
position="top-center",
),
),
content="Seriously, click me",
),
ui.checkbox(
label="Click me",
on_checked_change=lambda value: rx.toast.success(f"Value: {value}"),
),
ui.slider(
value=State.seed,
on_value_change=State.set_seed,
on_value_committed=lambda value: rx.toast.success(f"Value: {value}"),
class_name="max-w-xs",
),
ui.gradient_profile(
seed=State.seed,
class_name="size-10",
),
ui.switch(
|
def set_seed(self, seed: int):
self.seed = seed
|
"""Welcome to Reflex! This file outlines the steps to create a basic app."""
import reflex as rx
import reflex_ui as ui
class State(rx.State):
seed: int = 0
@rx.event
def set_seed(self, seed: int):
|
def index() -> rx.Component:
return rx.el.div(
rx.el.div(
ui.tooltip(
ui.button(
ui.icon("SmileIcon"),
"Click me",
on_click=rx.toast.success(
"You are cool :)",
position="top-center",
),
),
content="Seriously, click me",
),
ui.checkbox(
label="Click me",
on_checked_change=lambda value: rx.toast.success(f"Value: {value}"),
),
ui.slider(
value=State.seed,
on_value_change=State.set_seed,
on_value_committed=lambda value: rx.toast.success(f"Value: {value}"),
class_name="max-w-xs",
),
ui.gradient_profile(
seed=State.seed,
class_name="size-10",
),
ui.switch(
|
self.seed = seed
|
"""Reflex UI package."""
|
_REFLEX_UI_MAPPING = {
"components.base.accordion": ["accordion"],
"components.base.avatar": ["avatar"],
"components.base.badge": ["badge"],
"components.base.button": ["button"],
"components.base.card": ["card"],
"components.base.checkbox": ["checkbox"],
"components.base.collapsible": ["collapsible"],
"components.base.context_menu": ["context_menu"],
"components.base.dialog": ["dialog"],
"components.base.drawer": ["drawer"],
"components.base.gradient_profile": ["gradient_profile"],
"components.base.input": ["input"],
"components.base.link": ["link"],
"components.base.menu": ["menu"],
"components.base.navigation_menu": ["navigation_menu"],
"components.base.popover": ["popover"],
"components.base.preview_card": ["preview_card"],
"components.base.scroll_area": ["scroll_area"],
"components.base.select": ["select"],
"components.base.skeleton": ["skeleton"],
"components.base.slider": ["slider"],
"compon
|
from reflex.utils import lazy_loader
|
["collapsible"],
"components.base.context_menu": ["context_menu"],
"components.base.dialog": ["dialog"],
"components.base.drawer": ["drawer"],
"components.base.gradient_profile": ["gradient_profile"],
"components.base.input": ["input"],
"components.base.link": ["link"],
"components.base.menu": ["menu"],
"components.base.navigation_menu": ["navigation_menu"],
"components.base.popover": ["popover"],
"components.base.preview_card": ["preview_card"],
"components.base.scroll_area": ["scroll_area"],
"components.base.select": ["select"],
"components.base.skeleton": ["skeleton"],
"components.base.slider": ["slider"],
"components.base.switch": ["switch"],
"components.base.tabs": ["tabs"],
"components.base.textarea": ["textarea"],
"components.base.theme_switcher": ["theme_switcher"],
"components.base.toggle_group": ["toggle_group"],
"components.base.toggle": ["toggle"],
"components.base.tooltip": ["tooltip"],
}
|
_SUBMOD_ATTRS = {
**_REFLEX_UI_MAPPING,
"components": ["base"],
"components.icons.hugeicon": ["hi", "icon"],
"components.icons.simple_icon": ["simple_icon"],
"components.icons.others": ["spinner"],
"utils.twmerge": ["cn"],
}
getattr, __dir__, __all__ = lazy_loader.attach(
__name__,
submodules=_SUBMODULES,
submod_attrs=_SUBMOD_ATTRS,
)
def __getattr__(name: str):
return getattr(name)
|
_SUBMODULES = {"components", "utils"}
|
ink"],
"components.base.menu": ["menu"],
"components.base.navigation_menu": ["navigation_menu"],
"components.base.popover": ["popover"],
"components.base.preview_card": ["preview_card"],
"components.base.scroll_area": ["scroll_area"],
"components.base.select": ["select"],
"components.base.skeleton": ["skeleton"],
"components.base.slider": ["slider"],
"components.base.switch": ["switch"],
"components.base.tabs": ["tabs"],
"components.base.textarea": ["textarea"],
"components.base.theme_switcher": ["theme_switcher"],
"components.base.toggle_group": ["toggle_group"],
"components.base.toggle": ["toggle"],
"components.base.tooltip": ["tooltip"],
}
_SUBMODULES = {"components", "utils"}
_SUBMOD_ATTRS = {
**_REFLEX_UI_MAPPING,
"components": ["base"],
"components.icons.hugeicon": ["hi", "icon"],
"components.icons.simple_icon": ["simple_icon"],
"components.icons.others": ["spinner"],
"utils.twmerge": ["cn"],
}
|
def __getattr__(name: str):
return getattr(name)
|
getattr, __dir__, __all__ = lazy_loader.attach(
__name__,
submodules=_SUBMODULES,
submod_attrs=_SUBMOD_ATTRS,
)
|
popover": ["popover"],
"components.base.preview_card": ["preview_card"],
"components.base.scroll_area": ["scroll_area"],
"components.base.select": ["select"],
"components.base.skeleton": ["skeleton"],
"components.base.slider": ["slider"],
"components.base.switch": ["switch"],
"components.base.tabs": ["tabs"],
"components.base.textarea": ["textarea"],
"components.base.theme_switcher": ["theme_switcher"],
"components.base.toggle_group": ["toggle_group"],
"components.base.toggle": ["toggle"],
"components.base.tooltip": ["tooltip"],
}
_SUBMODULES = {"components", "utils"}
_SUBMOD_ATTRS = {
**_REFLEX_UI_MAPPING,
"components": ["base"],
"components.icons.hugeicon": ["hi", "icon"],
"components.icons.simple_icon": ["simple_icon"],
"components.icons.others": ["spinner"],
"utils.twmerge": ["cn"],
}
getattr, __dir__, __all__ = lazy_loader.attach(
__name__,
submodules=_SUBMODULES,
submod_attrs=_SUBMOD_ATTRS,
)
|
def __getattr__(name: str):
return getattr(name)
|
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
|
import os
import urllib.parse
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEven
|
import asyncio
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
|
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure
|
import urllib.parse
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
|
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
di
|
import uuid
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
import uuid
|
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self)
|
from collections.abc import Sequence
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
import uuid
from collections.abc import Sequence
|
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the
|
from dataclasses import asdict, dataclass
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
|
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a di
|
from typing import Any
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
|
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary repre
|
import httpx
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
|
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary representation.
|
import reflex as rx
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
|
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary representation.
Returns:
A dictionary containing all the event d
|
from reflex.experimental.client_state import ClientStateVar
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
|
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary representation.
Returns:
A dictionary containing all the event data.
"""
return asdic
|
from reflex.utils.console import log
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
|
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary representation.
Returns:
A dictionary containing all the event data.
"""
return asdict(self)
@dataclass
cla
|
import reflex_ui as ui
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
|
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary representation.
Returns:
A dictionary containing all the event data.
"""
return asdict(self)
@dataclass
class DemoEvent(PosthogEvent):
"""Event for demo booking."""
first_name: s
|
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
|
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary representation.
Returns:
A dictionary containing all the event data.
"""
return asdict(self)
@dataclass
class DemoEvent(PosthogEvent):
"""Event for demo booking."""
first_name: str
last_name: str
company_email: str
job_title: str
company_
|
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
|
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary representation.
Returns:
A dictionary containing all the event data.
"""
return asdict(self)
@dataclass
class DemoEvent(PosthogEvent):
"""Event for demo booking."""
first_name: str
last_name: str
company_email: str
job_title: str
company_name: str
num_employees: str
internal_tools: str
referral_so
|
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
|
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary representation.
Returns:
A dictionary containing all the event data.
"""
return asdict(self)
@dataclass
class DemoEvent(PosthogEvent):
"""Event for demo booking."""
first_name: str
last_name: str
company_email: str
job_title: str
company_name: str
num_employees: str
internal_tools: str
referral_source: str
def input_field(
label: str,
placeholder:
|
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
|
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary representation.
Returns:
A dictionary containing all the event data.
"""
return asdict(self)
@dataclass
class DemoEvent(PosthogEvent):
"""Event for demo booking."""
first_name: str
last_name: str
company_email: str
job_title: str
company_name: str
num_employees: str
internal_tools: str
referral_source: str
def input_field(
label: str,
placeholder: str,
name: str,
type: str = "text",
required: bool = False,
) -> rx.Component:
"""Create a labeled
|
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
|
"""Demo form component for collecting user information and scheduling enterprise calls.
This module provides a comprehensive demo form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
|
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary representation.
Returns:
A dictionary containing all the event data.
"""
return asdict(self)
@dataclass
class DemoEvent(PosthogEvent):
"""Event for demo booking."""
first_name: str
last_name: str
company_email: str
job_title: str
company_name: str
num_employees: str
internal_tools: str
referral_source: str
def input_field(
label: str,
placeholder: str,
name: str,
type: str = "text",
required: bool = False,
) -> rx.Component:
"""Create a labeled input field component.
Args:
label: The label text to display above the input
placeholder: Placeholder text for th
|
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
|
form that validates company emails,
sends data to PostHog and Slack, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
|
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary representation.
Returns:
A dictionary containing all the event data.
"""
return asdict(self)
@dataclass
class DemoEvent(PosthogEvent):
"""Event for demo booking."""
first_name: str
last_name: str
company_email: str
job_title: str
company_name: str
num_employees: str
internal_tools: str
referral_source: str
def input_field(
label: str,
placeholder: str,
name: str,
type: str = "text",
required: bool = False,
) -> rx.Component:
"""Create a labeled input field component.
Args:
label: The label text to display above the input
placeholder: Placeholder text for the input
name: The name attribute for the input field
|
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
|
ck, and redirects users to appropriate Cal.com links
based on company size.
"""
import asyncio
import os
import urllib.parse
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
|
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary representation.
Returns:
A dictionary containing all the event data.
"""
return asdict(self)
@dataclass
class DemoEvent(PosthogEvent):
"""Event for demo booking."""
first_name: str
last_name: str
company_email: str
job_title: str
company_name: str
num_employees: str
internal_tools: str
referral_source: str
def input_field(
label: str,
placeholder: str,
name: str,
type: str = "text",
required: bool = False,
) -> rx.Component:
"""Create a labeled input field component.
Args:
label: The label text to display above the input
placeholder: Placeholder text for the input
name: The name attribute for the input field
type: The input type (text, email, tel, etc.)
|
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
|
"
import asyncio
import os
import urllib.parse
import uuid
from collections.abc import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
|
@dataclass
class DemoEvent(PosthogEvent):
"""Event for demo booking."""
first_name: str
last_name: str
company_email: str
job_title: str
company_name: str
num_employees: str
internal_tools: str
referral_source: str
def input_field(
label: str,
placeholder: str,
name: str,
type: str = "text",
required: bool = False,
) -> rx.Component:
"""Create a labeled input field component.
Args:
label: The label text to display above the input
placeholder: Placeholder text for the input
name: The name attribute for the input field
type: The input type (text, email, tel, etc.)
required: Whether the field is required
Returns:
A Reflex component containing the labeled input field
"""
return rx.el.div(
rx.el.label(
label + (" *" if required else ""),
class_name="block text-sm font-medium text-secondary-12",
),
ui.input(
|
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary representation.
Returns:
A dictionary containing all the event data.
"""
return asdict(self)
|
c import Sequence
from dataclasses import asdict, dataclass
from typing import Any
import httpx
import reflex as rx
from reflex.experimental.client_state import ClientStateVar
from reflex.utils.console import log
import reflex_ui as ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
|
@dataclass
class DemoEvent(PosthogEvent):
"""Event for demo booking."""
first_name: str
last_name: str
company_email: str
job_title: str
company_name: str
num_employees: str
internal_tools: str
referral_source: str
def input_field(
label: str,
placeholder: str,
name: str,
type: str = "text",
required: bool = False,
) -> rx.Component:
"""Create a labeled input field component.
Args:
label: The label text to display above the input
placeholder: Placeholder text for the input
name: The name attribute for the input field
type: The input type (text, email, tel, etc.)
required: Whether the field is required
Returns:
A Reflex component containing the labeled input field
"""
return rx.el.div(
rx.el.label(
label + (" *" if required else ""),
class_name="block text-sm font-medium text-secondary-12",
),
ui.input(
|
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary representation.
Returns:
A dictionary containing all the event data.
"""
return asdict(self)
|
ui
demo_form_error_message = ClientStateVar.create("demo_form_error_message", "")
is_sending_demo_form = ClientStateVar.create("is_sending_demo_form", False)
COMMONROOM_DESTINATION_ID = os.getenv("COMMONROOM_DESTINATION_ID", "")
COMMONROOM_API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary representation.
Returns:
A dictionary containing all the event data.
"""
return asdict(self)
@dataclass
|
def input_field(
label: str,
placeholder: str,
name: str,
type: str = "text",
required: bool = False,
) -> rx.Component:
"""Create a labeled input field component.
Args:
label: The label text to display above the input
placeholder: Placeholder text for the input
name: The name attribute for the input field
type: The input type (text, email, tel, etc.)
required: Whether the field is required
Returns:
A Reflex component containing the labeled input field
"""
return rx.el.div(
rx.el.label(
label + (" *" if required else ""),
class_name="block text-sm font-medium text-secondary-12",
),
ui.input(
placeholder=placeholder,
name=name,
type=type,
required=required,
max_length=255,
class_name="w-full",
),
class_name="flex flex-col gap-1.5",
)
def text_area_field(
|
class DemoEvent(PosthogEvent):
"""Event for demo booking."""
first_name: str
last_name: str
company_email: str
job_title: str
company_name: str
num_employees: str
internal_tools: str
referral_source: str
|
API_TOKEN = os.getenv("COMMONROOM_API_TOKEN", "")
CAL_REQUEST_DEMO_URL = os.getenv(
"CAL_REQUEST_DEMO_URL", "https://app.lemcal.com/@jhtevis/30-minutes?back=1"
)
CAL_ENTERPRISE_FOLLOW_UP_URL = os.getenv(
"CAL_ENTERPRISE_FOLLOW_UP_URL",
"https://app.lemcal.com/@alek/reflex-demo?back=1",
)
SLACK_DEMO_WEBHOOK_URL = os.getenv("SLACK_DEMO_WEBHOOK_URL", "")
POSTHOG_API_KEY = os.getenv("POSTHOG_API_KEY", "")
@dataclass(kw_only=True)
class PosthogEvent:
"""Base event structure."""
distinct_id: str
def to_dict(self) -> dict[str, Any]:
"""Convert the event instance to a dictionary representation.
Returns:
A dictionary containing all the event data.
"""
return asdict(self)
@dataclass
class DemoEvent(PosthogEvent):
"""Event for demo booking."""
first_name: str
last_name: str
company_email: str
job_title: str
company_name: str
num_employees: str
internal_tools: str
referral_source: str
|
def text_area_field(
label: str, placeholder: str, name: str, required: bool = False
) -> rx.Component:
"""Create a labeled textarea field component.
Args:
label: The label text to display above the textarea
placeholder: Placeholder text for the textarea
name: The name attribute for the textarea field
required: Whether the field is required
Returns:
A Reflex component containing the labeled textarea field
"""
return rx.el.div(
rx.el.label(label, class_name="block text-sm font-medium text-secondary-12"),
ui.textarea(
placeholder=placeholder,
name=name,
required=required,
class_name="w-full",
max_length=800,
),
class_name="flex flex-col gap-1.5",
)
def select_field(
label: str,
name: str,
items: list[str],
required: bool = False,
) -> rx.Component:
"""Create a labeled select field component.
Args:
|
def input_field(
label: str,
placeholder: str,
name: str,
type: str = "text",
required: bool = False,
) -> rx.Component:
"""Create a labeled input field component.
Args:
label: The label text to display above the input
placeholder: Placeholder text for the input
name: The name attribute for the input field
type: The input type (text, email, tel, etc.)
required: Whether the field is required
Returns:
A Reflex component containing the labeled input field
"""
return rx.el.div(
rx.el.label(
label + (" *" if required else ""),
class_name="block text-sm font-medium text-secondary-12",
),
ui.input(
placeholder=placeholder,
name=name,
type=type,
required=required,
max_length=255,
class_name="w-full",
),
class_name="flex flex-col gap-1.5",
)
|
referral_source: str
def input_field(
label: str,
placeholder: str,
name: str,
type: str = "text",
required: bool = False,
) -> rx.Component:
"""Create a labeled input field component.
Args:
label: The label text to display above the input
placeholder: Placeholder text for the input
name: The name attribute for the input field
type: The input type (text, email, tel, etc.)
required: Whether the field is required
Returns:
A Reflex component containing the labeled input field
"""
return rx.el.div(
rx.el.label(
label + (" *" if required else ""),
class_name="block text-sm font-medium text-secondary-12",
),
ui.input(
placeholder=placeholder,
name=name,
type=type,
required=required,
max_length=255,
class_name="w-full",
),
class_name="flex flex-col gap-1.5",
)
|
def select_field(
label: str,
name: str,
items: list[str],
required: bool = False,
) -> rx.Component:
"""Create a labeled select field component.
Args:
label: The label text to display above the select
name: The name attribute for the select field
items: List of options to display in the select
required: Whether the field is required
Returns:
A Reflex component containing the labeled select field
"""
return rx.el.div(
rx.el.label(
label + (" *" if required else ""),
class_name="block text-sm font-medium text-secondary-12",
),
ui.select(
default_value="Select",
name=name,
items=items,
required=required,
class_name="w-full",
),
class_name="flex flex-col gap-1.5",
)
def is_small_company(num_employees: str) -> bool:
"""Check if company has 10 or fewer employees."""
return nu
|
def text_area_field(
label: str, placeholder: str, name: str, required: bool = False
) -> rx.Component:
"""Create a labeled textarea field component.
Args:
label: The label text to display above the textarea
placeholder: Placeholder text for the textarea
name: The name attribute for the textarea field
required: Whether the field is required
Returns:
A Reflex component containing the labeled textarea field
"""
return rx.el.div(
rx.el.label(label, class_name="block text-sm font-medium text-secondary-12"),
ui.textarea(
placeholder=placeholder,
name=name,
required=required,
class_name="w-full",
max_length=800,
),
class_name="flex flex-col gap-1.5",
)
|
e,
type=type,
required=required,
max_length=255,
class_name="w-full",
),
class_name="flex flex-col gap-1.5",
)
def text_area_field(
label: str, placeholder: str, name: str, required: bool = False
) -> rx.Component:
"""Create a labeled textarea field component.
Args:
label: The label text to display above the textarea
placeholder: Placeholder text for the textarea
name: The name attribute for the textarea field
required: Whether the field is required
Returns:
A Reflex component containing the labeled textarea field
"""
return rx.el.div(
rx.el.label(label, class_name="block text-sm font-medium text-secondary-12"),
ui.textarea(
placeholder=placeholder,
name=name,
required=required,
class_name="w-full",
max_length=800,
),
class_name="flex flex-col gap-1.5",
)
|
def is_small_company(num_employees: str) -> bool:
"""Check if company has 10 or fewer employees."""
return num_employees in ["1", "2-5", "6-10"]
def check_if_company_email(email: str) -> bool:
"""Check if an email address is from a company domain (not a personal email provider).
Args:
email: The email address to check
Returns:
True if it's likely a company email, False if it's from a personal provider
"""
if not email or "@" not in email:
return False
domain = email.split("@")[-1].lower()
# List of common personal email providers
personal_domains = {
"gmail.com",
"outlook.com",
"hotmail.com",
"yahoo.com",
"icloud.com",
"aol.com",
"protonmail.com",
"proton.me",
"mail.com",
"yandex.com",
"zoho.com",
"live.com",
"msn.com",
"me.com",
"mac.com",
"googlemail.com",
"yahoo.co.uk",
|
def select_field(
label: str,
name: str,
items: list[str],
required: bool = False,
) -> rx.Component:
"""Create a labeled select field component.
Args:
label: The label text to display above the select
name: The name attribute for the select field
items: List of options to display in the select
required: Whether the field is required
Returns:
A Reflex component containing the labeled select field
"""
return rx.el.div(
rx.el.label(
label + (" *" if required else ""),
class_name="block text-sm font-medium text-secondary-12",
),
ui.select(
default_value="Select",
name=name,
items=items,
required=required,
class_name="w-full",
),
class_name="flex flex-col gap-1.5",
)
|
class_name="w-full",
max_length=800,
),
class_name="flex flex-col gap-1.5",
)
def select_field(
label: str,
name: str,
items: list[str],
required: bool = False,
) -> rx.Component:
"""Create a labeled select field component.
Args:
label: The label text to display above the select
name: The name attribute for the select field
items: List of options to display in the select
required: Whether the field is required
Returns:
A Reflex component containing the labeled select field
"""
return rx.el.div(
rx.el.label(
label + (" *" if required else ""),
class_name="block text-sm font-medium text-secondary-12",
),
ui.select(
default_value="Select",
name=name,
items=items,
required=required,
class_name="w-full",
),
class_name="flex flex-col gap-1.5",
)
|
def check_if_company_email(email: str) -> bool:
"""Check if an email address is from a company domain (not a personal email provider).
Args:
email: The email address to check
Returns:
True if it's likely a company email, False if it's from a personal provider
"""
if not email or "@" not in email:
return False
domain = email.split("@")[-1].lower()
# List of common personal email providers
personal_domains = {
"gmail.com",
"outlook.com",
"hotmail.com",
"yahoo.com",
"icloud.com",
"aol.com",
"protonmail.com",
"proton.me",
"mail.com",
"yandex.com",
"zoho.com",
"live.com",
"msn.com",
"me.com",
"mac.com",
"googlemail.com",
"yahoo.co.uk",
"yahoo.ca",
"yahoo.co.in",
"outlook.co.uk",
"hotmail.co.uk",
}
return domain not in personal_domains and ".edu" not in do
|
def is_small_company(num_employees: str) -> bool:
"""Check if company has 10 or fewer employees."""
return num_employees in ["1", "2-5", "6-10"]
|
name: str,
items: list[str],
required: bool = False,
) -> rx.Component:
"""Create a labeled select field component.
Args:
label: The label text to display above the select
name: The name attribute for the select field
items: List of options to display in the select
required: Whether the field is required
Returns:
A Reflex component containing the labeled select field
"""
return rx.el.div(
rx.el.label(
label + (" *" if required else ""),
class_name="block text-sm font-medium text-secondary-12",
),
ui.select(
default_value="Select",
name=name,
items=items,
required=required,
class_name="w-full",
),
class_name="flex flex-col gap-1.5",
)
def is_small_company(num_employees: str) -> bool:
"""Check if company has 10 or fewer employees."""
return num_employees in ["1", "2-5", "6-10"]
|
def check_if_number_of_employees_is_valid(number_of_employees: str) -> bool:
"""Check if the number of employees is valid."""
return number_of_employees.strip() != "Select"
def check_if_referral_source_is_valid(referral_source: str) -> bool:
"""Check if the referral source is valid."""
return referral_source.strip() != "Select"
class DemoForm(rx.ComponentState):
"""Component state for handling demo form submissions and integrations."""
@rx.event(background=True)
async def on_submit(self, form_data: dict[str, Any]):
"""Handle form submission with validation and routing logic.
Validates company email, sends data to PostHog and Slack,
then redirects to appropriate Cal.com link based on company size.
Args:
form_data: Form data dictionary containing user inputs
"""
if not check_if_company_email(form_data.get("email", "")):
yield rx.set_focus("email")
yield rx.toast.error
|
def check_if_company_email(email: str) -> bool:
"""Check if an email address is from a company domain (not a personal email provider).
Args:
email: The email address to check
Returns:
True if it's likely a company email, False if it's from a personal provider
"""
if not email or "@" not in email:
return False
domain = email.split("@")[-1].lower()
# List of common personal email providers
personal_domains = {
"gmail.com",
"outlook.com",
"hotmail.com",
"yahoo.com",
"icloud.com",
"aol.com",
"protonmail.com",
"proton.me",
"mail.com",
"yandex.com",
"zoho.com",
"live.com",
"msn.com",
"me.com",
"mac.com",
"googlemail.com",
"yahoo.co.uk",
"yahoo.ca",
"yahoo.co.in",
"outlook.co.uk",
"hotmail.co.uk",
}
return domain not in personal_domains and ".edu" not in domain
|
select
required: Whether the field is required
Returns:
A Reflex component containing the labeled select field
"""
return rx.el.div(
rx.el.label(
label + (" *" if required else ""),
class_name="block text-sm font-medium text-secondary-12",
),
ui.select(
default_value="Select",
name=name,
items=items,
required=required,
class_name="w-full",
),
class_name="flex flex-col gap-1.5",
)
def is_small_company(num_employees: str) -> bool:
"""Check if company has 10 or fewer employees."""
return num_employees in ["1", "2-5", "6-10"]
def check_if_company_email(email: str) -> bool:
"""Check if an email address is from a company domain (not a personal email provider).
Args:
email: The email address to check
Returns:
True if it's likely a company email, False if it's from a personal provider
"""
|
domain = email.split("@")[-1].lower()
# List of common personal email providers
personal_domains = {
"gmail.com",
"outlook.com",
"hotmail.com",
"yahoo.com",
"icloud.com",
"aol.com",
"protonmail.com",
"proton.me",
"mail.com",
"yandex.com",
"zoho.com",
"live.com",
"msn.com",
"me.com",
"mac.com",
"googlemail.com",
"yahoo.co.uk",
"yahoo.ca",
"yahoo.co.in",
"outlook.co.uk",
"hotmail.co.uk",
}
return domain not in personal_domains and ".edu" not in domain
def check_if_number_of_employees_is_valid(number_of_employees: str) -> bool:
"""Check if the number of employees is valid."""
return number_of_employees.strip() != "Select"
def check_if_referral_source_is_valid(referral_source: str) -> bool:
"""Check if the referral source is valid."""
return referral_source.strip() != "Select"
cl
|
if not email or "@" not in email:
return False
|
Returns:
A Reflex component containing the labeled select field
"""
return rx.el.div(
rx.el.label(
label + (" *" if required else ""),
class_name="block text-sm font-medium text-secondary-12",
),
ui.select(
default_value="Select",
name=name,
items=items,
required=required,
class_name="w-full",
),
class_name="flex flex-col gap-1.5",
)
def is_small_company(num_employees: str) -> bool:
"""Check if company has 10 or fewer employees."""
return num_employees in ["1", "2-5", "6-10"]
def check_if_company_email(email: str) -> bool:
"""Check if an email address is from a company domain (not a personal email provider).
Args:
email: The email address to check
Returns:
True if it's likely a company email, False if it's from a personal provider
"""
if not email or "@" not in email:
return False
|
# List of common personal email providers
personal_domains = {
"gmail.com",
"outlook.com",
"hotmail.com",
"yahoo.com",
"icloud.com",
"aol.com",
"protonmail.com",
"proton.me",
"mail.com",
"yandex.com",
"zoho.com",
"live.com",
"msn.com",
"me.com",
"mac.com",
"googlemail.com",
"yahoo.co.uk",
"yahoo.ca",
"yahoo.co.in",
"outlook.co.uk",
"hotmail.co.uk",
}
return domain not in personal_domains and ".edu" not in domain
def check_if_number_of_employees_is_valid(number_of_employees: str) -> bool:
"""Check if the number of employees is valid."""
return number_of_employees.strip() != "Select"
def check_if_referral_source_is_valid(referral_source: str) -> bool:
"""Check if the referral source is valid."""
return referral_source.strip() != "Select"
class DemoForm(rx.ComponentState):
"""Com
|
domain = email.split("@")[-1].lower()
|
rn rx.el.div(
rx.el.label(
label + (" *" if required else ""),
class_name="block text-sm font-medium text-secondary-12",
),
ui.select(
default_value="Select",
name=name,
items=items,
required=required,
class_name="w-full",
),
class_name="flex flex-col gap-1.5",
)
def is_small_company(num_employees: str) -> bool:
"""Check if company has 10 or fewer employees."""
return num_employees in ["1", "2-5", "6-10"]
def check_if_company_email(email: str) -> bool:
"""Check if an email address is from a company domain (not a personal email provider).
Args:
email: The email address to check
Returns:
True if it's likely a company email, False if it's from a personal provider
"""
if not email or "@" not in email:
return False
domain = email.split("@")[-1].lower()
# List of common personal email providers
|
return domain not in personal_domains and ".edu" not in domain
def check_if_number_of_employees_is_valid(number_of_employees: str) -> bool:
"""Check if the number of employees is valid."""
return number_of_employees.strip() != "Select"
def check_if_referral_source_is_valid(referral_source: str) -> bool:
"""Check if the referral source is valid."""
return referral_source.strip() != "Select"
class DemoForm(rx.ComponentState):
"""Component state for handling demo form submissions and integrations."""
@rx.event(background=True)
async def on_submit(self, form_data: dict[str, Any]):
"""Handle form submission with validation and routing logic.
Validates company email, sends data to PostHog and Slack,
then redirects to appropriate Cal.com link based on company size.
Args:
form_data: Form data dictionary containing user inputs
"""
if not check_if_company_email(form_data.get("email", "")):
|
personal_domains = {
"gmail.com",
"outlook.com",
"hotmail.com",
"yahoo.com",
"icloud.com",
"aol.com",
"protonmail.com",
"proton.me",
"mail.com",
"yandex.com",
"zoho.com",
"live.com",
"msn.com",
"me.com",
"mac.com",
"googlemail.com",
"yahoo.co.uk",
"yahoo.ca",
"yahoo.co.in",
"outlook.co.uk",
"hotmail.co.uk",
}
|
check_if_company_email(email: str) -> bool:
"""Check if an email address is from a company domain (not a personal email provider).
Args:
email: The email address to check
Returns:
True if it's likely a company email, False if it's from a personal provider
"""
if not email or "@" not in email:
return False
domain = email.split("@")[-1].lower()
# List of common personal email providers
personal_domains = {
"gmail.com",
"outlook.com",
"hotmail.com",
"yahoo.com",
"icloud.com",
"aol.com",
"protonmail.com",
"proton.me",
"mail.com",
"yandex.com",
"zoho.com",
"live.com",
"msn.com",
"me.com",
"mac.com",
"googlemail.com",
"yahoo.co.uk",
"yahoo.ca",
"yahoo.co.in",
"outlook.co.uk",
"hotmail.co.uk",
}
return domain not in personal_domains and ".edu" not in domain
|
def check_if_referral_source_is_valid(referral_source: str) -> bool:
"""Check if the referral source is valid."""
return referral_source.strip() != "Select"
class DemoForm(rx.ComponentState):
"""Component state for handling demo form submissions and integrations."""
@rx.event(background=True)
async def on_submit(self, form_data: dict[str, Any]):
"""Handle form submission with validation and routing logic.
Validates company email, sends data to PostHog and Slack,
then redirects to appropriate Cal.com link based on company size.
Args:
form_data: Form data dictionary containing user inputs
"""
if not check_if_company_email(form_data.get("email", "")):
yield rx.set_focus("email")
yield rx.toast.error(
"Please enter a valid company email",
position="top-center",
)
yield demo_form_error_message.push("Please enter a valid compa
|
def check_if_number_of_employees_is_valid(number_of_employees: str) -> bool:
"""Check if the number of employees is valid."""
return number_of_employees.strip() != "Select"
|
heck
Returns:
True if it's likely a company email, False if it's from a personal provider
"""
if not email or "@" not in email:
return False
domain = email.split("@")[-1].lower()
# List of common personal email providers
personal_domains = {
"gmail.com",
"outlook.com",
"hotmail.com",
"yahoo.com",
"icloud.com",
"aol.com",
"protonmail.com",
"proton.me",
"mail.com",
"yandex.com",
"zoho.com",
"live.com",
"msn.com",
"me.com",
"mac.com",
"googlemail.com",
"yahoo.co.uk",
"yahoo.ca",
"yahoo.co.in",
"outlook.co.uk",
"hotmail.co.uk",
}
return domain not in personal_domains and ".edu" not in domain
def check_if_number_of_employees_is_valid(number_of_employees: str) -> bool:
"""Check if the number of employees is valid."""
return number_of_employees.strip() != "Select"
|
class DemoForm(rx.ComponentState):
"""Component state for handling demo form submissions and integrations."""
@rx.event(background=True)
async def on_submit(self, form_data: dict[str, Any]):
"""Handle form submission with validation and routing logic.
Validates company email, sends data to PostHog and Slack,
then redirects to appropriate Cal.com link based on company size.
Args:
form_data: Form data dictionary containing user inputs
"""
if not check_if_company_email(form_data.get("email", "")):
yield rx.set_focus("email")
yield rx.toast.error(
"Please enter a valid company email",
position="top-center",
)
yield demo_form_error_message.push("Please enter a valid company email")
return
# Check if the has selected a number of employees
if not check_if_number_of_employees_is_valid(
form_data.get
|
def check_if_referral_source_is_valid(referral_source: str) -> bool:
"""Check if the referral source is valid."""
return referral_source.strip() != "Select"
|
co.in",
"outlook.co.uk",
"hotmail.co.uk",
}
return domain not in personal_domains and ".edu" not in domain
def check_if_number_of_employees_is_valid(number_of_employees: str) -> bool:
"""Check if the number of employees is valid."""
return number_of_employees.strip() != "Select"
def check_if_referral_source_is_valid(referral_source: str) -> bool:
"""Check if the referral source is valid."""
return referral_source.strip() != "Select"
class DemoForm(rx.ComponentState):
"""Component state for handling demo form submissions and integrations."""
@rx.event(background=True)
async def on_submit(self, form_data: dict[str, Any]):
"""Handle form submission with validation and routing logic.
Validates company email, sends data to PostHog and Slack,
then redirects to appropriate Cal.com link based on company size.
Args:
form_data: Form data dictionary containing user inputs
"""
|
# Check if the has selected a number of employees
if not check_if_number_of_employees_is_valid(
form_data.get("number_of_employees", "")
):
yield rx.toast.error(
"Please select a number of employees",
position="top-center",
)
yield demo_form_error_message.push("Please select a number of employees")
return
# Check if the has entered a referral source
if not check_if_referral_source_is_valid(
form_data.get("how_did_you_hear_about_us", "")
):
yield rx.toast.error(
"Please select how did you hear about us",
position="top-center",
)
yield demo_form_error_message.push(
"Please select how did you hear about us"
)
return
yield is_sending_demo_form.push(True)
# Send to PostHog and Slack for all submissions
await s
|
if not check_if_company_email(form_data.get("email", "")):
yield rx.set_focus("email")
yield rx.toast.error(
"Please enter a valid company email",
position="top-center",
)
yield demo_form_error_message.push("Please enter a valid company email")
return
|
rral source is valid."""
return referral_source.strip() != "Select"
class DemoForm(rx.ComponentState):
"""Component state for handling demo form submissions and integrations."""
@rx.event(background=True)
async def on_submit(self, form_data: dict[str, Any]):
"""Handle form submission with validation and routing logic.
Validates company email, sends data to PostHog and Slack,
then redirects to appropriate Cal.com link based on company size.
Args:
form_data: Form data dictionary containing user inputs
"""
if not check_if_company_email(form_data.get("email", "")):
yield rx.set_focus("email")
yield rx.toast.error(
"Please enter a valid company email",
position="top-center",
)
yield demo_form_error_message.push("Please enter a valid company email")
return
# Check if the has selected a number of employees
|
# Check if the has entered a referral source
if not check_if_referral_source_is_valid(
form_data.get("how_did_you_hear_about_us", "")
):
yield rx.toast.error(
"Please select how did you hear about us",
position="top-center",
)
yield demo_form_error_message.push(
"Please select how did you hear about us"
)
return
yield is_sending_demo_form.push(True)
# Send to PostHog and Slack for all submissions
await self.send_demo_event(form_data)
yield rx.call_script(
f"try {{ ko.identify('{form_data.get('email', '')}'); }} catch(e) {{ console.warn('Koala identify failed:', e); }}"
)
notes_content = f"""
Name: {form_data.get("first_name", "")} {form_data.get("last_name", "")}
Business Email: {form_data.get("email", "")}
Job Title: {form_data.get("job_title", "")}
Company Name: {form_data.get("co
|
if not check_if_number_of_employees_is_valid(
form_data.get("number_of_employees", "")
):
yield rx.toast.error(
"Please select a number of employees",
position="top-center",
)
yield demo_form_error_message.push("Please select a number of employees")
return
|
then redirects to appropriate Cal.com link based on company size.
Args:
form_data: Form data dictionary containing user inputs
"""
if not check_if_company_email(form_data.get("email", "")):
yield rx.set_focus("email")
yield rx.toast.error(
"Please enter a valid company email",
position="top-center",
)
yield demo_form_error_message.push("Please enter a valid company email")
return
# Check if the has selected a number of employees
if not check_if_number_of_employees_is_valid(
form_data.get("number_of_employees", "")
):
yield rx.toast.error(
"Please select a number of employees",
position="top-center",
)
yield demo_form_error_message.push("Please select a number of employees")
return
# Check if the has entered a referral source
|
yield is_sending_demo_form.push(True)
# Send to PostHog and Slack for all submissions
await self.send_demo_event(form_data)
yield rx.call_script(
f"try {{ ko.identify('{form_data.get('email', '')}'); }} catch(e) {{ console.warn('Koala identify failed:', e); }}"
)
notes_content = f"""
Name: {form_data.get("first_name", "")} {form_data.get("last_name", "")}
Business Email: {form_data.get("email", "")}
Job Title: {form_data.get("job_title", "")}
Company Name: {form_data.get("company_name", "")}
Number of Employees: {form_data.get("number_of_employees", "")}
Internal Tools to Build: {form_data.get("internal_tools", "")}
How they heard about Reflex: {form_data.get("how_did_you_hear_about_us", "")}"""
params = {
"email": form_data.get("email", ""),
"name": f"{form_data.get('first_name', '')} {form_data.get('last_name', '')}",
"notes": notes_content,
}
query_string = urll
|
if not check_if_referral_source_is_valid(
form_data.get("how_did_you_hear_about_us", "")
):
yield rx.toast.error(
"Please select how did you hear about us",
position="top-center",
)
yield demo_form_error_message.push(
"Please select how did you hear about us"
)
return
|
r(
"Please select a number of employees",
position="top-center",
)
yield demo_form_error_message.push("Please select a number of employees")
return
# Check if the has entered a referral source
if not check_if_referral_source_is_valid(
form_data.get("how_did_you_hear_about_us", "")
):
yield rx.toast.error(
"Please select how did you hear about us",
position="top-center",
)
yield demo_form_error_message.push(
"Please select how did you hear about us"
)
return
yield is_sending_demo_form.push(True)
# Send to PostHog and Slack for all submissions
await self.send_demo_event(form_data)
yield rx.call_script(
f"try {{ ko.identify('{form_data.get('email', '')}'); }} catch(e) {{ console.warn('Koala identify failed:', e); }}"
)
|
params = {
"email": form_data.get("email", ""),
"name": f"{form_data.get('first_name', '')} {form_data.get('last_name', '')}",
"notes": notes_content,
}
query_string = urllib.parse.urlencode(params)
if is_small_company(form_data.get("number_of_employees", "")):
yield rx.redirect(f"{CAL_REQUEST_DEMO_URL}?{query_string}")
return
cal_url_with_params = f"{CAL_ENTERPRISE_FOLLOW_UP_URL}?{query_string}"
yield is_sending_demo_form.push(False)
yield rx.redirect(cal_url_with_params)
async def send_demo_event(self, form_data: dict[str, Any]):
"""Create and send demo event to PostHog and Slack.
Converts form data into a DemoEvent and sends to both analytics
platforms. Logs errors but doesn't raise exceptions.
Args:
form_data: Form data dictionary containing user inputs
"""
first_name = form_data.get("first_name",
|
notes_content = f"""
Name: {form_data.get("first_name", "")} {form_data.get("last_name", "")}
Business Email: {form_data.get("email", "")}
Job Title: {form_data.get("job_title", "")}
Company Name: {form_data.get("company_name", "")}
Number of Employees: {form_data.get("number_of_employees", "")}
Internal Tools to Build: {form_data.get("internal_tools", "")}
How they heard about Reflex: {form_data.get("how_did_you_hear_about_us", "")}"""
|
elect how did you hear about us",
position="top-center",
)
yield demo_form_error_message.push(
"Please select how did you hear about us"
)
return
yield is_sending_demo_form.push(True)
# Send to PostHog and Slack for all submissions
await self.send_demo_event(form_data)
yield rx.call_script(
f"try {{ ko.identify('{form_data.get('email', '')}'); }} catch(e) {{ console.warn('Koala identify failed:', e); }}"
)
notes_content = f"""
Name: {form_data.get("first_name", "")} {form_data.get("last_name", "")}
Business Email: {form_data.get("email", "")}
Job Title: {form_data.get("job_title", "")}
Company Name: {form_data.get("company_name", "")}
Number of Employees: {form_data.get("number_of_employees", "")}
Internal Tools to Build: {form_data.get("internal_tools", "")}
How they heard about Reflex: {form_data.get("how_did_you_hear_about_us", "")}"""
|
query_string = urllib.parse.urlencode(params)
if is_small_company(form_data.get("number_of_employees", "")):
yield rx.redirect(f"{CAL_REQUEST_DEMO_URL}?{query_string}")
return
cal_url_with_params = f"{CAL_ENTERPRISE_FOLLOW_UP_URL}?{query_string}"
yield is_sending_demo_form.push(False)
yield rx.redirect(cal_url_with_params)
async def send_demo_event(self, form_data: dict[str, Any]):
"""Create and send demo event to PostHog and Slack.
Converts form data into a DemoEvent and sends to both analytics
platforms. Logs errors but doesn't raise exceptions.
Args:
form_data: Form data dictionary containing user inputs
"""
first_name = form_data.get("first_name", "")
last_name = form_data.get("last_name", "")
demo_event = DemoEvent(
distinct_id=f"{first_name} {last_name}",
first_name=first_name,
last_name=last_nam
|
params = {
"email": form_data.get("email", ""),
"name": f"{form_data.get('first_name', '')} {form_data.get('last_name', '')}",
"notes": notes_content,
}
|
return
yield is_sending_demo_form.push(True)
# Send to PostHog and Slack for all submissions
await self.send_demo_event(form_data)
yield rx.call_script(
f"try {{ ko.identify('{form_data.get('email', '')}'); }} catch(e) {{ console.warn('Koala identify failed:', e); }}"
)
notes_content = f"""
Name: {form_data.get("first_name", "")} {form_data.get("last_name", "")}
Business Email: {form_data.get("email", "")}
Job Title: {form_data.get("job_title", "")}
Company Name: {form_data.get("company_name", "")}
Number of Employees: {form_data.get("number_of_employees", "")}
Internal Tools to Build: {form_data.get("internal_tools", "")}
How they heard about Reflex: {form_data.get("how_did_you_hear_about_us", "")}"""
params = {
"email": form_data.get("email", ""),
"name": f"{form_data.get('first_name', '')} {form_data.get('last_name', '')}",
"notes": notes_content,
}
|
if is_small_company(form_data.get("number_of_employees", "")):
yield rx.redirect(f"{CAL_REQUEST_DEMO_URL}?{query_string}")
return
cal_url_with_params = f"{CAL_ENTERPRISE_FOLLOW_UP_URL}?{query_string}"
yield is_sending_demo_form.push(False)
yield rx.redirect(cal_url_with_params)
async def send_demo_event(self, form_data: dict[str, Any]):
"""Create and send demo event to PostHog and Slack.
Converts form data into a DemoEvent and sends to both analytics
platforms. Logs errors but doesn't raise exceptions.
Args:
form_data: Form data dictionary containing user inputs
"""
first_name = form_data.get("first_name", "")
last_name = form_data.get("last_name", "")
demo_event = DemoEvent(
distinct_id=f"{first_name} {last_name}",
first_name=first_name,
last_name=last_name,
company_email=form_data.get("email", "")
|
query_string = urllib.parse.urlencode(params)
|
.push(True)
# Send to PostHog and Slack for all submissions
await self.send_demo_event(form_data)
yield rx.call_script(
f"try {{ ko.identify('{form_data.get('email', '')}'); }} catch(e) {{ console.warn('Koala identify failed:', e); }}"
)
notes_content = f"""
Name: {form_data.get("first_name", "")} {form_data.get("last_name", "")}
Business Email: {form_data.get("email", "")}
Job Title: {form_data.get("job_title", "")}
Company Name: {form_data.get("company_name", "")}
Number of Employees: {form_data.get("number_of_employees", "")}
Internal Tools to Build: {form_data.get("internal_tools", "")}
How they heard about Reflex: {form_data.get("how_did_you_hear_about_us", "")}"""
params = {
"email": form_data.get("email", ""),
"name": f"{form_data.get('first_name', '')} {form_data.get('last_name', '')}",
"notes": notes_content,
}
query_string = urllib.parse.urlencode(params)
|
cal_url_with_params = f"{CAL_ENTERPRISE_FOLLOW_UP_URL}?{query_string}"
yield is_sending_demo_form.push(False)
yield rx.redirect(cal_url_with_params)
async def send_demo_event(self, form_data: dict[str, Any]):
"""Create and send demo event to PostHog and Slack.
Converts form data into a DemoEvent and sends to both analytics
platforms. Logs errors but doesn't raise exceptions.
Args:
form_data: Form data dictionary containing user inputs
"""
first_name = form_data.get("first_name", "")
last_name = form_data.get("last_name", "")
demo_event = DemoEvent(
distinct_id=f"{first_name} {last_name}",
first_name=first_name,
last_name=last_name,
company_email=form_data.get("email", ""),
job_title=form_data.get("job_title", ""),
company_name=form_data.get("company_name", ""),
num_employees=form_data.get("numbe
|
if is_small_company(form_data.get("number_of_employees", "")):
yield rx.redirect(f"{CAL_REQUEST_DEMO_URL}?{query_string}")
return
|
{{ ko.identify('{form_data.get('email', '')}'); }} catch(e) {{ console.warn('Koala identify failed:', e); }}"
)
notes_content = f"""
Name: {form_data.get("first_name", "")} {form_data.get("last_name", "")}
Business Email: {form_data.get("email", "")}
Job Title: {form_data.get("job_title", "")}
Company Name: {form_data.get("company_name", "")}
Number of Employees: {form_data.get("number_of_employees", "")}
Internal Tools to Build: {form_data.get("internal_tools", "")}
How they heard about Reflex: {form_data.get("how_did_you_hear_about_us", "")}"""
params = {
"email": form_data.get("email", ""),
"name": f"{form_data.get('first_name', '')} {form_data.get('last_name', '')}",
"notes": notes_content,
}
query_string = urllib.parse.urlencode(params)
if is_small_company(form_data.get("number_of_employees", "")):
yield rx.redirect(f"{CAL_REQUEST_DEMO_URL}?{query_string}")
return
|
yield is_sending_demo_form.push(False)
yield rx.redirect(cal_url_with_params)
async def send_demo_event(self, form_data: dict[str, Any]):
"""Create and send demo event to PostHog and Slack.
Converts form data into a DemoEvent and sends to both analytics
platforms. Logs errors but doesn't raise exceptions.
Args:
form_data: Form data dictionary containing user inputs
"""
first_name = form_data.get("first_name", "")
last_name = form_data.get("last_name", "")
demo_event = DemoEvent(
distinct_id=f"{first_name} {last_name}",
first_name=first_name,
last_name=last_name,
company_email=form_data.get("email", ""),
job_title=form_data.get("job_title", ""),
company_name=form_data.get("company_name", ""),
num_employees=form_data.get("number_of_employees", ""),
internal_tools=form_data.get("internal_tools",
|
cal_url_with_params = f"{CAL_ENTERPRISE_FOLLOW_UP_URL}?{query_string}"
|
.get("how_did_you_hear_about_us", "")}"""
params = {
"email": form_data.get("email", ""),
"name": f"{form_data.get('first_name', '')} {form_data.get('last_name', '')}",
"notes": notes_content,
}
query_string = urllib.parse.urlencode(params)
if is_small_company(form_data.get("number_of_employees", "")):
yield rx.redirect(f"{CAL_REQUEST_DEMO_URL}?{query_string}")
return
cal_url_with_params = f"{CAL_ENTERPRISE_FOLLOW_UP_URL}?{query_string}"
yield is_sending_demo_form.push(False)
yield rx.redirect(cal_url_with_params)
async def send_demo_event(self, form_data: dict[str, Any]):
"""Create and send demo event to PostHog and Slack.
Converts form data into a DemoEvent and sends to both analytics
platforms. Logs errors but doesn't raise exceptions.
Args:
form_data: Form data dictionary containing user inputs
"""
|
last_name = form_data.get("last_name", "")
demo_event = DemoEvent(
distinct_id=f"{first_name} {last_name}",
first_name=first_name,
last_name=last_name,
company_email=form_data.get("email", ""),
job_title=form_data.get("job_title", ""),
company_name=form_data.get("company_name", ""),
num_employees=form_data.get("number_of_employees", ""),
internal_tools=form_data.get("internal_tools", ""),
referral_source=form_data.get("how_did_you_hear_about_us", ""),
)
# Send data to PostHog, Common Room, and Slack
await asyncio.gather(
self.send_data_to_posthog(demo_event),
self.send_data_to_common_room(demo_event),
self.send_data_to_slack(demo_event),
)
async def send_data_to_posthog(self, event_instance: PosthogEvent):
"""Send data to PostHog using class introspection.
Args:
|
first_name = form_data.get("first_name", "")
|
ams = {
"email": form_data.get("email", ""),
"name": f"{form_data.get('first_name', '')} {form_data.get('last_name', '')}",
"notes": notes_content,
}
query_string = urllib.parse.urlencode(params)
if is_small_company(form_data.get("number_of_employees", "")):
yield rx.redirect(f"{CAL_REQUEST_DEMO_URL}?{query_string}")
return
cal_url_with_params = f"{CAL_ENTERPRISE_FOLLOW_UP_URL}?{query_string}"
yield is_sending_demo_form.push(False)
yield rx.redirect(cal_url_with_params)
async def send_demo_event(self, form_data: dict[str, Any]):
"""Create and send demo event to PostHog and Slack.
Converts form data into a DemoEvent and sends to both analytics
platforms. Logs errors but doesn't raise exceptions.
Args:
form_data: Form data dictionary containing user inputs
"""
first_name = form_data.get("first_name", "")
|
demo_event = DemoEvent(
distinct_id=f"{first_name} {last_name}",
first_name=first_name,
last_name=last_name,
company_email=form_data.get("email", ""),
job_title=form_data.get("job_title", ""),
company_name=form_data.get("company_name", ""),
num_employees=form_data.get("number_of_employees", ""),
internal_tools=form_data.get("internal_tools", ""),
referral_source=form_data.get("how_did_you_hear_about_us", ""),
)
# Send data to PostHog, Common Room, and Slack
await asyncio.gather(
self.send_data_to_posthog(demo_event),
self.send_data_to_common_room(demo_event),
self.send_data_to_slack(demo_event),
)
async def send_data_to_posthog(self, event_instance: PosthogEvent):
"""Send data to PostHog using class introspection.
Args:
event_instance: An instance of a PosthogEvent subc
|
last_name = form_data.get("last_name", "")
|
""),
"name": f"{form_data.get('first_name', '')} {form_data.get('last_name', '')}",
"notes": notes_content,
}
query_string = urllib.parse.urlencode(params)
if is_small_company(form_data.get("number_of_employees", "")):
yield rx.redirect(f"{CAL_REQUEST_DEMO_URL}?{query_string}")
return
cal_url_with_params = f"{CAL_ENTERPRISE_FOLLOW_UP_URL}?{query_string}"
yield is_sending_demo_form.push(False)
yield rx.redirect(cal_url_with_params)
async def send_demo_event(self, form_data: dict[str, Any]):
"""Create and send demo event to PostHog and Slack.
Converts form data into a DemoEvent and sends to both analytics
platforms. Logs errors but doesn't raise exceptions.
Args:
form_data: Form data dictionary containing user inputs
"""
first_name = form_data.get("first_name", "")
last_name = form_data.get("last_name", "")
|
# Send data to PostHog, Common Room, and Slack
await asyncio.gather(
self.send_data_to_posthog(demo_event),
self.send_data_to_common_room(demo_event),
self.send_data_to_slack(demo_event),
)
async def send_data_to_posthog(self, event_instance: PosthogEvent):
"""Send data to PostHog using class introspection.
Args:
event_instance: An instance of a PosthogEvent subclass.
Raises:
httpx.HTTPError: When there is an error sending data to PostHog.
"""
event_data = {
"api_key": POSTHOG_API_KEY,
"event": event_instance.__class__.__name__,
"properties": event_instance.to_dict(),
}
try:
async with httpx.AsyncClient() as client:
response = await client.post(
"https://app.posthog.com/capture/", json=event_data
)
response.raise_for_status()
|
demo_event = DemoEvent(
distinct_id=f"{first_name} {last_name}",
first_name=first_name,
last_name=last_name,
company_email=form_data.get("email", ""),
job_title=form_data.get("job_title", ""),
company_name=form_data.get("company_name", ""),
num_employees=form_data.get("number_of_employees", ""),
internal_tools=form_data.get("internal_tools", ""),
referral_source=form_data.get("how_did_you_hear_about_us", ""),
)
|
last_name=last_name,
company_email=form_data.get("email", ""),
job_title=form_data.get("job_title", ""),
company_name=form_data.get("company_name", ""),
num_employees=form_data.get("number_of_employees", ""),
internal_tools=form_data.get("internal_tools", ""),
referral_source=form_data.get("how_did_you_hear_about_us", ""),
)
# Send data to PostHog, Common Room, and Slack
await asyncio.gather(
self.send_data_to_posthog(demo_event),
self.send_data_to_common_room(demo_event),
self.send_data_to_slack(demo_event),
)
async def send_data_to_posthog(self, event_instance: PosthogEvent):
"""Send data to PostHog using class introspection.
Args:
event_instance: An instance of a PosthogEvent subclass.
Raises:
httpx.HTTPError: When there is an error sending data to PostHog.
"""
|
try:
async with httpx.AsyncClient() as client:
response = await client.post(
"https://app.posthog.com/capture/", json=event_data
)
response.raise_for_status()
except Exception:
log("Error sending data to PostHog")
async def send_data_to_common_room(self, event_instance: DemoEvent):
"""Update CommonRoom with user login information."""
tags: Sequence[str] = [
"Requested Demo",
]
try:
async with httpx.AsyncClient() as client:
await client.post(
f"https://api.commonroom.io/community/v1/source/{COMMONROOM_DESTINATION_ID}/activity",
headers={
"Content-Type": "application/json",
"Authorization": f"Bearer {COMMONROOM_API_TOKEN}",
},
json={
"id": "requested_demo
|
event_data = {
"api_key": POSTHOG_API_KEY,
"event": event_instance.__class__.__name__,
"properties": event_instance.to_dict(),
}
|
loyees", ""),
internal_tools=form_data.get("internal_tools", ""),
referral_source=form_data.get("how_did_you_hear_about_us", ""),
)
# Send data to PostHog, Common Room, and Slack
await asyncio.gather(
self.send_data_to_posthog(demo_event),
self.send_data_to_common_room(demo_event),
self.send_data_to_slack(demo_event),
)
async def send_data_to_posthog(self, event_instance: PosthogEvent):
"""Send data to PostHog using class introspection.
Args:
event_instance: An instance of a PosthogEvent subclass.
Raises:
httpx.HTTPError: When there is an error sending data to PostHog.
"""
event_data = {
"api_key": POSTHOG_API_KEY,
"event": event_instance.__class__.__name__,
"properties": event_instance.to_dict(),
}
try:
async with httpx.AsyncClient() as client:
|
response.raise_for_status()
except Exception:
log("Error sending data to PostHog")
async def send_data_to_common_room(self, event_instance: DemoEvent):
"""Update CommonRoom with user login information."""
tags: Sequence[str] = [
"Requested Demo",
]
try:
async with httpx.AsyncClient() as client:
await client.post(
f"https://api.commonroom.io/community/v1/source/{COMMONROOM_DESTINATION_ID}/activity",
headers={
"Content-Type": "application/json",
"Authorization": f"Bearer {COMMONROOM_API_TOKEN}",
},
json={
"id": "requested_demo",
"activityType": "requested_demo",
"user": {
"id": str(uuid.uuid4()),
"email": event_instance.com
|
response = await client.post(
"https://app.posthog.com/capture/", json=event_data
)
|
json={
"id": "requested_demo",
"activityType": "requested_demo",
"user": {
"id": str(uuid.uuid4()),
"email": event_instance.company_email,
},
"tags": [
{
"type": "name",
"name": tag,
}
for tag in tags
],
},
)
except Exception as ex:
log(
f"CommonRoom: Failed to identify user with email {event_instance.company_email}, err: {ex}"
)
async def send_data_to_slack(self, event_instance: DemoEvent):
"""Send demo form data to Slack webhook.
Args:
event_instance: An instance of DemoEvent with form data.
"""
|
try:
async with httpx.AsyncClient() as client:
response = await client.post(
SLACK_DEMO_WEBHOOK_URL,
json=slack_payload,
headers={"Content-Type": "application/json"},
)
response.raise_for_status()
except Exception as e:
log(f"Error sending data to Slack webhook: {e}")
@classmethod
def get_component(cls, **props):
"""Create and return the demo form component.
Builds a complete form with all required fields, validation,
and styling. The form includes personal info, company details,
and preferences.
Args:
**props: Additional properties to pass to the form component
Returns:
A Reflex form component with all demo form fields
"""
return rx.el.form(
rx.el.div(
input_field("First name", "John", "first_name", "text", True)
|
slack_payload = {
"lookingToBuild": event_instance.internal_tools,
"businessEmail": event_instance.company_email,
"howDidYouHear": event_instance.referral_source,
"jobTitle": event_instance.job_title,
"numEmployees": event_instance.num_employees,
"companyName": event_instance.company_name,
"firstName": event_instance.first_name,
"lastName": event_instance.last_name,
}
|
],
},
)
except Exception as ex:
log(
f"CommonRoom: Failed to identify user with email {event_instance.company_email}, err: {ex}"
)
async def send_data_to_slack(self, event_instance: DemoEvent):
"""Send demo form data to Slack webhook.
Args:
event_instance: An instance of DemoEvent with form data.
"""
slack_payload = {
"lookingToBuild": event_instance.internal_tools,
"businessEmail": event_instance.company_email,
"howDidYouHear": event_instance.referral_source,
"jobTitle": event_instance.job_title,
"numEmployees": event_instance.num_employees,
"companyName": event_instance.company_name,
"firstName": event_instance.first_name,
"lastName": event_instance.last_name,
}
try:
async with httpx.AsyncClient() as client:
|
response.raise_for_status()
except Exception as e:
log(f"Error sending data to Slack webhook: {e}")
@classmethod
def get_component(cls, **props):
"""Create and return the demo form component.
Builds a complete form with all required fields, validation,
and styling. The form includes personal info, company details,
and preferences.
Args:
**props: Additional properties to pass to the form component
Returns:
A Reflex form component with all demo form fields
"""
return rx.el.form(
rx.el.div(
input_field("First name", "John", "first_name", "text", True),
input_field("Last name", "Smith", "last_name", "text", True),
class_name="grid grid-cols-2 gap-4",
),
input_field("Business Email", "[email protected]", "email", "email", True),
rx.el.div(
input_f
|
response = await client.post(
SLACK_DEMO_WEBHOOK_URL,
json=slack_payload,
headers={"Content-Type": "application/json"},
)
|
"Google Search",
"Social Media",
"Word of Mouth",
"Blog",
"Conference",
"Other",
],
),
class_name="grid @max-md:grid-cols-1 grid-cols-2 gap-4",
),
rx.cond(
demo_form_error_message.value,
rx.el.span(
demo_form_error_message.value,
class_name="text-destructive-10 text-sm font-medium",
),
),
ui.button(
"Submit",
type="submit",
class_name="w-full",
loading=is_sending_demo_form.value,
),
on_submit=cls.on_submit,
class_name=ui.cn(
"@container flex flex-col gap-6 p-6",
props.pop("class_name", ""),
),
**props,
)
|
demo_form = DemoForm.create
|
|
"""Lemcal calendar embed components."""
|
import reflex_ui as ui
LEMCAL_DEMO_URL = "https://app.lemcal.com/@alek/reflex-demo-call"
@rx.memo
def lemcal_booking_calendar():
"""Return the Lemcal booking calendar."""
return rx.fragment(
rx.el.div(
class_name="lemcal-embed-booking-calendar h-[calc(100dvh-4rem)] overflow-y-auto w-auto max-h-fit",
custom_attrs={
"data-user": "usr_8tiwtJ8nEJaFj2qH9",
"data-meeting-type": "met_EHtPvmZoKE4SFk4kZ",
},
on_mount=rx.call_script(
"""
if (window.lemcal && window.lemcal.refresh) {
window.lemcal.refresh();
}
"""
),
),
lemcal_script(),
)
def lemcal_script(**props) -> rx.Component:
"""Return the Lemcal integrations script tag."""
return rx.script(
src="https://cdn.lemcal.com/lemcal-integrations.min.js",
defer=True,
**props,
)
def lemcal_dialog(trig
|
import reflex as rx
|
"""Lemcal calendar embed components."""
import reflex as rx
|
LEMCAL_DEMO_URL = "https://app.lemcal.com/@alek/reflex-demo-call"
@rx.memo
def lemcal_booking_calendar():
"""Return the Lemcal booking calendar."""
return rx.fragment(
rx.el.div(
class_name="lemcal-embed-booking-calendar h-[calc(100dvh-4rem)] overflow-y-auto w-auto max-h-fit",
custom_attrs={
"data-user": "usr_8tiwtJ8nEJaFj2qH9",
"data-meeting-type": "met_EHtPvmZoKE4SFk4kZ",
},
on_mount=rx.call_script(
"""
if (window.lemcal && window.lemcal.refresh) {
window.lemcal.refresh();
}
"""
),
),
lemcal_script(),
)
def lemcal_script(**props) -> rx.Component:
"""Return the Lemcal integrations script tag."""
return rx.script(
src="https://cdn.lemcal.com/lemcal-integrations.min.js",
defer=True,
**props,
)
def lemcal_dialog(trigger: rx.Component, **pro
|
import reflex_ui as ui
|
"""Lemcal calendar embed components."""
import reflex as rx
import reflex_ui as ui
|
@rx.memo
def lemcal_booking_calendar():
"""Return the Lemcal booking calendar."""
return rx.fragment(
rx.el.div(
class_name="lemcal-embed-booking-calendar h-[calc(100dvh-4rem)] overflow-y-auto w-auto max-h-fit",
custom_attrs={
"data-user": "usr_8tiwtJ8nEJaFj2qH9",
"data-meeting-type": "met_EHtPvmZoKE4SFk4kZ",
},
on_mount=rx.call_script(
"""
if (window.lemcal && window.lemcal.refresh) {
window.lemcal.refresh();
}
"""
),
),
lemcal_script(),
)
def lemcal_script(**props) -> rx.Component:
"""Return the Lemcal integrations script tag."""
return rx.script(
src="https://cdn.lemcal.com/lemcal-integrations.min.js",
defer=True,
**props,
)
def lemcal_dialog(trigger: rx.Component, **props) -> rx.Component:
"""Return a Lemcal dialog container elemen
|
LEMCAL_DEMO_URL = "https://app.lemcal.com/@alek/reflex-demo-call"
|
o
def lemcal_booking_calendar():
"""Return the Lemcal booking calendar."""
return rx.fragment(
rx.el.div(
class_name="lemcal-embed-booking-calendar h-[calc(100dvh-4rem)] overflow-y-auto w-auto max-h-fit",
custom_attrs={
"data-user": "usr_8tiwtJ8nEJaFj2qH9",
"data-meeting-type": "met_EHtPvmZoKE4SFk4kZ",
},
on_mount=rx.call_script(
"""
if (window.lemcal && window.lemcal.refresh) {
window.lemcal.refresh();
}
"""
),
),
lemcal_script(),
)
def lemcal_script(**props) -> rx.Component:
"""Return the Lemcal integrations script tag."""
return rx.script(
src="https://cdn.lemcal.com/lemcal-integrations.min.js",
defer=True,
**props,
)
def lemcal_dialog(trigger: rx.Component, **props) -> rx.Component:
"""Return a Lemcal dialog container element."""
|
return ui.dialog.root(
ui.dialog.trigger(render_=trigger),
ui.dialog.portal(
ui.dialog.backdrop(),
ui.dialog.popup(
rx.el.div(
ui.dialog.close(
render_=ui.button(
ui.hi("Cancel01Icon"),
variant="secondary",
size="icon-lg",
class_name="text-secondary-12 absolute top-4 right-4 z-10",
),
),
lemcal_booking_calendar(),
class_name="relative isolate overflow-hidde -m-px",
),
class_name="h-fit w-auto mt-1 overflow-hidden",
),
),
class_name=class_name,
**props,
)
|
class_name = ui.cn("w-auto", props.pop("class_name", ""))
|
"""Clearbit analytics tracking integration for Reflex applications."""
|
CLEARBIT_SCRIPT_URL_TEMPLATE: str = (
"https://tag.clearbitscripts.com/v1/{public_key}/tags.js"
)
def get_clearbit_trackers(public_key: str) -> rx.Component:
"""Generate Clearbit tracking component for a Reflex application.
Args:
public_key: Clearbit public key (defaults to app's public key)
Returns:
rx.Component: Script component needed for Clearbit tracking
"""
return rx.el.script(
src=CLEARBIT_SCRIPT_URL_TEMPLATE.format(public_key=public_key),
referrer_policy="strict-origin-when-cross-origin",
)
|
import reflex as rx
|
"""Common Room website visitor tracking integration for Reflex applications."""
|
import reflex as rx
# Common Room tracking configuration
COMMON_ROOM_CDN_URL_TEMPLATE: str = (
"https://cdn.cr-relay.com/v1/site/{site_id}/signals.js"
)
# Common Room tracking script template
COMMON_ROOM_SCRIPT_TEMPLATE: str = """
(function() {{
if (typeof window === 'undefined') return;
if (typeof window.signals !== 'undefined') return;
var script = document.createElement('script');
script.src = '{cdn_url}';
script.async = true;
window.signals = Object.assign(
[],
['page', 'identify', 'form', 'track'].reduce(function (acc, method) {{
acc[method] = function () {{
acc.push([method, arguments]);
return acc;
}};
return acc;
}}, [])
);
document.head.appendChild(script);
}})();
"""
def get_common_room_trackers(site_id: str) -> rx.Component:
"""Generate Common Room tracking component for a Reflex application.
Args:
site_id: Your Common Room si
|
import json
|
"""Common Room website visitor tracking integration for Reflex applications."""
import json
|
# Common Room tracking configuration
COMMON_ROOM_CDN_URL_TEMPLATE: str = (
"https://cdn.cr-relay.com/v1/site/{site_id}/signals.js"
)
# Common Room tracking script template
COMMON_ROOM_SCRIPT_TEMPLATE: str = """
(function() {{
if (typeof window === 'undefined') return;
if (typeof window.signals !== 'undefined') return;
var script = document.createElement('script');
script.src = '{cdn_url}';
script.async = true;
window.signals = Object.assign(
[],
['page', 'identify', 'form', 'track'].reduce(function (acc, method) {{
acc[method] = function () {{
acc.push([method, arguments]);
return acc;
}};
return acc;
}}, [])
);
document.head.appendChild(script);
}})();
"""
def get_common_room_trackers(site_id: str) -> rx.Component:
"""Generate Common Room tracking component for a Reflex application.
Args:
site_id: Your Common Room site ID (found in your
|
import reflex as rx
|
{site_id}/signals.js"
)
# Common Room tracking script template
COMMON_ROOM_SCRIPT_TEMPLATE: str = """
(function() {{
if (typeof window === 'undefined') return;
if (typeof window.signals !== 'undefined') return;
var script = document.createElement('script');
script.src = '{cdn_url}';
script.async = true;
window.signals = Object.assign(
[],
['page', 'identify', 'form', 'track'].reduce(function (acc, method) {{
acc[method] = function () {{
acc.push([method, arguments]);
return acc;
}};
return acc;
}}, [])
);
document.head.appendChild(script);
}})();
"""
def get_common_room_trackers(site_id: str) -> rx.Component:
"""Generate Common Room tracking component for a Reflex application.
Args:
site_id: Your Common Room site ID (found in your tracking snippet)
Returns:
rx.Component: Script component needed for Common Room tracking
"""
|
return rx.script(COMMON_ROOM_SCRIPT_TEMPLATE.format(cdn_url=cdn_url))
def identify_common_room_user(
email: str, name: str | None = None
) -> rx.event.EventSpec:
"""Identify a user in Common Room analytics after form submission or login.
This should be called when you have user identity information available,
such as after a form submission or user login.
Args:
email: User's email address
name: User's full name (optional)
Returns:
rx.Component: Script component that identifies the user in Common Room
"""
identify_data = {"email": email}
if name:
identify_data["name"] = name
js_data = json.dumps(identify_data)
return rx.call_script(
f"""
// Identify user in Common Room after form submission or login
if (typeof window.signals !== 'undefined' && window.signals.identify) {{
window.signals.identify({js_data});
}}
"""
)
|
cdn_url = COMMON_ROOM_CDN_URL_TEMPLATE.format(site_id=site_id)
|
ument.head.appendChild(script);
}})();
"""
def get_common_room_trackers(site_id: str) -> rx.Component:
"""Generate Common Room tracking component for a Reflex application.
Args:
site_id: Your Common Room site ID (found in your tracking snippet)
Returns:
rx.Component: Script component needed for Common Room tracking
"""
cdn_url = COMMON_ROOM_CDN_URL_TEMPLATE.format(site_id=site_id)
return rx.script(COMMON_ROOM_SCRIPT_TEMPLATE.format(cdn_url=cdn_url))
def identify_common_room_user(
email: str, name: str | None = None
) -> rx.event.EventSpec:
"""Identify a user in Common Room analytics after form submission or login.
This should be called when you have user identity information available,
such as after a form submission or user login.
Args:
email: User's email address
name: User's full name (optional)
Returns:
rx.Component: Script component that identifies the user in Common Room
"""
|
if name:
identify_data["name"] = name
js_data = json.dumps(identify_data)
return rx.call_script(
f"""
// Identify user in Common Room after form submission or login
if (typeof window.signals !== 'undefined' && window.signals.identify) {{
window.signals.identify({js_data});
}}
"""
)
|
identify_data = {"email": email}
|
;
"""
def get_common_room_trackers(site_id: str) -> rx.Component:
"""Generate Common Room tracking component for a Reflex application.
Args:
site_id: Your Common Room site ID (found in your tracking snippet)
Returns:
rx.Component: Script component needed for Common Room tracking
"""
cdn_url = COMMON_ROOM_CDN_URL_TEMPLATE.format(site_id=site_id)
return rx.script(COMMON_ROOM_SCRIPT_TEMPLATE.format(cdn_url=cdn_url))
def identify_common_room_user(
email: str, name: str | None = None
) -> rx.event.EventSpec:
"""Identify a user in Common Room analytics after form submission or login.
This should be called when you have user identity information available,
such as after a form submission or user login.
Args:
email: User's email address
name: User's full name (optional)
Returns:
rx.Component: Script component that identifies the user in Common Room
"""
identify_data = {"email": email}
|
js_data = json.dumps(identify_data)
return rx.call_script(
f"""
// Identify user in Common Room after form submission or login
if (typeof window.signals !== 'undefined' && window.signals.identify) {{
window.signals.identify({js_data});
}}
"""
)
|
if name:
identify_data["name"] = name
|
ommon_room_trackers(site_id: str) -> rx.Component:
"""Generate Common Room tracking component for a Reflex application.
Args:
site_id: Your Common Room site ID (found in your tracking snippet)
Returns:
rx.Component: Script component needed for Common Room tracking
"""
cdn_url = COMMON_ROOM_CDN_URL_TEMPLATE.format(site_id=site_id)
return rx.script(COMMON_ROOM_SCRIPT_TEMPLATE.format(cdn_url=cdn_url))
def identify_common_room_user(
email: str, name: str | None = None
) -> rx.event.EventSpec:
"""Identify a user in Common Room analytics after form submission or login.
This should be called when you have user identity information available,
such as after a form submission or user login.
Args:
email: User's email address
name: User's full name (optional)
Returns:
rx.Component: Script component that identifies the user in Common Room
"""
identify_data = {"email": email}
if name:
|
js_data = json.dumps(identify_data)
return rx.call_script(
f"""
// Identify user in Common Room after form submission or login
if (typeof window.signals !== 'undefined' && window.signals.identify) {{
window.signals.identify({js_data});
}}
"""
)
|
identify_data["name"] = name
|
-> rx.Component:
"""Generate Common Room tracking component for a Reflex application.
Args:
site_id: Your Common Room site ID (found in your tracking snippet)
Returns:
rx.Component: Script component needed for Common Room tracking
"""
cdn_url = COMMON_ROOM_CDN_URL_TEMPLATE.format(site_id=site_id)
return rx.script(COMMON_ROOM_SCRIPT_TEMPLATE.format(cdn_url=cdn_url))
def identify_common_room_user(
email: str, name: str | None = None
) -> rx.event.EventSpec:
"""Identify a user in Common Room analytics after form submission or login.
This should be called when you have user identity information available,
such as after a form submission or user login.
Args:
email: User's email address
name: User's full name (optional)
Returns:
rx.Component: Script component that identifies the user in Common Room
"""
identify_data = {"email": email}
if name:
identify_data["name"] = name
|
return rx.call_script(
f"""
// Identify user in Common Room after form submission or login
if (typeof window.signals !== 'undefined' && window.signals.identify) {{
window.signals.identify({js_data});
}}
"""
)
|
js_data = json.dumps(identify_data)
|
"""Google Analytics tracking integration for Reflex applications."""
|
# Google Tag Manager script template
GTAG_SCRIPT_TEMPLATE: str = """
window.dataLayer = window.dataLayer || [];
function gtag() {{
window.dataLayer.push(arguments);
}}
gtag('js', new Date());
gtag('config', '{tracking_id}');
"""
# Google Tag Manager script URL template
GTAG_SCRIPT_URL_TEMPLATE: str = (
"https://www.googletagmanager.com/gtag/js?id={tracking_id}"
)
def get_google_analytics_trackers(
tracking_id: str,
) -> list[rx.Component]:
"""Generate Google Analytics tracking components for a Reflex application.
Args:
tracking_id: Google Analytics tracking ID (defaults to app's tracking ID)
Returns:
list[rx.Component]: Script components needed for Google Analytics tracking
"""
# Load Google Tag Manager script
return [
rx.script(src=GTAG_SCRIPT_URL_TEMPLATE.format(tracking_id=tracking_id)),
rx.script(GTAG_SCRIPT_TEMPLATE.format(tracking_id=tracking_id)),
]
|
import reflex as rx
|
"""Koala analytics tracking integration for Reflex applications."""
|
# Koala tracking configuration
KOALA_SCRIPT_URL_TEMPLATE: str = "https://cdn.getkoala.com/v1/{public_api_key}/sdk.js"
# Koala initialization script template
KOALA_SCRIPT_TEMPLATE: str = """
!function(t) {{
if (window.ko) return;
window.ko = [];
[
"identify",
"track",
"removeListeners",
"on",
"off",
"qualify",
"ready"
].forEach(function(t) {{
ko[t] = function() {{
var n = [].slice.call(arguments);
return n.unshift(t), ko.push(n), ko;
}};
}});
var n = document.createElement("script");
n.async = !0;
n.setAttribute("src", "{script_url}");
(document.body || document.head).appendChild(n);
}}();
"""
def get_koala_trackers(public_api_key: str) -> rx.Component:
"""Generate Koala tracking component for a Reflex application.
Args:
public_api_key: Koala public API key
Returns:
rx.Component: Script component needed for Koala tracking
|
import reflex as rx
|
acking configuration
KOALA_SCRIPT_URL_TEMPLATE: str = "https://cdn.getkoala.com/v1/{public_api_key}/sdk.js"
# Koala initialization script template
KOALA_SCRIPT_TEMPLATE: str = """
!function(t) {{
if (window.ko) return;
window.ko = [];
[
"identify",
"track",
"removeListeners",
"on",
"off",
"qualify",
"ready"
].forEach(function(t) {{
ko[t] = function() {{
var n = [].slice.call(arguments);
return n.unshift(t), ko.push(n), ko;
}};
}});
var n = document.createElement("script");
n.async = !0;
n.setAttribute("src", "{script_url}");
(document.body || document.head).appendChild(n);
}}();
"""
def get_koala_trackers(public_api_key: str) -> rx.Component:
"""Generate Koala tracking component for a Reflex application.
Args:
public_api_key: Koala public API key
Returns:
rx.Component: Script component needed for Koala tracking
"""
|
return rx.script(KOALA_SCRIPT_TEMPLATE.format(script_url=script_url))
|
script_url = KOALA_SCRIPT_URL_TEMPLATE.format(public_api_key=public_api_key)
|
"""PostHog analytics tracking integration for Reflex applications."""
|
import reflex as rx
# PostHog tracking configuration
POSTHOG_API_HOST: str = "https://us.i.posthog.com"
# PostHog initialization script template
POSTHOG_SCRIPT_TEMPLATE: str = """
!function(t,e){{
var o,n,p,r;
e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){{
function g(t,e){{
var o=e.split(".");
2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){{
t.push([e].concat(Array.prototype.slice.call(arguments,0)))
}}
}}
(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);
var u=e;
for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){{
var e="posthog";
return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e
}},u.people.toString=function(){{
return u.toSt
|
import json
|
"""PostHog analytics tracking integration for Reflex applications."""
import json
|
# PostHog tracking configuration
POSTHOG_API_HOST: str = "https://us.i.posthog.com"
# PostHog initialization script template
POSTHOG_SCRIPT_TEMPLATE: str = """
!function(t,e){{
var o,n,p,r;
e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){{
function g(t,e){{
var o=e.split(".");
2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){{
t.push([e].concat(Array.prototype.slice.call(arguments,0)))
}}
}}
(p=t.createElement("script")).type="text/javascript",p.async=!0,p.src=s.api_host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);
var u=e;
for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){{
var e="posthog";
return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e
}},u.people.toString=function(){{
return u.toString(1)+".people (stu
|
import reflex as rx
|
.people (stub)"
}},o="capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags getFeatureFlag getFeatureFlagPayload reloadFeatureFlags group updateEarlyAccessFeatureEnrollment getEarlyAccessFeatures getActiveMatchingSurveys getSurveys getNextSurveyStep onSessionId setPersonProperties".split(" "),n=0;n<o.length;n++)g(u,o[n]);
e._i.push([i,s,a])
}},e.__SV=1)
}}(document,window.posthog||[]);
posthog.init('{project_id}', {{
api_host: '{api_host}',
person_profiles: 'always',
session_recording: {{
recordCrossOriginIframes: true,
}}
}});
"""
def identify_posthog_user(user_id: str) -> rx.event.EventSpec:
"""Identify a user in PostHog analytics.
Args:
user_id: Unique identifier for the user
Returns:
rx.event.EventSpec: Event specification for identifying the user in PostHog
"""
|
return rx.call_script(
f"""
if (typeof posthog !== 'undefined') {{
posthog.identify({user_id});
}}
"""
)
def get_posthog_trackers(
project_id: str,
api_host: str = POSTHOG_API_HOST,
) -> rx.Component:
"""Generate PostHog tracking component for a Reflex application.
Args:
project_id: PostHog project ID (defaults to app's project ID)
api_host: PostHog API host URL (defaults to US instance)
Returns:
rx.Component: Script component needed for PostHog tracking
"""
return rx.script(
POSTHOG_SCRIPT_TEMPLATE.format(
project_id=project_id,
api_host=api_host,
)
)
|
user_id = json.dumps(user_id)
|
"""RB2B (Reveal Bot to Bot) analytics tracking integration for Reflex applications."""
|
PIXEL_SCRIPT_RB2B: str = """
!function () {var reb2b = window.reb2b = window.reb2b || [];if (reb2b.invoked) return;reb2b.invoked = true;reb2b.methods = ["identify", "collect"];reb2b.factory = function (method) {return function () {var args = Array.prototype.slice.call(arguments);args.unshift(method);reb2b.push(args);return reb2b;};};for (var i = 0; i < reb2b.methods.length; i++) {var key = reb2b.methods[i];reb2b[key] = reb2b.factory(key);}reb2b.load = function (key) {var script = document.createElement("script");script.type = "text/javascript";script.async = true;script.src = "https://s3-us-west-2.amazonaws.com/b2bjsstore/b/" + key + "/reb2b.js.gz";var first = document.getElementsByTagName("script")[0];first.parentNode.insertBefore(script, first);};reb2b.SNIPPET_VERSION = "1.0.1";reb2b.load("0OV0VHLWZX6Z");}();"""
PIXEL2 = """
!function () {var reb2b = window.reb2b = window.reb2b || [];
if (reb2b.invoked) return;reb2b.invoked = true;reb2b.methods = ["identify", "collect"];
|
import reflex as rx
|
"""Telemetry blocks for the Reflex UI library."""
|
from .common_room import get_common_room_trackers, identify_common_room_user
from .google import get_google_analytics_trackers
from .koala import get_koala_trackers
from .posthog import get_posthog_trackers
from .rb2b import get_rb2b_trackers
__all__ = [
"get_clearbit_trackers",
"get_common_room_trackers",
"get_google_analytics_trackers",
"get_koala_trackers",
"get_posthog_trackers",
"get_rb2b_trackers",
"identify_common_room_user",
]
|
from .clearbit import get_clearbit_trackers
|
"""Telemetry blocks for the Reflex UI library."""
from .clearbit import get_clearbit_trackers
from .common_room import get_common_room_trackers, identify_common_room_user
|
from .koala import get_koala_trackers
from .posthog import get_posthog_trackers
from .rb2b import get_rb2b_trackers
__all__ = [
"get_clearbit_trackers",
"get_common_room_trackers",
"get_google_analytics_trackers",
"get_koala_trackers",
"get_posthog_trackers",
"get_rb2b_trackers",
"identify_common_room_user",
]
|
from .google import get_google_analytics_trackers
|
"""Telemetry blocks for the Reflex UI library."""
from .clearbit import get_clearbit_trackers
from .common_room import get_common_room_trackers, identify_common_room_user
from .google import get_google_analytics_trackers
|
from .posthog import get_posthog_trackers
from .rb2b import get_rb2b_trackers
__all__ = [
"get_clearbit_trackers",
"get_common_room_trackers",
"get_google_analytics_trackers",
"get_koala_trackers",
"get_posthog_trackers",
"get_rb2b_trackers",
"identify_common_room_user",
]
|
from .koala import get_koala_trackers
|
"""Telemetry blocks for the Reflex UI library."""
from .clearbit import get_clearbit_trackers
from .common_room import get_common_room_trackers, identify_common_room_user
from .google import get_google_analytics_trackers
from .koala import get_koala_trackers
|
from .rb2b import get_rb2b_trackers
__all__ = [
"get_clearbit_trackers",
"get_common_room_trackers",
"get_google_analytics_trackers",
"get_koala_trackers",
"get_posthog_trackers",
"get_rb2b_trackers",
"identify_common_room_user",
]
|
from .posthog import get_posthog_trackers
|
"""Telemetry blocks for the Reflex UI library."""
from .clearbit import get_clearbit_trackers
from .common_room import get_common_room_trackers, identify_common_room_user
from .google import get_google_analytics_trackers
from .koala import get_koala_trackers
from .posthog import get_posthog_trackers
|
__all__ = [
"get_clearbit_trackers",
"get_common_room_trackers",
"get_google_analytics_trackers",
"get_koala_trackers",
"get_posthog_trackers",
"get_rb2b_trackers",
"identify_common_room_user",
]
|
from .rb2b import get_rb2b_trackers
|
"""Base UI component."""
# Based on https://base-ui.com/
from reflex_ui.components.component import CoreComponent
PACKAGE_NAME = "@base-ui-components/react"
|
class BaseUIComponent(CoreComponent):
"""Base UI component."""
lib_dependencies: list[str] = [f"{PACKAGE_NAME}@{PACKAGE_VERSION}"]
|
PACKAGE_VERSION = "1.0.0-beta.4"
|
"""Core component for all components."""
|
from reflex.components.component import Component
from reflex.vars.base import Var
from reflex_ui.utils.twmerge import cn
class CoreComponent(Component):
"""Core component for all components."""
# Whether the component should be unstyled
unstyled: Var[bool]
@classmethod
def set_class_name(
cls, default_class_name: str | Var[str], props: dict[str, Any]
) -> None:
"""Set the class name in props, merging with the default if necessary.
Args:
props: The component props dictionary
default_class_name: The default class name to use
"""
if "render_" in props:
return
props_class_name = props.get("class_name", "")
if props.pop("unstyled", False):
props["class_name"] = props_class_name
return
props["class_name"] = cn(default_class_name, props_class_name)
def _exclude_props(self) -> list[str]:
return [
*super()._excl
|
from typing import Any
|
"""Core component for all components."""
from typing import Any
|
from reflex.vars.base import Var
from reflex_ui.utils.twmerge import cn
class CoreComponent(Component):
"""Core component for all components."""
# Whether the component should be unstyled
unstyled: Var[bool]
@classmethod
def set_class_name(
cls, default_class_name: str | Var[str], props: dict[str, Any]
) -> None:
"""Set the class name in props, merging with the default if necessary.
Args:
props: The component props dictionary
default_class_name: The default class name to use
"""
if "render_" in props:
return
props_class_name = props.get("class_name", "")
if props.pop("unstyled", False):
props["class_name"] = props_class_name
return
props["class_name"] = cn(default_class_name, props_class_name)
def _exclude_props(self) -> list[str]:
return [
*super()._exclude_props(),
"unstyled",
]
|
from reflex.components.component import Component
|
"""Core component for all components."""
from typing import Any
from reflex.components.component import Component
|
from reflex_ui.utils.twmerge import cn
class CoreComponent(Component):
"""Core component for all components."""
# Whether the component should be unstyled
unstyled: Var[bool]
@classmethod
def set_class_name(
cls, default_class_name: str | Var[str], props: dict[str, Any]
) -> None:
"""Set the class name in props, merging with the default if necessary.
Args:
props: The component props dictionary
default_class_name: The default class name to use
"""
if "render_" in props:
return
props_class_name = props.get("class_name", "")
if props.pop("unstyled", False):
props["class_name"] = props_class_name
return
props["class_name"] = cn(default_class_name, props_class_name)
def _exclude_props(self) -> list[str]:
return [
*super()._exclude_props(),
"unstyled",
]
|
from reflex.vars.base import Var
|
"""Core component for all components."""
from typing import Any
from reflex.components.component import Component
from reflex.vars.base import Var
|
class CoreComponent(Component):
"""Core component for all components."""
# Whether the component should be unstyled
unstyled: Var[bool]
@classmethod
def set_class_name(
cls, default_class_name: str | Var[str], props: dict[str, Any]
) -> None:
"""Set the class name in props, merging with the default if necessary.
Args:
props: The component props dictionary
default_class_name: The default class name to use
"""
if "render_" in props:
return
props_class_name = props.get("class_name", "")
if props.pop("unstyled", False):
props["class_name"] = props_class_name
return
props["class_name"] = cn(default_class_name, props_class_name)
def _exclude_props(self) -> list[str]:
return [
*super()._exclude_props(),
"unstyled",
]
|
from reflex_ui.utils.twmerge import cn
|
"""Core component for all components."""
from typing import Any
from reflex.components.component import Component
from reflex.vars.base import Var
from reflex_ui.utils.twmerge import cn
class CoreComponent(Component):
"""Core component for all components."""
# Whether the component should be unstyled
unstyled: Var[bool]
@classmethod
def set_class_name(
cls, default_class_name: str | Var[str], props: dict[str, Any]
) -> None:
"""Set the class name in props, merging with the default if necessary.
Args:
props: The component props dictionary
default_class_name: The default class name to use
"""
|
props_class_name = props.get("class_name", "")
if props.pop("unstyled", False):
props["class_name"] = props_class_name
return
props["class_name"] = cn(default_class_name, props_class_name)
def _exclude_props(self) -> list[str]:
return [
*super()._exclude_props(),
"unstyled",
]
|
if "render_" in props:
return
|
"""Core component for all components."""
from typing import Any
from reflex.components.component import Component
from reflex.vars.base import Var
from reflex_ui.utils.twmerge import cn
class CoreComponent(Component):
"""Core component for all components."""
# Whether the component should be unstyled
unstyled: Var[bool]
@classmethod
def set_class_name(
cls, default_class_name: str | Var[str], props: dict[str, Any]
) -> None:
"""Set the class name in props, merging with the default if necessary.
Args:
props: The component props dictionary
default_class_name: The default class name to use
"""
if "render_" in props:
return
|
if props.pop("unstyled", False):
props["class_name"] = props_class_name
return
props["class_name"] = cn(default_class_name, props_class_name)
def _exclude_props(self) -> list[str]:
return [
*super()._exclude_props(),
"unstyled",
]
|
props_class_name = props.get("class_name", "")
|
"""Core component for all components."""
from typing import Any
from reflex.components.component import Component
from reflex.vars.base import Var
from reflex_ui.utils.twmerge import cn
class CoreComponent(Component):
"""Core component for all components."""
# Whether the component should be unstyled
unstyled: Var[bool]
@classmethod
def set_class_name(
cls, default_class_name: str | Var[str], props: dict[str, Any]
) -> None:
"""Set the class name in props, merging with the default if necessary.
Args:
props: The component props dictionary
default_class_name: The default class name to use
"""
if "render_" in props:
return
props_class_name = props.get("class_name", "")
|
props["class_name"] = cn(default_class_name, props_class_name)
def _exclude_props(self) -> list[str]:
return [
*super()._exclude_props(),
"unstyled",
]
|
if props.pop("unstyled", False):
props["class_name"] = props_class_name
return
|
"""Core component for all components."""
from typing import Any
from reflex.components.component import Component
from reflex.vars.base import Var
from reflex_ui.utils.twmerge import cn
class CoreComponent(Component):
"""Core component for all components."""
# Whether the component should be unstyled
unstyled: Var[bool]
@classmethod
def set_class_name(
cls, default_class_name: str | Var[str], props: dict[str, Any]
) -> None:
"""Set the class name in props, merging with the default if necessary.
Args:
props: The component props dictionary
default_class_name: The default class name to use
"""
if "render_" in props:
return
props_class_name = props.get("class_name", "")
if props.pop("unstyled", False):
|
return
props["class_name"] = cn(default_class_name, props_class_name)
def _exclude_props(self) -> list[str]:
return [
*super()._exclude_props(),
"unstyled",
]
|
props["class_name"] = props_class_name
|
"""Core component for all components."""
from typing import Any
from reflex.components.component import Component
from reflex.vars.base import Var
from reflex_ui.utils.twmerge import cn
class CoreComponent(Component):
"""Core component for all components."""
# Whether the component should be unstyled
unstyled: Var[bool]
@classmethod
def set_class_name(
cls, default_class_name: str | Var[str], props: dict[str, Any]
) -> None:
"""Set the class name in props, merging with the default if necessary.
Args:
props: The component props dictionary
default_class_name: The default class name to use
"""
if "render_" in props:
return
props_class_name = props.get("class_name", "")
if props.pop("unstyled", False):
props["class_name"] = props_class_name
return
|
def _exclude_props(self) -> list[str]:
return [
*super()._exclude_props(),
"unstyled",
]
|
props["class_name"] = cn(default_class_name, props_class_name)
|
"""Custom Accordion component."""
|
from reflex.components.component import Component, ComponentNamespace
from reflex.components.core.foreach import foreach
from reflex.components.el import Div
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex.vars.object import ObjectVar
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
from reflex_ui.components.icons.hugeicon import icon
LiteralOrientation = Literal["horizontal", "vertical"]
ITEMS_TYPE = list[dict[str, str | Component]]
class ClassNames:
"""Class names for accordion components."""
ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl"
ITEM = ""
HEADER = ""
TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor
|
from typing import Any, Literal
|
"""Custom Accordion component."""
from typing import Any, Literal
|
from reflex.components.core.foreach import foreach
from reflex.components.el import Div
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex.vars.object import ObjectVar
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
from reflex_ui.components.icons.hugeicon import icon
LiteralOrientation = Literal["horizontal", "vertical"]
ITEMS_TYPE = list[dict[str, str | Component]]
class ClassNames:
"""Class names for accordion components."""
ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl"
ITEM = ""
HEADER = ""
TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled
|
from reflex.components.component import Component, ComponentNamespace
|
"""Custom Accordion component."""
from typing import Any, Literal
from reflex.components.component import Component, ComponentNamespace
|
from reflex.components.el import Div
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex.vars.object import ObjectVar
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
from reflex_ui.components.icons.hugeicon import icon
LiteralOrientation = Literal["horizontal", "vertical"]
ITEMS_TYPE = list[dict[str, str | Component]]
class ClassNames:
"""Class names for accordion components."""
ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl"
ITEM = ""
HEADER = ""
TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11
|
from reflex.components.core.foreach import foreach
|
"""Custom Accordion component."""
from typing import Any, Literal
from reflex.components.component import Component, ComponentNamespace
from reflex.components.core.foreach import foreach
|
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex.vars.object import ObjectVar
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
from reflex_ui.components.icons.hugeicon import icon
LiteralOrientation = Literal["horizontal", "vertical"]
ITEMS_TYPE = list[dict[str, str | Component]]
class ClassNames:
"""Class names for accordion components."""
ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl"
ITEM = ""
HEADER = ""
TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11"
PANEL = "h-[var(--accordion-pan
|
from reflex.components.el import Div
|
"""Custom Accordion component."""
from typing import Any, Literal
from reflex.components.component import Component, ComponentNamespace
from reflex.components.core.foreach import foreach
from reflex.components.el import Div
|
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex.vars.object import ObjectVar
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
from reflex_ui.components.icons.hugeicon import icon
LiteralOrientation = Literal["horizontal", "vertical"]
ITEMS_TYPE = list[dict[str, str | Component]]
class ClassNames:
"""Class names for accordion components."""
ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl"
ITEM = ""
HEADER = ""
TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11"
PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-m
|
from reflex.event import EventHandler, passthrough_event_spec
|
"""Custom Accordion component."""
from typing import Any, Literal
from reflex.components.component import Component, ComponentNamespace
from reflex.components.core.foreach import foreach
from reflex.components.el import Div
from reflex.event import EventHandler, passthrough_event_spec
|
from reflex.vars.base import Var
from reflex.vars.object import ObjectVar
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
from reflex_ui.components.icons.hugeicon import icon
LiteralOrientation = Literal["horizontal", "vertical"]
ITEMS_TYPE = list[dict[str, str | Component]]
class ClassNames:
"""Class names for accordion components."""
ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl"
ITEM = ""
HEADER = ""
TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11"
PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[en
|
from reflex.utils.imports import ImportVar
|
"""Custom Accordion component."""
from typing import Any, Literal
from reflex.components.component import Component, ComponentNamespace
from reflex.components.core.foreach import foreach
from reflex.components.el import Div
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
|
from reflex.vars.object import ObjectVar
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
from reflex_ui.components.icons.hugeicon import icon
LiteralOrientation = Literal["horizontal", "vertical"]
ITEMS_TYPE = list[dict[str, str | Component]]
class ClassNames:
"""Class names for accordion components."""
ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl"
ITEM = ""
HEADER = ""
TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11"
PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-st
|
from reflex.vars.base import Var
|
"""Custom Accordion component."""
from typing import Any, Literal
from reflex.components.component import Component, ComponentNamespace
from reflex.components.core.foreach import foreach
from reflex.components.el import Div
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
|
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
from reflex_ui.components.icons.hugeicon import icon
LiteralOrientation = Literal["horizontal", "vertical"]
ITEMS_TYPE = list[dict[str, str | Component]]
class ClassNames:
"""Class names for accordion components."""
ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl"
ITEM = ""
HEADER = ""
TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11"
PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 border-t border-secondary-a4"
|
from reflex.vars.object import ObjectVar
|
"""Custom Accordion component."""
from typing import Any, Literal
from reflex.components.component import Component, ComponentNamespace
from reflex.components.core.foreach import foreach
from reflex.components.el import Div
from reflex.event import EventHandler, passthrough_event_spec
from reflex.utils.imports import ImportVar
from reflex.vars.base import Var
from reflex.vars.object import ObjectVar
|
from reflex_ui.components.icons.hugeicon import icon
LiteralOrientation = Literal["horizontal", "vertical"]
ITEMS_TYPE = list[dict[str, str | Component]]
class ClassNames:
"""Class names for accordion components."""
ROOT = "flex flex-col justify-center shadow-small border border-secondary-a4 divide-y divide-secondary-a4 overflow-hidden rounded-xl"
ITEM = ""
HEADER = ""
TRIGGER = "group relative flex w-full items-center justify-between gap-4 bg-secondary-1 hover:bg-secondary-3 px-6 py-4 text-md font-semibold text-secondary-12 transition-colors disabled:cursor-not-allowed disabled:bg-secondary-3 disabled:text-secondary-8 disabled:[&_svg]:text-secondary-8 [&_svg]:text-secondary-11"
PANEL = "h-[var(--accordion-panel-height)] overflow-hidden text-base text-secondary-11 font-medium transition-[height] ease-out data-[ending-style]:h-0 data-[starting-style]:h-0 border-t border-secondary-a4"
PANEL_DIV = "py-4 px-6"
TRIGGER_ICON = "size-4 shrink-0 transition
|
from reflex_ui.components.base_ui import PACKAGE_NAME, BaseUIComponent
|
End of preview. Expand
in Data Studio
No dataset card yet
- Downloads last month
- -