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EAAG,OAAO,CAACG,YAAY,mBAAmBE,MAAM,CAAC,KAAO,OAAO,EAAI,sCAAsCN,EAAIS,KAAKT,EAAIU,GAAG,SAASV,EAAIW,GAAGX,EAAIY,GAAGZ,EAAInD,aAAa,UAAUmD,EAAIU,GAAG,KAAKT,EAAG,aAAa,CAACK,MAAM,CAAC,KAAO,SAAS,CAAEN,EAAgB,aAAEC,EAAG,OAAO,CAACG,YAAY,WAAW,CAACJ,EAAIU,GAAGV,EAAIW,GAAGX,EAAIY,GAAGZ,EAAIrD,kBAAkBqD,EAAIS,QAAQ,EAC13B,EACII,EAAkB,E","sources":["webpack:///./resources/area/web/default/js/components/catalog/product/ConfiguratorSaveButton.vue?b58e","webpack:///./resources/area/web/default/js/components/catalog/product/ConfiguratorSaveButton.vue?db33","webpack:///./resources/area/web/default/js/components/catalog/product/ConfiguratorSaveButton.vue?f074","webpack:///./resources/area/web/default/js/components/catalog/product/ConfiguratorSaveButton.vue?dd55"],"sourcesContent":["\nimport {\n  Component,\n  Prop,\n  Vue,\n  Watch\n} from 'vue-property-decorator';\nimport ServiceContainer from '@flashpointbv/solar-service-container';\n\n@Component({\n  name: 'catalog-product-configurator-save-button',\n  components: ServiceContainer().getComponents(),\n})\nexport default class extends Vue {\n  @Prop() private readonly level: string;\n  @Prop() private readonly name: string;\n  @Prop() private readonly category: string;\n\n  private savingPreset: boolean = false;\n  private errorMessage: null | string = null;\n  private isSaved: boolean = false;\n\n  private get buttonText(): string {\n    if (this.isSaved) {\n      return 'Configuration code ready!';\n    }\n\n    return this.savingPreset ? 'Saving configuration...' : 'Save this configuration';\n  }\n\n  private addDataLayerEvent(level, name, category): void {\n    window.dataLayer = window.dataLayer || [];\n    window.dataLayer.push({\n      'event': 'save_configurator',\n      'level': level,\n      'product_name': name,\n      'product_category': category\n    });\n  }\n\n  private async saveConfiguration(): Promise<void> {\n    this.addDataLayerEvent(this.level, this.name, this.category);\n    this.savingPreset = true;\n    try {\n      const {data} = await this.$solarClient.post(\n          '/api/catalog/configuration',\n          this.getCurrentConfiguration,\n          {timeout: 25000}\n      );\n\n      this.$store.commit('CatalogProductConfigurator/SET_CONFIGURATION_CODE', data.code);\n    } catch (e) {\n      console.error(e);\n      this.errorMessage = 'The configuration could not be saved, please try again later.';\n    } finally {\n      this.savingPreset = false;\n      this.isSaved = true;\n      setTimeout(() => {\n        let headerHeight = document.getElementsByTagName('header')[0].offsetHeight;\n        let elementPosition = document.getElementById('configuration-code')?.getBoundingClientRect().top + window.scrollY;\n\n        let scrollPosition = elementPosition - headerHeight;\n        window.scrollTo({ top: scrollPosition, behavior: 'smooth' });\n      }, 500);\n\n      await this.$store.dispatch('CatalogProductConfigurator/fetchFilteredConfigurationSteps').then(data => {\n        console.log(data);\n      });\n    }\n  }\n\n  private get getCurrentConfiguration(): object {\n    let selectedOptions = {};\n    selectedOptions['hash'] = this.$store.getters['CatalogProductConfigurator/getConfigurationHash'];\n    selectedOptions['product_id'] = this.$store.getters['CatalogProductConfigurator/getConfigurationProductId'];\n\n    this.$store.getters['CatalogProductConfigurator/getConfigurationSteps'].forEach((step: object) => {\n      step['elements'].forEach((subGroup: object) => {\n        if (subGroup['selected'] !== null && subGroup['selected'] !== '') {\n          if (subGroup.hasOwnProperty('is_group') && subGroup['is_group']) {\n            selectedOptions[subGroup['group']['code']] = subGroup['selected'];\n          } else {\n            selectedOptions[subGroup['code']] = subGroup['selected'];\n          }\n        }\n\n        if (subGroup.hasOwnProperty('elements')) {\n          subGroup['elements'].forEach((subSubGroup: object) => {\n            if (subSubGroup['selected'] !== null && subSubGroup['selected'] !== '') {\n              selectedOptions[subSubGroup['code']] = subSubGroup['selected'];\n            }\n          });\n        }\n      });\n    });\n\n    return selectedOptions;\n  }\n\n  private get configurationHash(): string {\n    return this.$store.getters['CatalogProductConfigurator/getConfigurationHash'];\n  }\n\n  @Watch('configurationHash')\n  private onConfigurationHashChange(): void {\n    this.isSaved = false;\n    this.$store.commit('CatalogProductConfigurator/SET_CONFIGURATION_CODE', '');\n  }\n}\n","import { render, staticRenderFns } from \"./ConfiguratorSaveButton.vue?vue&type=template&id=6289fdab&scoped=true&\"\nimport script from \"./ConfiguratorSaveButton.vue?vue&type=script&lang=ts&\"\nexport * from \"./ConfiguratorSaveButton.vue?vue&type=script&lang=ts&\"\nimport style0 from \"./ConfiguratorSaveButton.vue?vue&type=style&index=0&id=6289fdab&prod&scoped=true&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  \"6289fdab\",\n  null\n  \n)\n\nexport default component.exports","import mod from \"-!../../../../../../../../node_modules/ts-loader/index.js??clonedRuleSet-6.use[0]!../../../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ConfiguratorSaveButton.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../../../../../../../node_modules/ts-loader/index.js??clonedRuleSet-6.use[0]!../../../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ConfiguratorSaveButton.vue?vue&type=script&lang=ts&\"","var render = function render(){var _vm=this,_c=_vm._self._c,_setup=_vm._self._setupProxy;return _c('div',{staticClass:\"product__save\"},[_c('button',{class:{'--success': _vm.isSaved},attrs:{\"disabled\":_vm.savingPreset || _vm.isSaved},on:{\"click\":function($event){return _vm.saveConfiguration()}}},[(_vm.isSaved)?_c('span',{staticClass:\"success-animation\"},[_c('svg',{staticClass:\"checkmark\",attrs:{\"xmlns\":\"http://www.w3.org/2000/svg\",\"viewBox\":\"0 0 52 52\"}},[_c('circle',{staticClass:\"checkmark__circle\",attrs:{\"cx\":\"26\",\"cy\":\"26\",\"r\":\"25\",\"fill\":\"none\"}}),_c('path',{staticClass:\"checkmark__check\",attrs:{\"fill\":\"none\",\"d\":\"M14.1 27.2l7.1 7.2 16.7-16.8\"}})])]):_vm._e(),_vm._v(\"\\n    \"+_vm._s(_vm.$t(_vm.buttonText))+\"\\n  \")]),_vm._v(\" \"),_c('transition',{attrs:{\"name\":\"fade\"}},[(_vm.errorMessage)?_c('span',{staticClass:\"--error\"},[_vm._v(_vm._s(_vm.$t(_vm.errorMessage)))]):_vm._e()])],1)\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }"],"names":["Vue","savingPreset","errorMessage","isSaved","buttonText","this","addDataLayerEvent","level","name","category","window","dataLayer","push","saveConfiguration","data","$solarClient","post","getCurrentConfiguration","timeout","$store","commit","code","e","console","error","setTimeout","headerHeight","document","getElementsByTagName","offsetHeight","scrollPosition","getElementById","getBoundingClientRect","top","scrollY","scrollTo","behavior","dispatch","then","log","selectedOptions","getters","forEach","step","subGroup","hasOwnProperty","subSubGroup","configurationHash","onConfigurationHashChange","Prop","Watch","Component","components","getComponents","render","_vm","_c","_self","_setupProxy","staticClass","class","attrs","on","$event","_e","_v","_s","$t","staticRenderFns"],"sourceRoot":""}