{"version":3,"sources":["webpack:///./src/views/ListingMakeAnOffer.vue?b41f","webpack:///./src/views/ListingMakeAnOffer.vue","webpack:///./src/views/ListingMakeAnOffer.vue?b4d9","webpack:///./src/views/ListingMakeAnOffer.vue?ba71","webpack:///./src/components/Forms/Form.vue?7753","webpack:///./src/components/Forms/Form.vue?35da","webpack:///./node_modules/client-website-ts-library/plugins/view/index.ts","webpack:///./src/components/Forms/Form.vue?9686","webpack:///./src/components/Forms/Form.vue","webpack:///./src/components/Forms/Form.vue?d965","webpack:///./src/components/Forms/Form.vue?4d45"],"names":["render","_vm","this","_h","$createElement","_c","_self","attrs","listing","Address","FullAddress","Images","Preview","Url","staticStyle","formData","_e","staticRenderFns","Listings","Get","$route","params","id","then","ClientWebsiteId","Website","Id","Items","Type","Context","Listing","components","Form","component","prolistAnalyticsService","ServiceManager","Analytics","headService","Require","Head","evt","obj","getAnalyticsEvent","call","getAnalyticsData","path","name","undefined","triggerAnalyticsEvent","event","GetAll","forEach","adapter","Record","result","head","bind","Promise","meta","Update","UpdateWithStatic","View","requestAnimationFrame","updateHead","updateAnalytics","AsyncView","$on","staticClass","style","loading","on","loadAutosave","_v","_s","autosaveDate","domProps","definition","Options","SubmittedText","_l","section","key","SectionId","ref","refInFor","errors","ctx","type","handleFieldInput","class","submitButtonClass","submitButtonColour","submitButtonBackgroundColour","submitForm","SubmitButtonText","context","errored","submitted","autosaveManager","FormAutosave","hasAutosave","submitPercent","recaptchaService","ReCaptcha","propertyAdressFormFieldValue","fieldBg","fieldColour","borderColour","labelColour","labelFocusedBg","labelFocusedColour","underlineInactive","underlineActive","progress","total","Math","round","console","log","Forms","GetForm","def","enableAutosave","state","GetState","catch","Sections","sectionComponent","$refs","setData","fieldDef","filter","err","Key","collectData","includeRecaptcha","data","normalisedData","normaliseData","SubmitForm","Valid","Submitted","$emit","Result","resetRecaptcha","ValidationState","Errors","finally","newValues","entry","Value","Array","length","push","i","resolve","reject","setTimeout","getRecaptchaResponse","recaptchaResponse","Log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,iBAI5BC,EAgBF,OAfAsB,WAAW,KACT3J,KAAKmE,SAAU,GACd,UAEHnE,KAAK4J,uBAAuBvI,KAAMwI,IAChC,OAAOC,IAAI,OAASC,MAAO,SAAU,0BAErCzB,EAAKiB,KAAK,CACRpB,IAAK,aACLiB,MAAOS,IAGTJ,EAAQnB,KACPX,MAAM+B,GAMXD,EAAQnB,KAIJ,iBACNtI,KAAKoG,iBAAiB4D,QAGhB,uBACN,OAAOhK,KAAKoG,iBAAiB6D,gBA3P/B,yBADC,eAAK,CAAEC,QAAS,KAAM,CAAGzI,MAAO,Q,8BAIjC,yBADC,kB,2BAID,yBADC,kB,yCAID,yBADC,kB,mDAID,yBADC,kB,wCAID,yBADC,kB,wCAID,yBADC,kB,qCAID,yBADC,eAAK,CAAEyI,QAAS,0B,8BAIjB,yBADC,eAAK,CAAEA,QAAS,8B,kCAIjB,yBADC,eAAK,CAAEA,QAAS,8B,kCAIjB,yBADC,eAAK,CAAEA,QAAS,qC,mCAIjB,yBADC,eAAK,CAAEA,QAAS,kC,qCAIjB,yBADC,eAAK,CAAEA,QAAS,sC,yCAIjB,yBADC,eAAK,CAAEA,QAAS,U,wCAIjB,yBADC,eAAK,CAAEA,QAAS,0B,sCAIjB,yBADC,eAAK,CAAEA,SAAS,K,uCA9CE,EAAI,2BANxB,eAAU,CACTrI,WAAY,CACVsI,UAAA,KACAC,SAAA,SAGiB,WC3E4X,I,kCCS7YrI,EAAY,eACd,EACAjC,EACAiB,GACA,EACA,KACA,WACA,MAIa,OAAAgB,E","file":"js/chunk-7ce1246e.df88c102.js","sourcesContent":["var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('Page',[(_vm.listing)?[_c('SiteMasthead',{attrs:{\"mini\":\"true\",\"title\":\"Make an Offer\",\"subtitle\":_vm.listing.Address.FullAddress,\"darken\":\"true\",\"image\":_vm.listing.Images[0].Preview.Url}}),_c('ContentRow',[_c('ContentContainer',{staticStyle:{\"background\":\"#fafafa\",\"padding\":\"2rem\",\"border\":\"1px solid gray\"}},[_c('Form',{attrs:{\"context\":_vm.formData,\"type\":\"Variations.InspireRealEstate.MakeAnOfferForm\"}})],1)],1)]:_vm._e()],2)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport { AsyncView } from 'client-website-ts-library/plugins';\nimport { API, Config } from 'client-website-ts-library/services';\nimport { Listing } from 'client-website-ts-library/types';\nimport { Component, Mixins } from 'vue-property-decorator';\n\nimport Form from '@/components/Forms/Form.vue';\nimport { FormConstructorData } from 'client-website-ts-library/types/Forms';\nimport { ContextItemType } from 'client-website-ts-library/types/Context';\n\n@Component({\n components: {\n Form,\n },\n})\nexport default class ListingMakeAnOffer extends Mixins(AsyncView) {\n private listing: Listing | null = null;\n\n private formData: FormConstructorData | null = null;\n\n mounted() {\n API.Listings.Get(this.$route.params.id).then((listing) => {\n this.listing = listing;\n\n this.formData = {\n ClientWebsiteId: Config.Website.Id,\n Items: [\n {\n Type: ContextItemType.Listing,\n Id: listing.Id,\n },\n ],\n };\n });\n }\n}\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--14-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/ts-loader/index.js??ref--14-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ListingMakeAnOffer.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--14-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/ts-loader/index.js??ref--14-3!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ListingMakeAnOffer.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./ListingMakeAnOffer.vue?vue&type=template&id=69e40160&scoped=true&\"\nimport script from \"./ListingMakeAnOffer.vue?vue&type=script&lang=ts&\"\nexport * from \"./ListingMakeAnOffer.vue?vue&type=script&lang=ts&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"69e40160\",\n null\n \n)\n\nexport default component.exports","export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Form.vue?vue&type=style&index=0&id=69add52b&scoped=true&lang=css&\"","export * from \"-!../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Form.vue?vue&type=style&index=1&lang=css&\"","import Vue from \"vue\";\r\nimport { Component } from \"vue-property-decorator\";\r\nimport { AnalyticsEvent, AnalyticsEventObject, AnalyticsPageView, IAnalyticsAdapter, PROListAnalyticsAdapter } from \"../../services/Analytics\";\r\nimport { HeadService } from \"../../services/HeadService\";\r\nimport { ServiceManager, ServiceType } from \"../../services/ServiceManager\";\r\nimport { RouteMeta } from \"../meta\";\r\n\r\ninterface ViewBase {\r\n getAnalyticsEvent?(): AnalyticsEvent | null;\r\n getAnalyticsData?(): AnalyticsEventObject | null;\r\n head?(): RouteMeta | Promise | null;\r\n}\r\n\r\n@Component\r\nclass ViewBase extends Vue {\r\n protected prolistAnalyticsService = ServiceManager.Get(ServiceType.Analytics, 'PROListAnalyticsAdapter');\r\n protected headService = ServiceManager.Require(ServiceType.Head)!;\r\n\r\n public updateAnalytics() {\r\n let evt: AnalyticsEvent | null = null;\r\n let obj: AnalyticsEventObject | null = null;\r\n\r\n if (typeof this.getAnalyticsEvent !== 'undefined') {\r\n evt = this.getAnalyticsEvent.call(this);\r\n } else if(typeof this.getAnalyticsData !== 'undefined') {\r\n obj = this.getAnalyticsData.call(this);\r\n }\r\n\r\n if (evt === null) evt = new AnalyticsPageView(this.$route.path, this.$route.name || '', obj || undefined);\r\n\r\n this.triggerAnalyticsEvent(evt);\r\n }\r\n\r\n public triggerAnalyticsEvent(event: AnalyticsEvent) {\r\n ServiceManager.GetAll(ServiceType.Analytics).forEach((adapter) => {\r\n adapter.Record(event);\r\n });\r\n }\r\n\r\n public triggerCustomAnalyticsEvent(event: AnalyticsEvent) {\r\n if (this.prolistAnalyticsService !== null) this.prolistAnalyticsService.Record(event);\r\n }\r\n\r\n protected updateHead() {\r\n if ('head' in this) {\r\n const result = this.head!.bind(this)();\r\n\r\n if(result instanceof Promise) {\r\n result.then((meta: RouteMeta | null) => {\r\n this.headService.Update(meta);\r\n });\r\n } else {\r\n this.headService.Update(result as RouteMeta | null);\r\n }\r\n } else {\r\n this.headService.UpdateWithStatic(this.$route.path);\r\n }\r\n }\r\n}\r\n\r\n@Component\r\nclass View extends ViewBase {\r\n public mounted() {\r\n requestAnimationFrame(() => {\r\n this.updateHead();\r\n this.updateAnalytics();\r\n });\r\n }\r\n}\r\n\r\n@Component\r\nclass AsyncView extends ViewBase {\r\n public mounted() {\r\n this.$on('updateView', () => {\r\n requestAnimationFrame(() => {\r\n this.updateHead();\r\n this.updateAnalytics();\r\n });\r\n });\r\n }\r\n}\r\n\r\nexport {\r\n View,\r\n AsyncView\r\n}\r\n","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('form',{staticClass:\"form\",style:(_vm.formStyle)},[_c('Loader',{attrs:{\"loading\":_vm.loading}}),(_vm.hasAutosave)?_c('div',{staticClass:\"form__panel form__panel--autosaved\",on:{\"click\":_vm.loadAutosave}},[_c('p',[_vm._v(\" This form was autosaved at \"+_vm._s(_vm.autosaveDate)+\". Click here to load the autosave. \")])]):_vm._e(),(_vm.definition)?[(_vm.submitted)?_c('div',{staticClass:\"form__panel form__panel--success\"},[_c('p',{domProps:{\"innerHTML\":_vm._s(_vm.definition.Options.SubmittedText)}})]):[_vm._l((_vm.definition.Sections),function(section){return _c('Section',{key:section.SectionId,ref:section.SectionId,refInFor:true,attrs:{\"def\":section,\"errors\":_vm.errors,\"form-context\":_vm.ctx,\"form-type\":_vm.type},on:{\"field_input\":_vm.handleFieldInput}})}),(_vm.errored)?_c('div',{staticClass:\"form__panel form__panel--errored\"},[_c('p',[_vm._v(\" Please fill out all red highlighted fields. \")])]):_vm._e(),_c('div',{staticClass:\"center-text\"},[_c('Button',{staticClass:\"form__submit-btn\",class:_vm.submitButtonClass,attrs:{\"loading\":_vm.loading,\"colour\":_vm.submitButtonColour,\"background-colour\":_vm.submitButtonBackgroundColour},on:{\"click\":_vm.submitForm}},[_vm._v(_vm._s(_vm.definition.Options.SubmitButtonText))])],1)]]:_vm._e()],2)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport { Component, Vue, Prop } from 'vue-property-decorator';\nimport { FormDefinition, FormSubmissionValidationError, FormField, FormValue } from 'client-website-ts-library/types/Forms';\nimport {\n AutosaveManager,\n ServiceManager,\n ServiceType,\n API,\n Config,\n Logger,\n LogLevel,\n ReCaptchaService,\n} from 'client-website-ts-library/services';\nimport { Context } from 'client-website-ts-library/types';\nimport { PDFFieldData } from 'client-website-ts-library/types/Forms/FieldTypes';\nimport { IRequestProgressDelegate } from 'client-website-ts-library/services/API/IRequestProgressDelegate';\n\nimport Section from './Section.vue';\nimport Loader from '../UI/Loader.vue';\n\n@Component({\n components: {\n Section,\n Loader,\n },\n})\nexport default class Form extends Vue implements IRequestProgressDelegate {\n @Prop({ default: () => ({ Items: [] }) })\n private readonly context!: Context;\n\n @Prop()\n private readonly type!: string;\n\n @Prop()\n private readonly submitButtonColour!: string;\n\n @Prop()\n private readonly submitButtonBackgroundColour!: string;\n\n @Prop()\n private readonly submitButtonClass!: string;\n\n @Prop()\n private readonly autosaveNamespace!: string;\n\n @Prop()\n private readonly enableAutosave!: boolean;\n\n @Prop({ default: 'var(--form-field-bg)' })\n private readonly fieldBg!: string;\n\n @Prop({ default: 'var(--form-field-colour)' })\n private readonly fieldColour!: string;\n\n @Prop({ default: 'var(--form-label-colour)' })\n private readonly labelColour!: string;\n\n @Prop({ default: 'var(--form-field-border-colour)' })\n private readonly borderColour!: string;\n\n @Prop({ default: 'var(--form-label-focused-bg)' })\n private readonly labelFocusedBg!: string;\n\n @Prop({ default: 'var(--form-label-focused-colour)' })\n private readonly labelFocusedColour!: string;\n\n @Prop({ default: '#eee' })\n private readonly underlineInactive!: string;\n\n @Prop({ default: 'var(--brand-primary)' })\n private readonly underlineActive!: string;\n\n @Prop({ default: true })\n private readonly includeRecaptcha!: boolean;\n\n private ctx: Context = this.context;\n\n private errored = false;\n\n private submitted = false;\n\n private errors: FormSubmissionValidationError[] = [];\n\n private loading = true;\n\n private definition: FormDefinition | null = null;\n\n private autosaveManager: AutosaveManager = ServiceManager.Require(ServiceType.FormAutosave);\n\n private hasAutosave = false;\n\n private autosaveDate: string | null = null;\n\n private submitPercent = 0;\n\n private recaptchaService = ServiceManager.Require(ServiceType.ReCaptcha) as ReCaptchaService;\n\n private propertyAdressFormFieldValue: string | null = null;\n\n get formStyle() {\n return {\n '--field-bg': this.fieldBg,\n '--field-colour': this.fieldColour,\n '--border-colour': this.borderColour,\n '--label-colour': this.labelColour,\n '--label-focused-bg': this.labelFocusedBg,\n '--label-focused-colour': this.labelFocusedColour,\n '--underline-inactive': this.underlineInactive,\n '--underline-active': this.underlineActive,\n };\n }\n\n onProgress(progress: number, total: number) {\n this.submitPercent = Math.round((progress / total) * 100);\n\n console.log(this.submitPercent);\n }\n\n mounted() {\n if (this.ctx === null) {\n this.ctx = {\n Items: [],\n ClientWebsiteId: Config.Website.Id,\n };\n }\n\n if (this.ctx.ClientWebsiteId === undefined) {\n this.ctx.ClientWebsiteId = Config.Website.Id;\n }\n\n API.Forms.GetForm(this.type, this.context).then((def) => {\n this.loading = false;\n this.definition = def;\n\n if (this.enableAutosave) {\n const state = this.autosaveManager.GetState(this.type);\n\n if (state !== null) {\n this.hasAutosave = true;\n }\n }\n }).catch(() => {\n this.errored = true;\n });\n }\n\n loadAutosave(): void {\n if (!this.hasAutosave) return;\n\n const state = this.autosaveManager.GetState(this.type);\n\n if (state === null) return;\n\n this.definition!.Sections.forEach((section) => {\n const sectionComponent = (this.$refs[section.SectionId] as Vue[])[0] as Section;\n\n sectionComponent.setData(state);\n });\n }\n\n private handleFieldInput(fieldDef: FormField): void {\n this.errors = this.errors.filter((err) => err.Key !== fieldDef.Key);\n }\n\n submitForm(): void {\n if (this.loading) return;\n\n this.loading = true;\n\n this.errors = [];\n\n this.collectData(this.includeRecaptcha).then((data) => {\n const normalisedData = Form.normaliseData(data);\n\n console.log(normalisedData);\n\n this.loading = false;\n\n // this.context.ClientWebsiteId = Config.Website.Id;\n\n // if (this.enableAutosave) this.autosaveManager.SetState(this.type, data);\n\n API.Forms.SubmitForm(this.type, this.context, normalisedData).then((result) => {\n this.loading = false;\n\n if (!result.Valid) {\n // Reset ReCaptcha\n this.resetRecaptcha();\n\n // Update errors\n this.errors = result.ValidationState.Errors;\n this.errored = true;\n } else if (result.Submitted) {\n // Inform the user that the form was submitted\n this.submitted = true;\n\n // this.$router.push({ path: '/thank-you' });\n\n this.$emit('submitted', result.Result);\n }\n }).catch(() => {\n // Reset ReCaptcha\n this.resetRecaptcha();\n\n // Inform the user that there was an error\n this.errored = true;\n }).finally(() => {\n this.loading = false;\n });\n });\n }\n\n private static normaliseData(data: FormValue[]): FormValue[] {\n const newValues: FormValue[] = [];\n\n data.forEach((entry) => {\n if (entry.Value instanceof Array) {\n if (entry.Value.length) {\n newValues.push({\n Key: `${entry.Key}_length`,\n Value: entry.Value.length,\n });\n\n for (let i = 0; i < entry.Value.length; i += 1) {\n newValues.push({\n Key: `${entry.Key}_${i}`,\n Value: entry.Value[i],\n });\n }\n }\n } else {\n newValues.push(entry);\n }\n });\n\n return newValues;\n }\n\n private collectData(includeRecaptcha: boolean): Promise {\n return new Promise((resolve, reject) => {\n const data: FormValue[] = [];\n\n // Loop through each form secction and collect the data from it\n this.definition!.Sections.forEach((section) => {\n const sectionComponent = (this.$refs[section.SectionId] as Vue[])[0] as Section;\n\n data.push(...sectionComponent.collectData());\n });\n\n // If we also need to submit the ReCaptcha response, make sure we call getResponse on the ReCaptcha component\n if (includeRecaptcha) {\n setTimeout(() => {\n this.loading = false;\n }, 1000);\n\n this.getRecaptchaResponse().then((recaptchaResponse: string) => {\n Logger.Log(LogLevel.Debug, '[Form]', 'Got ReCaptcha response');\n\n data.push({\n Key: '_recaptcha',\n Value: recaptchaResponse,\n });\n\n resolve(data);\n }).catch(reject);\n\n return;\n }\n\n // If we don't need ReCaptcha, resolve straight away\n resolve(data);\n });\n }\n\n private resetRecaptcha(): void {\n this.recaptchaService.Reset();\n }\n\n private getRecaptchaResponse(): Promise {\n return this.recaptchaService.GetResponse();\n }\n}\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--14-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??ref--14-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Form.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--14-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??ref--14-3!../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Form.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./Form.vue?vue&type=template&id=69add52b&scoped=true&\"\nimport script from \"./Form.vue?vue&type=script&lang=ts&\"\nexport * from \"./Form.vue?vue&type=script&lang=ts&\"\nimport style0 from \"./Form.vue?vue&type=style&index=0&id=69add52b&scoped=true&lang=css&\"\nimport style1 from \"./Form.vue?vue&type=style&index=1&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"69add52b\",\n null\n \n)\n\nexport default component.exports"],"sourceRoot":""}