support: Add form for sales support queries.

This commit is contained in:
Aman Agrawal 2024-11-03 20:21:04 +05:30
parent e0bd3713cc
commit 6a297b93f1
10 changed files with 185 additions and 2 deletions

View File

@ -70,7 +70,13 @@ from corporate.views.sponsorship import (
sponsorship,
sponsorship_page,
)
from corporate.views.support import demo_request, remote_servers_support, support, support_request
from corporate.views.support import (
demo_request,
remote_servers_support,
sales_support_request,
support,
support_request,
)
from corporate.views.upgrade import (
remote_realm_upgrade,
remote_realm_upgrade_page,
@ -97,6 +103,7 @@ i18n_urlpatterns: Any = [
path("upgrade/", upgrade_page, name="upgrade_page"),
path("support/", support_request),
path("request-demo/", demo_request),
path("contact-sales/", sales_support_request),
path("billing/event_status/", event_status_page, name="event_status_page"),
path("stripe/webhook/", stripe_webhook, name="stripe_webhook"),
# Server admin (user_profile.is_staff) visible stats pages

View File

@ -22,7 +22,11 @@ from pydantic import AfterValidator, Json, NonNegativeInt
from confirmation.models import Confirmation, confirmation_url
from confirmation.settings import STATUS_USED
from corporate.lib.activity import format_optional_datetime, remote_installation_stats_link
from corporate.lib.activity import (
format_optional_datetime,
realm_support_link,
remote_installation_stats_link,
)
from corporate.lib.billing_types import BillingModality
from corporate.models import CustomerPlan
from zerver.actions.create_realm import do_change_realm_subdomain
@ -95,6 +99,13 @@ class DemoRequestForm(forms.Form):
message = forms.CharField(widget=forms.Textarea)
class SalesRequestForm(forms.Form):
MAX_INPUT_LENGTH = 50
organization_website = forms.URLField(required=True, assume_scheme="https")
expected_user_count = forms.CharField(max_length=MAX_INPUT_LENGTH)
message = forms.CharField(widget=forms.Textarea)
@zulip_login_required
@typed_endpoint_without_parameters
def support_request(request: HttpRequest) -> HttpResponse:
@ -186,6 +197,59 @@ def demo_request(request: HttpRequest) -> HttpResponse:
return response
@zulip_login_required
@typed_endpoint_without_parameters
def sales_support_request(request: HttpRequest) -> HttpResponse:
from corporate.lib.stripe import BILLING_SUPPORT_EMAIL
assert request.user.is_authenticated
if not request.user.is_realm_admin:
return render(request, "404.html", status=404)
context = {
"MAX_INPUT_LENGTH": SalesRequestForm.MAX_INPUT_LENGTH,
"user_email": request.user.delivery_email,
"user_full_name": request.user.full_name,
}
if request.POST:
post_data = request.POST.copy()
form = SalesRequestForm(post_data)
if form.is_valid():
rate_limit_request_by_ip(request, domain="sends_email_by_ip")
email_context = {
"full_name": request.user.full_name,
"email": request.user.delivery_email,
"role": UserProfile.ROLE_ID_TO_API_NAME[request.user.role],
"organization_name": request.user.realm.name,
"organization_type": get_org_type_display_name(request.user.realm.org_type),
"organization_website": form.cleaned_data["organization_website"],
"expected_user_count": form.cleaned_data["expected_user_count"],
"message": form.cleaned_data["message"],
"support_link": realm_support_link(request.user.realm.string_id),
}
send_email(
"zerver/emails/sales_support_request",
to_emails=[BILLING_SUPPORT_EMAIL],
from_name="Sales support request",
from_address=FromAddress.tokenized_no_reply_address(),
reply_to_email=email_context["email"],
context=email_context,
)
response = render(
request, "corporate/support/support_request_thanks.html", context=context
)
return response
response = render(request, "corporate/support/sales_support_request.html", context=context)
return response
def get_plan_type_string(plan_type: int) -> str:
return {
Realm.PLAN_TYPE_SELF_HOSTED: "Self-hosted",

View File

@ -0,0 +1,51 @@
{% extends "zerver/portico_signup.html" %}
{% set PAGE_TITLE = "Contact sales | Zulip" %}
{% block portico_content %}
<div class="register-account flex full-page">
<div class="center-block new-style">
<div class="pitch">
<h1>Contact sales</h1>
</div>
<form method="post" class="white-box" id="registration">
{{ csrf_input }}
<fieldset class="support-request">
<div class="input-box support-form-field">
<label for="contact_sales_from" class="inline-block label-title">From</label>
<div id="contact_sales_from" class="not-editable-realm-field">
{{ user_full_name }} ({{ user_email }})
</div>
</div>
<div class="input-box support-form-field">
<label for="sales_support_request_form_organization_website" class="inline-block label-title">Organization website</label>
<input id="sales_support_request_form_organization_website" class="required" type="url" name="organization_website" required />
</div>
<div class="input-box support-form-field">
<label for="sales_support_request_form_expected_user_count" class="inline-block label-title">Expected number of users (approximate range)</label>
<input id="sales_support_request_form_expected_user_count" class="required" type="text" name="expected_user_count" maxlength="{{ MAX_INPUT_LENGTH }}" required />
</div>
<div class="input-box support-form-field">
<label for="sales_support_request_form_message" class="inline-block label-title">Please tell us about your organization and how we can help.</label>
<textarea id="sales_support_request_form_message" name="message" cols="100" rows="5" required></textarea>
</div>
<div class="register-button-box">
<button class="register-button support-submit-button" type="submit">
<span>Submit</span>
<object class="loader" type="image/svg+xml" data="{{ static('images/loading/loader-white.svg') }}"></object>
</button>
</div>
<div class="input-box" id="sales-support-form-bottom-info">
<div class="not-editable-realm-field">
Your message will be sent to <a href="mailto:sales@zulip.com">Zulip Sales</a>.
</div>
</div>
</fieldset>
</form>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,23 @@
{% extends "zerver/emails/email_base_messages.html" %}
{% block content %}
<b>Subject</b>: Sales support request for {{ organization_name }}
<br />
<b>Full name</b>: {{ full_name }}
<br />
<b>Email</b>: {{ email }}
<br />
<b>Role</b>: {{ role }}
<br />
<b>Organization type</b>: {{ organization_type }}
<br />
<b>Organization website</b>: {{ organization_website }}
<br />
<b>Expected user count</b>: {{ expected_user_count }}
<br />
<b>Message</b>: {{ message }}
<br />
<b>Support link</b>: {{ support_link }}
<br />
{% endblock %}

View File

@ -0,0 +1 @@
Sales support request for {{organization_name}}

View File

@ -0,0 +1,17 @@
Subject: Sales support request for {{ organization_name }}
Full name: {{ full_name }}
Email: {{ email }}
Role: {{ role }}
Organization type: {{ organization_type }}
Organization website: {{ organization_website }}
Expected user count: {{ expected_user_count }}
Message: {{ message }}
Support link: {{ support_link }}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -4,6 +4,7 @@ import render_navbar_help_menu from "../templates/popovers/navbar/navbar_help_me
import {page_params} from "./page_params.ts";
import * as popover_menus from "./popover_menus.ts";
import {current_user} from "./state_data.ts";
import {parse_html} from "./ui_util.ts";
export function initialize(): void {
@ -33,6 +34,8 @@ export function initialize(): void {
parse_html(
render_navbar_help_menu({
corporate_enabled: page_params.corporate_enabled,
is_owner: current_user.is_owner,
is_admin: current_user.is_admin,
}),
),
);

View File

@ -1461,3 +1461,12 @@ button#register_auth_button_gitlab {
margin-top: 5px;
display: none;
}
#sales-support-form-bottom-info {
padding: 0;
.not-editable-realm-field {
margin: 0;
padding: 0;
}
}

View File

@ -38,6 +38,14 @@
<span class="popover-menu-label">{{t 'Contact support' }}</span>
</a>
</li>
{{#if (or is_admin is_owner)}}
<li role="none" class="link-item popover-menu-list-item">
<a role="menuitem" href="/contact-sales" target="_blank" rel="noopener noreferrer" class="navigate-link-on-enter popover-menu-link">
<i class="popover-menu-icon zulip-icon zulip-icon-handshake" aria-hidden="true"></i>
<span class="popover-menu-label">{{t 'Contact sales' }}</span>
</a>
</li>
{{/if}}
{{/if}}
</ul>
</div>