Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 34 additions & 12 deletions web/bringyour.com/lib-ur/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ new function() {
})

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

const preferencesProductUpdateElement = self.element('preferences-product-updates')
// const feedbackButtonElement = self.element('feedback-button')
Expand All @@ -1731,8 +1731,8 @@ new function() {
})
}

if (launchRedeemBalanceCodeButtonElement) {
launchRedeemBalanceCodeButtonElement.addEventListener('click', (event) => {
if (launchManageBalanceCodesButtonElement) {
launchManageBalanceCodesButtonElement.addEventListener('click', (event) => {
let windowRef = null
if (window.safari !== undefined) {
// desktop Safari
Expand Down Expand Up @@ -1975,13 +1975,28 @@ new function() {
}

self.launchApp = (appRoute, windowRef) => {
const launchAppButtonElement = self.element('launch-app-button')
const launchAppSpinnerElement = self.element('launch-app-spinner')
const launchAppErrorElement = self.element('launch-app-error')

launchAppButtonElement.disabled = true
launchAppSpinnerElement.classList.remove('d-none')
launchAppErrorElement.classList.add('d-none')

if (appRoute == '/balance-codes') {

const launchManageBalanceCodesButtonElement = self.element('launch-manage-balance-codes-button')
const launchManageBalanceCodesSpinnerElement = self.element('launch-manage-balance-codes-spinner')
const launchManageBalanceCodesErrorElement = self.element('launch-manage-balance-codes-error')

launchManageBalanceCodesButtonElement.disabled = true
launchManageBalanceCodesSpinnerElement.classList.remove('d-none')
launchManageBalanceCodesErrorElement.classList.add('d-none')

} else {

const launchAppButtonElement = self.element('launch-app-button')
const launchAppSpinnerElement = self.element('launch-app-spinner')
const launchAppErrorElement = self.element('launch-app-error')

launchAppButtonElement.disabled = true
launchAppSpinnerElement.classList.remove('d-none')
launchAppErrorElement.classList.add('d-none')

}

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

const launchManageBalanceCodesButtonElement = self.element('launch-manage-balance-codes-button')
const launchManageBalanceCodesSpinnerElement = self.element('launch-manage-balance-codes-spinner')
const launchManageBalanceCodesErrorElement = self.element('launch-manage-balance-codes-error')

launchManageBalanceCodesButtonElement.disabled = false
launchManageBalanceCodesSpinnerElement.classList.add('d-none')

if (!responseBody) {
launchAppErrorElement.textContent = 'Something unexpected happened.'
launchAppErrorElement.classList.remove('d-none')
Expand Down Expand Up @@ -2519,8 +2541,8 @@ new function() {
</div>
<div class="login-option">
<div class="login-container">
<div><button id="${id('launch-redeem-balance-code')}" type="button" class="btn btn-secondary btn-sm">Manage Balance Codes</button></div>
<div id="${id('launch-redeem-balance-code-error')}" class="text-danger d-none"></div>
<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>
<div id="${id('launch-manage-balance-codes-error')}" class="text-danger d-none"></div>
</div>
</div>
<div class="login-option">
Expand Down