Skip to content

Commit 0f22020

Browse files
committed
fixes manage balance code link state
1 parent 8f2acab commit 0f22020

1 file changed

Lines changed: 34 additions & 12 deletions

File tree

web/bringyour.com/lib-ur/connect.js

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1711,7 +1711,7 @@ new function() {
17111711
})
17121712

17131713
const launchAppButtonElement = self.element('launch-app-button')
1714-
const launchRedeemBalanceCodeButtonElement = self.element('launch-redeem-balance-code')
1714+
const launchManageBalanceCodesButtonElement = self.element('launch-manage-balance-codes-button')
17151715

17161716
const preferencesProductUpdateElement = self.element('preferences-product-updates')
17171717
// const feedbackButtonElement = self.element('feedback-button')
@@ -1731,8 +1731,8 @@ new function() {
17311731
})
17321732
}
17331733

1734-
if (launchRedeemBalanceCodeButtonElement) {
1735-
launchRedeemBalanceCodeButtonElement.addEventListener('click', (event) => {
1734+
if (launchManageBalanceCodesButtonElement) {
1735+
launchManageBalanceCodesButtonElement.addEventListener('click', (event) => {
17361736
let windowRef = null
17371737
if (window.safari !== undefined) {
17381738
// desktop Safari
@@ -1975,13 +1975,28 @@ new function() {
19751975
}
19761976

19771977
self.launchApp = (appRoute, windowRef) => {
1978-
const launchAppButtonElement = self.element('launch-app-button')
1979-
const launchAppSpinnerElement = self.element('launch-app-spinner')
1980-
const launchAppErrorElement = self.element('launch-app-error')
1981-
1982-
launchAppButtonElement.disabled = true
1983-
launchAppSpinnerElement.classList.remove('d-none')
1984-
launchAppErrorElement.classList.add('d-none')
1978+
1979+
if (appRoute == '/balance-codes') {
1980+
1981+
const launchManageBalanceCodesButtonElement = self.element('launch-manage-balance-codes-button')
1982+
const launchManageBalanceCodesSpinnerElement = self.element('launch-manage-balance-codes-spinner')
1983+
const launchManageBalanceCodesErrorElement = self.element('launch-manage-balance-codes-error')
1984+
1985+
launchManageBalanceCodesButtonElement.disabled = true
1986+
launchManageBalanceCodesSpinnerElement.classList.remove('d-none')
1987+
launchManageBalanceCodesErrorElement.classList.add('d-none')
1988+
1989+
} else {
1990+
1991+
const launchAppButtonElement = self.element('launch-app-button')
1992+
const launchAppSpinnerElement = self.element('launch-app-spinner')
1993+
const launchAppErrorElement = self.element('launch-app-error')
1994+
1995+
launchAppButtonElement.disabled = true
1996+
launchAppSpinnerElement.classList.remove('d-none')
1997+
launchAppErrorElement.classList.add('d-none')
1998+
1999+
}
19852000

19862001
let requestBody = {
19872002
'uses': 1,
@@ -2005,6 +2020,13 @@ new function() {
20052020
launchAppButtonElement.disabled = false
20062021
launchAppSpinnerElement.classList.add('d-none')
20072022

2023+
const launchManageBalanceCodesButtonElement = self.element('launch-manage-balance-codes-button')
2024+
const launchManageBalanceCodesSpinnerElement = self.element('launch-manage-balance-codes-spinner')
2025+
const launchManageBalanceCodesErrorElement = self.element('launch-manage-balance-codes-error')
2026+
2027+
launchManageBalanceCodesButtonElement.disabled = false
2028+
launchManageBalanceCodesSpinnerElement.classList.add('d-none')
2029+
20082030
if (!responseBody) {
20092031
launchAppErrorElement.textContent = 'Something unexpected happened.'
20102032
launchAppErrorElement.classList.remove('d-none')
@@ -2519,8 +2541,8 @@ new function() {
25192541
</div>
25202542
<div class="login-option">
25212543
<div class="login-container">
2522-
<div><button id="${id('launch-redeem-balance-code')}" type="button" class="btn btn-secondary btn-sm">Manage Balance Codes</button></div>
2523-
<div id="${id('launch-redeem-balance-code-error')}" class="text-danger d-none"></div>
2544+
<div><button id="${id('launch-manage-balance-codes-button')}" type="button" class="btn btn-secondary btn-sm">Manage Balance Codes<span id="${id('launch-manage-balance-codes-spinner')}" class="spinner-border spinner-border-sm d-none" role="status" aria-hidden="true"></span></button></div>
2545+
<div id="${id('launch-manage-balance-codes-error')}" class="text-danger d-none"></div>
25242546
</div>
25252547
</div>
25262548
<div class="login-option">

0 commit comments

Comments
 (0)