diff --git a/app/javascript/application.js b/app/javascript/application.js index 1a377eab..be54143b 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -93,6 +93,7 @@ window.customElements.define('template-builder', class extends HTMLElement { editable: this.dataset.editable !== 'false', authenticityToken: document.querySelector('meta[name="csrf-token"]')?.content, withPayment: this.dataset.withPayment === 'true', + isPaymentConnected: this.dataset.isPaymentConnected === 'true', withFormula: this.dataset.withFormula === 'true', withConditions: this.dataset.withConditions === 'true', currencies: (this.dataset.currencies || '').split(',').filter(Boolean), diff --git a/app/javascript/template_builder/builder.vue b/app/javascript/template_builder/builder.vue index 620c0364..b70ecf2a 100644 --- a/app/javascript/template_builder/builder.vue +++ b/app/javascript/template_builder/builder.vue @@ -332,6 +332,7 @@ export default { backgroundColor: this.backgroundColor, withPhone: this.withPhone, withPayment: this.withPayment, + isPaymentConnected: this.isPaymentConnected, withFormula: this.withFormula, withConditions: this.withConditions, defaultDrawFieldType: this.defaultDrawFieldType, @@ -473,6 +474,11 @@ export default { required: false, default: false }, + isPaymentConnected: { + type: Boolean, + required: false, + default: false + }, withFormula: { type: Boolean, required: false, diff --git a/app/javascript/template_builder/payment_settings.vue b/app/javascript/template_builder/payment_settings.vue index 61cb70df..bd05283f 100644 --- a/app/javascript/template_builder/payment_settings.vue +++ b/app/javascript/template_builder/payment_settings.vue @@ -167,7 +167,7 @@ export default { IconInnerShadowTop, IconBrandStripe }, - inject: ['backgroundColor', 'save', 'currencies', 't'], + inject: ['backgroundColor', 'save', 'currencies', 't', 'isPaymentConnected'], props: { field: { type: Object, @@ -221,6 +221,8 @@ export default { mounted () { this.field.preferences.currency ||= this.defaultCurrency + isConnected.value ||= this.isPaymentConnected + if (!this.isConnected) { this.checkStatus() }