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.

remote_billing: Fold the separate .ts files into remote_billing_auth.ts.

Mateusz Manderaa0ea14bdb172
diff --git a/templates/corporate/legacy_server_login.html b/templates/corporate/legacy_server_login.html
index 6ff3eb33654..d3c53acea30 100644
--- a/templates/corporate/legacy_server_login.html
+++ b/templates/corporate/legacy_server_login.html
@@ -42,7 +42,7 @@
<div id="server-login-page-button-container">
<button type="submit" id="server-login-button" class="stripe-button-el invoice-button">
<span class="server-login-button-text">Continue</span>
- <img class="loader server-login-button-loader" src="{{ static('images/loading/loader-white.svg') }}" alt="" />
+ <img class="loader remote-billing-button-loader" src="{{ static('images/loading/loader-white.svg') }}" alt="" />
</button>
</div>
</form>
diff --git a/templates/corporate/remote_billing_confirm_email_form.html b/templates/corporate/remote_billing_confirm_email_form.html
index 16446943489..fb92bfa8104 100644
--- a/templates/corporate/remote_billing_confirm_email_form.html
+++ b/templates/corporate/remote_billing_confirm_email_form.html
@@ -26,7 +26,7 @@
<div class="upgrade-button-container">
<button type="submit" id="remote-billing-confirm-email-button" class="stripe-button-el invoice-button">
<span class="server-login-button-text">Continue</span>
- <img class="loader server-login-button-loader" src="{{ static('images/loading/loader-white.svg') }}" alt="" />
+ <img class="loader remote-billing-button-loader" src="{{ static('images/loading/loader-white.svg') }}" alt="" />
</button>
</div>
</form>
diff --git a/templates/corporate/remote_billing_finalize_login_confirmation.html b/templates/corporate/remote_billing_finalize_login_confirmation.html
index bc093c84930..12011ad31d6 100644
--- a/templates/corporate/remote_billing_finalize_login_confirmation.html
+++ b/templates/corporate/remote_billing_finalize_login_confirmation.html
@@ -32,7 +32,7 @@
<div class="upgrade-button-container">
<button type="submit" id="remote-billing-confirm-login-button" class="stripe-button-el invoice-button">
<span class="remote-billing-confirm-login-button-text">Continue</span>
- <img class="loader remote-billing-confirm-login-button-loader" src="{{ static('images/loading/loader-white.svg') }}" alt="" />
+ <img class="loader remote-billing-button-loader" src="{{ static('images/loading/loader-white.svg') }}" alt="" />
</button>
</div>
</form>
diff --git a/web/src/billing/legacy_server_login.ts b/web/src/billing/remote_billing_auth.ts
similarity index 68%
rename from web/src/billing/legacy_server_login.ts
rename to web/src/billing/remote_billing_auth.ts
index 4e5c718deb3..8383b0c1466 100644
--- a/web/src/billing/legacy_server_login.ts
+++ b/web/src/billing/remote_billing_auth.ts
@@ -1,7 +1,9 @@
import $ from "jquery";
export function initialize(): void {
- $("#server-login-form, #remote-billing-confirm-email-form").validate({
+ $(
+ "#server-login-form, #remote-billing-confirm-email-form, #remote-billing-confirm-login-form",
+ ).validate({
errorClass: "text-error",
wrapper: "div",
submitHandler(form) {
@@ -9,6 +11,10 @@ export function initialize(): void {
$("#server-login-button .server-login-button-text").hide();
$("#remote-billing-confirm-email-form").find(".loader").css("display", "inline-block");
$("#remote-billing-confirm-email-button .server-login-button-text").hide();
+ $("#remote-billing-confirm-login-form").find(".loader").css("display", "inline-block");
+ $(
+ "#remote-billing-confirm-login-button .remote-billing-confirm-login-button-text",
+ ).hide();
form.submit();
},
@@ -17,11 +23,13 @@ export function initialize(): void {
// by the server.
$("#server-login-form .alert.alert-error").remove();
$("#remote-billing-confirm-email-form .alert.alert-error").remove();
+ $("#remote-billing-confirm-login-form .alert.alert-error").remove();
},
showErrors(error_map) {
if (error_map.password) {
$("#server-login-form .alert.alert-error").remove();
$("#remote-billing-confirm-email-form .alert.alert-error").remove();
+ $("#remote-billing-confirm-login-form .alert.alert-error").remove();
}
this.defaultShowErrors!();
},
diff --git a/web/src/billing/remote_billing_confirmation.ts b/web/src/billing/remote_billing_confirmation.ts
deleted file mode 100644
index ff04c65a4dd..00000000000
--- a/web/src/billing/remote_billing_confirmation.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import $ from "jquery";
-
-export function initialize(): void {
- $("#remote-billing-confirm-login-form").find(".loader").hide();
-
- $("#remote-billing-confirm-login-form").validate({
- errorClass: "text-error",
- wrapper: "div",
- submitHandler(form) {
- $("#remote-billing-confirm-login-form").find(".loader").show();
- $(
- "#remote-billing-confirm-login-button .remote-billing-confirm-login-button-text",
- ).hide();
-
- form.submit();
- },
- invalidHandler() {
- $("#remote-billing-confirm-login-form .alert.alert-error").remove();
- },
- showErrors(error_map) {
- if (error_map.id_terms) {
- $("#remote-billing-confirm-login-form .alert.alert-error").remove();
- }
- this.defaultShowErrors!();
- },
- });
-}
-
-$(() => {
- initialize();
-});
diff --git a/web/styles/portico/billing.css b/web/styles/portico/billing.css
index fc7904df264..99fd114d4c3 100644
--- a/web/styles/portico/billing.css
+++ b/web/styles/portico/billing.css
@@ -668,7 +668,7 @@ input[name="licenses"] {
font-weight: 400;
}
-.server-login-button-loader {
+.remote-billing-button-loader {
display: none;
vertical-align: top;
position: relative;
diff --git a/web/webpack.assets.json b/web/webpack.assets.json
index 688f6329494..cd67a6a576f 100644
--- a/web/webpack.assets.json
+++ b/web/webpack.assets.json
@@ -27,8 +27,7 @@
"./src/billing/helpers",
"./src/billing/upgrade",
"jquery-validation",
- "./src/billing/legacy_server_login",
- "./src/billing/remote_billing_confirmation",
+ "./src/billing/remote_billing_auth",
"./styles/portico/billing.css"
],
"billing-event-status": [