Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

billing: Show success text after plan change on top after reload.

Aman Agrawal637e9c11eeb3
diff --git a/templates/corporate/billing.html b/templates/corporate/billing.html
index 94f4cdcff6b..2c3385872d7 100644
--- a/templates/corporate/billing.html
+++ b/templates/corporate/billing.html
@@ -179,9 +179,6 @@
{% endif %}
</form>
<input name="status" type="hidden" value="{{ CustomerPlan.DOWNGRADE_AT_END_OF_CYCLE }}" />
- <div id="planchange-success" class="alert alert-success billing-page-success">
- Plan updated. The page will now reload.
- </div>
{% if onboarding %}
<div id="onboarding-go-to-org" class="input-box upgrade-page-field">
<a class="not-editable-realm-field" href="/"><b>Go to your Zulip organization</b></a>
diff --git a/web/src/billing/billing.ts b/web/src/billing/billing.ts
index 0183bb93b63..ec8dbb1e41c 100644
--- a/web/src/billing/billing.ts
+++ b/web/src/billing/billing.ts
@@ -170,11 +170,33 @@ export function initialize(): void {
},
);
- $(
- "#confirm-cancel-subscription-modal .dialog_submit_button, #reactivate-subscription .reactivate-current-plan-button, #confirm-end-free-trial .dialog_submit_button",
- ).on("click", (e) => {
+ $("#confirm-cancel-subscription-modal .dialog_submit_button").on("click", (e) => {
helpers.create_ajax_request("/json/billing/plan", "planchange", [], "PATCH", () =>
- window.location.replace("/billing/"),
+ window.location.replace(
+ "/billing/?success_message=" +
+ encodeURIComponent("Your plan has been canceled and will not renew."),
+ ),
+ );
+ e.preventDefault();
+ });
+
+ $("#reactivate-subscription .reactivate-current-plan-button").on("click", (e) => {
+ helpers.create_ajax_request("/json/billing/plan", "planchange", [], "PATCH", () =>
+ window.location.replace(
+ "/billing/?success_message=" +
+ encodeURIComponent(
+ "Your plan has been reactivated and will renew automatically.",
+ ),
+ ),
+ );
+ e.preventDefault();
+ });
+
+ $("#confirm-end-free-trial .dialog_submit_button").on("click", (e) => {
+ helpers.create_ajax_request("/json/billing/plan", "planchange", [], "PATCH", () =>
+ window.location.replace(
+ "/billing/?success_message=" + encodeURIComponent("Successfully ended trial!"),
+ ),
);
e.preventDefault();
});