Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
sponsorship: Show different discount text for self hosted orgs.
Aman Agrawal8fb126505c5f
diff --git a/templates/corporate/sponsorship.html b/templates/corporate/sponsorship.htmlindex ff698cca90f..2e34d4e6e4f 100644--- a/templates/corporate/sponsorship.html+++ b/templates/corporate/sponsorship.html@@ -100,7 +100,7 @@<div class="white-box"><div id="sponsorship-error" class="alert alert-danger"></div><div id="sponsorship-input-section">- <form id="sponsorship-form" method="post" data-billing-base-url="{{ billing_base_url }}">+ <form id="sponsorship-form" method="post" data-billing-base-url="{{ billing_base_url }}" data-is-remotely-hosted="{{ is_remotely_hosted }}"><input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}" /><div class="input-box sponsorship-form-field no-validation"><label for="org-name" class="inline-block label-title">Organization</label>diff --git a/web/src/billing/helpers.ts b/web/src/billing/helpers.tsindex 5b6c3206ffd..5e1baded35b 100644--- a/web/src/billing/helpers.ts+++ b/web/src/billing/helpers.ts@@ -22,6 +22,28 @@ export const stripe_session_url_schema = z.object({stripe_session_url: z.string(),});+const cloud_discount_details: DiscountDetails = {+ opensource: "Zulip Cloud Standard is free for open-source projects.",+ research: "Zulip Cloud Standard is free for academic research.",+ nonprofit: "Zulip Cloud Standard is discounted 85%+ for registered non-profits.",+ event: "Zulip Cloud Standard is free for academic conferences and most non-profit events.",+ education: "Zulip Cloud Standard is discounted 85% for education.",+ education_nonprofit:+ "Zulip Cloud Standard is discounted 90% for education non-profits with online purchase.",+};++const remote_discount_details: DiscountDetails = {+ opensource: "The Community plan is free for open-source projects.",+ research: "The Community plan is free for academic research.",+ nonprofit:+ "The Community plan is free for registered non-profits with up to 100 users. The Business plan is discounted 85+% with a purchase of 100+ licenses.",+ event: "The Community plan is free for academic conferences and most non-profit events.",+ education:+ "The Community plan is free for education organizations with up to 100 users. The Business plan is discounted 85% with a purchase of 100+ licenses.",+ education_nonprofit:+ "The Community plan is free for education non-profits with up to 100 users. The Business plan is discounted 90% with online purchase of 100+ licenses.",+};+export function create_ajax_request(url: string,form_name: string,@@ -98,22 +120,19 @@ export function format_money(cents: number): string {}).format(Number.parseFloat((cents / 100).toFixed(precision)));}-export function update_discount_details(organization_type: string): void {- let discount_notice =- "Your organization may be eligible for a discount on Zulip Cloud Standard. Organizations whose members are not employees are generally eligible.";- const discount_details: DiscountDetails = {- opensource: "Zulip Cloud Standard is free for open-source projects.",- research: "Zulip Cloud Standard is free for academic research.",- nonprofit: "Zulip Cloud Standard is discounted 85%+ for registered non-profits.",- event: "Zulip Cloud Standard is free for academic conferences and most non-profit events.",- education: "Zulip Cloud Standard is discounted 85% for education.",- education_nonprofit:- "Zulip Cloud Standard is discounted 90% for education non-profits with online purchase.",- };+export function update_discount_details(+ organization_type: string,+ is_remotely_hosted: boolean,+): void {+ let discount_notice = is_remotely_hosted+ ? "Your organization may be eligible for a free Community plan, or a discounted Business plan."+ : "Your organization may be eligible for a discount on Zulip Cloud Standard. Organizations whose members are not employees are generally eligible.";try {const parsed_organization_type = organization_type_schema.parse(organization_type);- discount_notice = discount_details[parsed_organization_type];+ discount_notice = is_remotely_hosted+ ? remote_discount_details[parsed_organization_type]+ : cloud_discount_details[parsed_organization_type];} catch {// This will likely fail if organization_type is not in organization_type_schema or// parsed_organization_type is not preset in discount_details. In either case, we willdiff --git a/web/src/billing/sponsorship.ts b/web/src/billing/sponsorship.tsindex 00ff7231b69..b091cf39090 100644--- a/web/src/billing/sponsorship.ts+++ b/web/src/billing/sponsorship.ts@@ -2,6 +2,8 @@ import $ from "jquery";import * as helpers from "./helpers";+const is_remotely_hosted = $("#sponsorship-form").attr("data-is-remotely-hosted") === "True";+function show_submit_loading_indicator(): void {$("#sponsorship-button .sponsorship-button-loader").css("display", "inline-block");$("#sponsorship-button").prop("disabled", true);@@ -88,7 +90,7 @@ export function initialize(): void {$<HTMLSelectElement>("#organization-type").find(":selected").attr("data-string-value") ?? "";- helpers.update_discount_details(selected_org_type);+ helpers.update_discount_details(selected_org_type, is_remotely_hosted);}update_discount_details();