1import { Controller } from '@hotwired/stimulus' 2 3export default class extends Controller { 4 static values = { 5 publicKey: String, 6 clientSecret: String, 7 callbackUrl: String 8 } 9 10 static targets = [ 11 'payment', 12 'paymentMessage', 13 'submit', 14 'spinner', 15 'buttonText' 16 ] 17 18 stripe = Stripe(this.publicKeyValue) 19 20 async connect () { 21 this.checkout = await this.stripe.initEmbeddedCheckout({ 22 clientSecret: this.clientSecretValue 23 }) 24 this.checkout.mount(this.element) 25 } 26 27 disconnect () { 28 this.checkout.destroy() 29 } 30 31 showMessage (messageText) { 32 this.paymentMessageTarget.classList.remove('hidden') 33 this.paymentMessageTarget.textContent = messageText 34 35 setTimeout(() => { 36 this.paymentMessageTarget.classList.add('hidden') 37 this.paymentMessageTarget.textContent = '' 38 }, 4000) 39 } 40 41 setLoading (isLoading) { 42 if (isLoading) { 43 this.submitTarget.disabled = true 44 this.spinnerTarget.classList.remove('hidden') 45 this.buttonTextTarget.classList.add('hidden') 46 } else { 47 this.submitTarget.disabled = false 48 this.spinnerTarget.classList.add('hidden') 49 this.buttonTextTarget.classList.remove('hidden') 50 } 51 } 52}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.