diff --git a/js/app.js b/js/app.js index 7628279d..92564f74 100644 --- a/js/app.js +++ b/js/app.js @@ -7402,6 +7402,29 @@ class Application { return; } + const { autoHideMs, showSpinner } = + options && typeof options === "object" ? options : Object.create(null); + + const shouldShowSpinner = showSpinner !== false; + const existingSpinner = container.querySelector(".status-spinner"); + + if (shouldShowSpinner) { + if (!(existingSpinner instanceof HTMLElementCtor)) { + const spinner = ownerDocument?.createElement?.("span") || null; + if (spinner) { + spinner.className = "status-spinner"; + spinner.setAttribute("aria-hidden", "true"); + if (messageTarget && container.contains(messageTarget)) { + container.insertBefore(spinner, messageTarget); + } else { + container.insertBefore(spinner, container.firstChild); + } + } + } + } else if (existingSpinner instanceof HTMLElementCtor) { + existingSpinner.remove(); + } + if (!msg) { if (messageTarget && messageTarget instanceof HTMLElementCtor) { messageTarget.textContent = ""; @@ -7411,9 +7434,6 @@ class Application { return; } - const { autoHideMs } = - options && typeof options === "object" ? options : Object.create(null); - if (messageTarget && messageTarget instanceof HTMLElementCtor) { messageTarget.textContent = msg; } else { diff --git a/js/payments/zapNotifications.js b/js/payments/zapNotifications.js index b8217b8b..36cd0848 100644 --- a/js/payments/zapNotifications.js +++ b/js/payments/zapNotifications.js @@ -38,12 +38,12 @@ function isNotificationBannerActive({ return text === expectedText; } -function attemptStatusBanner(app, { autoHideMs, expectedText }) { +function attemptStatusBanner(app, { autoHideMs, expectedText, showSpinner }) { if (!app || typeof app.showStatus !== "function") { return false; } - app.showStatus(expectedText, { autoHideMs }); + app.showStatus(expectedText, { autoHideMs, showSpinner }); return isNotificationBannerActive({ container: app.statusContainer, @@ -286,7 +286,7 @@ export function showLoginRequiredToZapNotification({ getOwnerDocument(app?.statusContainer) || getOwnerDocument(app?.errorContainer); - if (attemptStatusBanner(app, { autoHideMs, expectedText })) { + if (attemptStatusBanner(app, { autoHideMs, expectedText, showSpinner: false })) { return true; }