{"version":3,"file":"form_controller-CkKt-lch.js","sources":["../../../app/javascript/controllers/landing/form_controller.js"],"sourcesContent":["import Hellotext from '@hellotext/hellotext'\n\nimport ApplicationController from '../application_controller'\n\nexport default class extends ApplicationController {\n static values = {\n id: String,\n business: String\n }\n\n static targets = ['form', 'successMessage']\n\n initialize() {\n Hellotext.initialize(this.businessValue, {\n autoGenerateSession: false,\n forms: {\n successMessage: false,\n }\n })\n\n this.onFormCollection = this.onFormCollection.bind(this)\n this.onFormCompletion = this.onFormCompletion.bind(this)\n\n super.initialize()\n }\n\n connect() {\n Hellotext.on('forms:collected', this.onFormCollection)\n Hellotext.on('form:completed', this.onFormCompletion)\n\n super.connect()\n }\n\n disconnect() {\n Hellotext.removeEventListener('forms:collected', this.onFormCollection)\n Hellotext.removeEventListener('form:completed', this.onFormCompletion)\n\n super.disconnect()\n }\n\n onFormCollection(forms) {\n if(forms.getByIndex(0).hasBeenCompleted) {\n this.show(this.successMessageTarget)\n } else {\n this.removeClass(this.formTarget, '!hidden')\n }\n }\n\n onFormCompletion() {\n this.show(this.successMessageTarget)\n }\n}\n"],"names":["form_controller","ApplicationController","Hellotext","forms","__publicField"],"mappings":"8NAIe,MAAKA,UAASC,CAAsB,CAQjD,YAAa,CACXC,EAAU,WAAW,KAAK,cAAe,CACvC,oBAAqB,GACrB,MAAO,CACL,eAAgB,EACxB,CACK,CAAA,EAED,KAAK,iBAAmB,KAAK,iBAAiB,KAAK,IAAI,EACvD,KAAK,iBAAmB,KAAK,iBAAiB,KAAK,IAAI,EAEvD,MAAM,WAAU,CACpB,CAEE,SAAU,CACRA,EAAU,GAAG,kBAAmB,KAAK,gBAAgB,EACrDA,EAAU,GAAG,iBAAkB,KAAK,gBAAgB,EAEpD,MAAM,QAAO,CACjB,CAEE,YAAa,CACXA,EAAU,oBAAoB,kBAAmB,KAAK,gBAAgB,EACtEA,EAAU,oBAAoB,iBAAkB,KAAK,gBAAgB,EAErE,MAAM,WAAU,CACpB,CAEE,iBAAiBC,EAAO,CACnBA,EAAM,WAAW,CAAC,EAAE,iBACrB,KAAK,KAAK,KAAK,oBAAoB,EAEnC,KAAK,YAAY,KAAK,WAAY,SAAS,CAEjD,CAEE,kBAAmB,CACjB,KAAK,KAAK,KAAK,oBAAoB,CACvC,CACA,CA9CEC,EADkBJ,EACX,SAAS,CACd,GAAI,OACJ,SAAU,MACd,GAEEI,EANkBJ,EAMX,UAAU,CAAC,OAAQ,gBAAgB"}