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AAA,EAAAA,IAAA,EAH3CK,EAAAA,EAAAA,IAAU,CACPC,KAAM,6BAEWnB,G,UCTqd,I,eCOteoB,GAAY,OACd,EACArC,EACAgB,GACA,EACA,KACA,KACA,MAIF,QAAeqB,EAAiB,O","sources":["webpack://website-js/./src/models/Customer.ts","webpack://website-js/./src/services/CustomerService.ts","webpack://website-js/./src/components/customer-profile/CustomerProfileSelector.vue","webpack://website-js/./src/components/customer-profile/CustomerProfileSelector.vue?d6bd","webpack://website-js/./src/components/customer-profile/CustomerProfileSelector.vue?51e5","webpack://website-js/./src/components/customer-profile/CustomerProfileSelector.vue?c17c"],"sourcesContent":["export interface Customer {\r\n    id: string;\r\n    name: string;\r\n}\r\n\r\nexport enum CustomerProfile {\r\n    UNSET,\r\n    B2C,\r\n    B2B,\r\n}\r\n","import axios, { AxiosResponse } from 'axios';\r\nimport { Customer, CustomerProfile } from '@/models/Customer';\r\n\r\nexport default class CustomerService {\r\n\r\n    private profileId: string = (window as any).CbxApiContextKey;\r\n    private endpoint: string;\r\n\r\n    constructor(args: any = {}) {\r\n        if (args.profileId)\r\n            this.profileId = args.profileId;\r\n        this.endpoint = `/contextapi/${this.profileId}/v1/customer`;\r\n    }\r\n\r\n    public async getCustomer(): Promise<Customer> {\r\n        try {\r\n            const res: AxiosResponse<any> = await axios.get(`${this.endpoint}`);\r\n            return res.data;\r\n        } catch (e) {\r\n            console.log(e);\r\n        }\r\n    }\r\n\r\n    public async search(query: string, limit: number = 15, offset: number = 0): Promise<Customer[]> {\r\n        try {\r\n            const res: AxiosResponse<any> = await axios.get(`${this.endpoint}/search/?query=${query}&limit=${limit}&offset=${offset}`);\r\n            return res.data;\r\n        } catch (e) {\r\n            console.log(e);\r\n        }\r\n    }    \r\n\r\n    public async changeCustomer(selectedcustomer: string): Promise<Customer> {\r\n        try {\r\n            const res: AxiosResponse<any> = await axios.post(`${this.endpoint}/change/?selectedcustomer=${selectedcustomer}`);\r\n            return res.data;\r\n        } catch (e) {\r\n            console.log(e);\r\n        }\r\n    }      \r\n\r\n    public async changeCustomerProfile(customerprofile: CustomerProfile): Promise<any> {\r\n        try {\r\n            const res: AxiosResponse<any> = await axios.get(`${this.endpoint}/changeprofile/?customerprofile=${customerprofile}`);\r\n            return res.data;\r\n        } catch (e) {\r\n            console.log(e);\r\n        }\r\n    }\r\n\r\n    public async showDefaultCatalogue(payload: boolean): Promise<any> {\r\n        try {\r\n            const res: AxiosResponse<any> = await axios.get(`${this.endpoint}/showDefaultCatalogue/${payload}`);\r\n            return res.data;\r\n        } catch (e) {\r\n            console.log(e);\r\n        }\r\n    }\r\n}\r\n","var render = function render(){var _vm=this,_c=_vm._self._c,_setup=_vm._self._setupProxy;return _c('div',{staticClass:\"customer-profile-selector uk-button-group uk-preserve\"},[_c('button',{staticClass:\"uk-button\",class:{ 'uk-button-primary': _vm.isCustomerB2C, 'uk-button-default': _vm.isCustomerB2B },on:{\"click\":function($event){return _vm.toggleCustomerProfile(1)}}},[_vm._v(\" \"+_vm._s(_vm.b2cText)+\" \")]),_c('button',{staticClass:\"uk-button\",class:{ 'uk-button-primary': _vm.isCustomerB2B, 'uk-button-default': _vm.isCustomerB2C },on:{\"click\":function($event){return _vm.toggleCustomerProfile(2)}}},[_vm._v(\" \"+_vm._s(_vm.b2bText)+\" \")])])\n}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\r\nimport { CbxVariablesModule } from '@/store/modules/CbxVariablesModule';\r\nimport { Component, Prop, Vue } from 'vue-property-decorator';\r\nimport CustomerService from '../../services/CustomerService';\r\nimport { CustomerProfile } from '../../models/Customer';\r\n\r\n@Component({\r\n    name: 'CustomerProfileSelector',\r\n})\r\nexport default class CustomerProfileSelector extends Vue {\r\n    @Prop({ type: String, required: true }) private b2bText: string;\r\n    @Prop({ type: String, required: true }) private b2cText: string;\r\n\r\n    private cs: CustomerService = new CustomerService();\r\n\r\n    get selectedCustomerProfile(): CustomerProfile {\r\n        return CbxVariablesModule.VARIABLES.customerProfile;\r\n    }\r\n\r\n    get isCustomerB2B(): boolean {\r\n        return this.selectedCustomerProfile == CustomerProfile.B2B;\r\n    }\r\n\r\n    get isCustomerB2C(): boolean {\r\n        return (\r\n            this.selectedCustomerProfile == CustomerProfile.B2C || this.selectedCustomerProfile == CustomerProfile.UNSET\r\n        );\r\n    }\r\n\r\n    private async toggleCustomerProfile(customerProfile: CustomerProfile) {\r\n        if (this.selectedCustomerProfile != customerProfile) {\r\n            await this.cs.changeCustomerProfile(customerProfile);\r\n            window.location.reload();\r\n        }\r\n    }\r\n}\r\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??clonedRuleSet-41.use[0]!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??clonedRuleSet-41.use[3]!../../../node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!../../../node_modules/@vue/cli-service/lib/config/vue-loader-v15-resolve-compat/vue-loader.js??vue-loader-options!./CustomerProfileSelector.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??clonedRuleSet-41.use[0]!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/ts-loader/index.js??clonedRuleSet-41.use[3]!../../../node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!../../../node_modules/@vue/cli-service/lib/config/vue-loader-v15-resolve-compat/vue-loader.js??vue-loader-options!./CustomerProfileSelector.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./CustomerProfileSelector.vue?vue&type=template&id=47e15845&\"\nimport script from \"./CustomerProfileSelector.vue?vue&type=script&lang=ts&\"\nexport * from \"./CustomerProfileSelector.vue?vue&type=script&lang=ts&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n  script,\n  render,\n  staticRenderFns,\n  false,\n  null,\n  null,\n  null\n  \n)\n\nexport default component.exports"],"names":["CustomerProfile","CustomerService","constructor","args","_defineProperty","window","CbxApiContextKey","profileId","this","endpoint","async","res","axios","data","e","console","log","query","limit","offset","selectedcustomer","customerprofile","payload","render","_vm","_c","_self","_setupProxy","staticClass","class","isCustomerB2C","isCustomerB2B","on","$event","toggleCustomerProfile","_v","_s","b2cText","b2bText","staticRenderFns","CustomerProfileSelector","Vue","selectedCustomerProfile","CbxVariablesModule","VARIABLES","customerProfile","B2B","B2C","UNSET","cs","changeCustomerProfile","location","reload","__decorate","Prop","type","String","required","Component","name","component"],"sourceRoot":""}