diff --git a/static/components/payment-method-selector.js b/static/components/payment-method-selector.js index 1fd611e..fb6e347 100644 --- a/static/components/payment-method-selector.js +++ b/static/components/payment-method-selector.js @@ -5,6 +5,7 @@ window.app.component('tpos-payment-method-selector', { currency: {type: String, required: true}, currencySymbol: {type: String, required: true}, fiatProvider: {type: Boolean, default: false}, + tapToPayEnabled: {type: Boolean, default: false}, allowCashSettlement: {type: Boolean, default: false}, onchainEnabled: {type: Boolean, default: false}, tabsEnabled: {type: Boolean, default: false}, @@ -70,7 +71,7 @@ window.app.component('tpos-payment-method-selector', { color="secondary" rounded :disable="disabled" - :aria-label="currency + ' TAP'" + :aria-label="'Cash ' + currency" @click="$emit('select', 'cash')" >
@@ -79,14 +80,14 @@ window.app.component('tpos-payment-method-selector', {
-
+
diff --git a/static/js/tpos.js b/static/js/tpos.js index e2778dd..142587c 100644 --- a/static/js/tpos.js +++ b/static/js/tpos.js @@ -172,6 +172,7 @@ window.app = Vue.createApp({ enablePrint: false, enableRemote: false, wrapperMode: false, + tapToPayEnabled: false, receiptData: null, printText: '', orderReceipt: false, @@ -1922,6 +1923,8 @@ window.app = Vue.createApp({ this.enableRemote = Boolean(tpos.enable_remote) this.wrapperMode = new URL(window.location.href).searchParams.get('wrapper') === 'true' + this.tapToPayEnabled = + this.wrapperMode && Boolean(tpos.stripe_card_payments) this.fiatProvider = tpos.fiat_provider this.allowPriceAdjustment = tpos.allow_price_adjustment ?? true this.allowCashSettlement = Boolean(tpos.allow_cash_settlement) diff --git a/templates/tpos/_cart.html b/templates/tpos/_cart.html index 5f2f7f7..3ab45f0 100644 --- a/templates/tpos/_cart.html +++ b/templates/tpos/_cart.html @@ -129,6 +129,7 @@
:currency="currency" :currency-symbol="currencySymbol" :fiat-provider="!!fiatProvider" + :tap-to-pay-enabled="tapToPayEnabled" :allow-cash-settlement="allowCashSettlement" :onchain-enabled="onchainEnabled" :tabs-enabled="tabsEnabled" diff --git a/templates/tpos/dialogs.html b/templates/tpos/dialogs.html index e86a0c3..821b5ac 100644 --- a/templates/tpos/dialogs.html +++ b/templates/tpos/dialogs.html @@ -333,6 +333,7 @@
:currency="currency" :currency-symbol="currencySymbol" :fiat-provider="!!fiatProvider" + :tap-to-pay-enabled="tapToPayEnabled" :allow-cash-settlement="allowCashSettlement" :onchain-enabled="onchainEnabled" :tabs-enabled="tabsEnabled" diff --git a/tests/check_static_load.js b/tests/check_static_load.js index eaeac86..aef1109 100644 --- a/tests/check_static_load.js +++ b/tests/check_static_load.js @@ -184,6 +184,20 @@ for (const page of pages) { } const html = page.templates.map(t => templateWithIncludes(t)).join('\n') + if (page.name === 'public tpos page (tpos.html)') { + const tapToPayBindings = html.match( + /:tap-to-pay-enabled="tapToPayEnabled"/g + ) + const selector = registered['tpos-payment-method-selector'] + if ( + tapToPayBindings?.length !== 2 || + !selector?.props?.tapToPayEnabled || + !selector.template.includes('v-if="tapToPayEnabled"') + ) { + failures += 1 + console.log('FAIL Tap to Pay visibility is not wrapper-gated') + } + } for (const tag of usedComponentTags(html)) { if (registered[tag]) { console.log(`ok <${tag}> is registered`)